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

Derive.Call.Lily

Description

Utilities for calls to cooperate with the lilypond backend.

Synopsis

# utils for ly calls

Arguments

 :: Deriver a Run if this is a lilypond derive. -> Deriver a Run if this is a normal derive. -> Deriver a

Arguments

 :: (Types.Config -> Deriver a) Run if this is a lilypond derive. -> Deriver a Run if this is a normal derive. -> Deriver a

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

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

## transformer

Add code to the first event.

## note parent

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

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

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.

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

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

Transform and evaluate the sub events.

## events around

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.

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.

Instances

 # Methods # Methods # MethodsshowList :: [CodePosition] -> ShowS #

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.

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

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.

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.

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

## convert

Round the RealTime to the nearest NoteDuration.

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