Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone

Derive.Call.Lily

Contents

Description

Utilities for calls to cooperate with the lilypond backend.

Synopsis

utils for ly calls

when_lilypond Source #

Arguments

:: Deriver a

Run if this is a lilypond derive.

-> Deriver a

Run if this is a normal derive.

-> Deriver a 

when_lilypond_config Source #

Arguments

:: (Types.Config -> Deriver a)

Run if this is a lilypond derive.

-> Deriver a

Run if this is a normal derive.

-> Deriver a 

only_lilypond :: NoteDeriver -> NoteDeriver Source #

Only emit the deriver if I'm in lilypond mode.

note_code :: Code -> PassedArgs d -> NoteDeriver -> NoteDeriver Source #

When in lilypond mode, generate a note with the given Code.

transformer

add_first :: Code -> NoteDeriver -> NoteDeriver Source #

Add code to the first event.

note parent

notes_code :: Code -> PassedArgs d -> NoteDeriver -> NoteDeriver Source #

Replace a note parent with one that derives its sub-events as-is and adds lilypond code to them.

first_note_code :: Code -> PassedArgs d -> NoteDeriver -> NoteDeriver Source #

Like notes_code, but only apply the code to the first event, not all of them.

notes_around :: Code -> Code -> PassedArgs d -> NoteDeriver -> NoteDeriver Source #

This is like notes_code, but the first event in each track gets the start code, and the last event in each track gets the end code.

notes_around_ly :: Code -> Code -> PassedArgs d -> NoteDeriver Source #

Like notes_around, but for use when you already know you're in lilypond mode.

code_around :: Code -> Code -> PassedArgs d -> NoteDeriver Source #

Like notes_around, but when I'm not in lilypond mode just derive the sub events unchanged.

notes_with :: (NoteDeriver -> NoteDeriver) -> PassedArgs d -> NoteDeriver -> NoteDeriver Source #

Transform and evaluate the sub events.

events around

first_last :: (Score.Event -> Score.Event) -> (Score.Event -> Score.Event) -> Stream.Stream Score.Event -> Stream.Stream Score.Event Source #

Like Seq.first_last, but applied to a Stream. If the events start or end with a group of events with the same start time, the start or end function is applied to the entire group. This is because the lilypond performer will group them into a chord and will only take ly-prepend and ly-append from the first note in the chord. I could apply to only the first element of the group, but that would rely on every sort being stable.

code

type Code = (CodePosition, Ly) Source #

Either prepend or append some code to a lilypond note.

data CodePosition Source #

Constructors

Prefix

Code goes before the note.

SuffixAll

Code goes after each note in a tied sequence, so it could get duplicated several times.

SuffixFirst

Code goes after only the first note in a tied sequence.

SuffixLast

Code goes after the last note in a tied sequnece.

type Ly = Text Source #

Fragment of Lilypond code.

type Note = Ly Source #

A lilypond "note", which is just a chunk of text.

code :: (ScoreTime, ScoreTime) -> Ly -> NoteDeriver Source #

Emit a note that carries raw lilypond code. The code is emitted literally, and assumed to have the duration of the event. The event's pitch is ignored. This can be used to emit lilypond that doesn't fit into a Types.Event.

code0 :: ScoreTime -> Code -> NoteDeriver Source #

Like code, but for 0 duration code fragments, and can either put them before or after notes that occur at the same time.

code0_event :: Score.Event -> RealTime.RealTime -> Code -> Score.Event Source #

Make a code0 event directly. Inherit instrument and environ from an existing note. Otherwise, the lilypond backend doesn't know how to group the code event.

code0_pos :: CodePosition -> CodePosition Source #

SuffixFirst and SuffixLast are not used for 0 dur events, so make it less error-prone by getting rid of them. Ick.

global :: Deriver a -> Deriver a Source #

Derive with the Constants.ly_global instrument.

is_code0 :: Score.Event -> Bool Source #

Test if an event is a 0 duration lilypond code event.

convert

note_duration :: Types.Config -> RealTime.RealTime -> Types.NoteDuration Source #

Round the RealTime to the nearest NoteDuration.

is_note_duration :: Types.Config -> RealTime.RealTime -> Maybe Types.NoteDuration Source #

Like note_duration, but only succeeds if the RealTime is exactly a NoteDuration.

eval