Safe Haskell | Safe-Inferred |
---|
Convert Lilypond Events to lilypond code.
It's a terrible name, but what else am I supposed to call it? Render? Realize? Perform?
Synopsis
- process :: Types.Config -> Types.Time -> [Meter.Meter] -> [Types.Event] -> Either Log.Msg [Either Voices Ly]
- convert_to_rests :: [Either Voices Ly] -> [Ly]
- parse_key :: Text -> Either Error Key
- data Ly
- = LyNote !Note
- | LyRest !Rest
- | LyNested Nested
- | LyBarline !(Maybe.Maybe Meter.Meter)
- | LyCode !Code
- data Note = Note {
- note_pitches :: !(NonEmpty NotePitch)
- note_duration :: !Types.NoteDuration
- note_prepend :: ![Code]
- note_append :: ![Code]
- note_stack :: !(Maybe.Maybe Stack.UiFrame)
- newtype Voices = Voices (VoiceMap Ly)
- data Voice
Documentation
:: Types.Config | |
-> Types.Time | |
-> [Meter.Meter] | one for each measure |
-> [Types.Event] | |
-> Either Log.Msg [Either Voices Ly] |
This is the top level function which converts a stream of Events on one staff into lilypond code.
. First pass finds voice boundaries.
. Then insert rests.
. Convert [Event]->[Ly]: keys, meter splitting, tuplet and tremolo.
. Merge 0 dur events FreeCode
in [Ly] since they have been split according
to the meter.
convert_to_rests :: [Either Voices Ly] -> [Ly] Source #
Convert a staff to all rests, keeping the key, clef, and meter changes. have predicates that recognize those, and keep those Codes
Ultimately, the contants of Ly is just a bit of lilypond code. They are
all converted to text via Types.to_lily
and concatenated to form the full score.
But I encode a fair amount of structure into the data type, which is
convenient for debugging. It could also could theoretically be further
modified, though I don't think I ever do that. However, ly_duration
at
least is used to merge FreeCode
into a Ly stream.
LyNote !Note | |
LyRest !Rest | |
LyNested Nested | |
LyBarline !(Maybe.Maybe Meter.Meter) | |
LyCode !Code |
Note | |
|
Each Ly list should be the same duration and have the same number of barlines.