Karya, built on 2022-03-21T01:30:44 (patch 89d1651424c35e564138d93424a157ff87457245)
Safe HaskellSafe-Inferred



Scale is actually defined in Derive.Deriver.Monad to avoid circular imports. But you should refer to it from here.

The difference between this and Derive.Scale.Scales is that this is intended for using scales, while Scales is intended for implementing them.



type Layout = Vector.Vector Pitch.Semi Source #

The number of chromatic intervals between each Pitch.PitchClass, starting from 0, as returned by scale_read. The length is the number of degrees per octave. A diatonic-only scale will have all 1s, and a scale without octaves has an empty layout.

This is analogous to Layout, but is intended to be a minimal implementation that all scales can export, without having to support the full complexity of a chromatic scale.

Combined with scale_read and scale_show, I can use this to do math on scale degrees.

data Transposition Source #




Instances details
Show Transposition Source # 
Instance details

Defined in Derive.Deriver.Monad

newtype LookupScale Source #

A scale can configure itself by looking in the environment and by looking up other scales.


Instances details
Show LookupScale Source # 
Instance details

Defined in Derive.Deriver.Monad

data Scale Source #





Instances details
Pretty Scale Source # 
Instance details

Defined in Derive.Deriver.Monad

data Range Source #

This is an inclusive pitch range, intended for instrument ranges.




Instances details
Show Range Source # 
Instance details

Defined in Derive.Scale


showsPrec :: Int -> Range -> ShowS #

show :: Range -> String #

showList :: [Range] -> ShowS #

Pretty Range Source # 
Instance details

Defined in Derive.Scale

type PitchNn = DeriveT.PitchConfig -> Either DeriveT.PitchError Pitch.NoteNumber Source #

I would much rather pass a more specific value than Environ. Unfortunately, ChromaticScales.SemisToNoteNumber needs a per-scale value (e.g. Environ.key or Environ.tuning). So pitch_nn needs to be parameterized with a "get_key" function, but it also needs Environ.key. I think it's doable by parameterizing pitch_nn and hence note_to_call and moving smap_semis_to_nn into note_to_call, but it seems complicated.

data Definition Source #


Make !Pitch.ScaleId !(Text, DocumentedCall) !(DeriveT.Environ -> LookupScale -> Either DeriveT.PitchError Scale)

Fancy scales can configure themselves. Since you can't just look at the Scale directly, it has the ScaleId (pattern, doc) extracted.

Simple !Scale 

semis_per_octave :: Layout -> Pitch.Semi Source #

Number of chromatic steps in an octave. Nothing if this scale doesn't have octaves.

pc_per_octave :: Layout -> Maybe Pitch.PitchClass Source #

Number of diatonic steps in an octave. Nothing if this scale doesn't have octaves. This is the same as semis_per_octave for scales without a diatonic/chromatic distinction.

pitches :: Scale -> DeriveT.Environ -> [Pitch.Pitch] Source #

Return the pitches in the scale. If the scale has an unbounded range, this may go on forever, so zip with note_numbers if you want the usable range. Also, not all scales actually have defined degrees.

notes :: Scale -> DeriveT.Environ -> [Pitch.Note] Source #

Return the notes in the scale. As with pitches, it may be unbounded.

note_numbers :: Scale -> DeriveT.Environ -> Deriver [Pitch.NoteNumber] Source #

Return pitches of the scale's degrees.

patch_scale :: Pitch.ScaleId -> [Pitch.NoteNumber] -> Patch.Scale Source #

Make a patch scale from the NoteNumbers.

assign_keys :: Int -> [Pitch.NoteNumber] -> [(Int, Pitch.NoteNumber)] Source #

Try to assign MIDI keys that correspond to the NoteNumbers, but they won't line up if there are too many NoteNumbers.