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



Playing idioms of plucked or bowed strings. Generally these calls expect EnvKey.open_strings, and possibly EnvKey.string.



string_idiom :: Config -> Stream.Stream Score.Event -> NoteDeriver Source #

Post-process events to play them in a string-like idiom.

This tweaks the ends of the pitch signals of notes. When a new note is played, the next event is examined to determine if it will share a string or not.

If the string must be used for the following note, the end of the event is bent up to the next pitch before the next event is triggered. This is called the "attack". A fast attack gives the sound of a stopped string, a slow one sounds like a bent one.

If the string won't be used for a long enough time, it will be released after a delay. The release time determines how long it will take to reach its open pitch. Since the release happens after the note ends, only instruments with a bit of decay will have an audible release.

This does't do anything fancy like simulate hand position or alternate fingerings. It just selects the lowest string below or at the lowest pitch in the note.

process :: Config -> Score.Event -> StringUtil.String -> Maybe Score.Event -> Deriver Score.Event Source #

The next note has the same string, so bend this one to prepare. If it's over a certain threshold away, release this one. TODO maybe skip release and attack if the next note is over a certain threshold away? If its > the decay time, pitch curves would be inaudible... unless of course changing the pitch itself causes a sound, as it might for a fret slide.

add_release :: Config -> DeriveT.Pitch -> Maybe RealTime.RealTime -> Score.Event -> Deriver Score.Event Source #

After releasing a note, you release your hand, which means the pitch should bend down to the open string.

add_attack :: Config -> RealTime.RealTime -> Score.Event -> Score.Event -> Score.Event Source #

Bend the event up to the next note.

If there isn't enough time, do the bend faster. TODO It might be nice to make the transition spill over into the next attack.

mute end


make_gliss :: CallName -> Bool -> Generator Note Source #

This provides two kinds of glissando: absolute takes an absolute amount of time for the entire glissando, while non-absolute takes a certain amount of time per string, and hence will have a different duration depending on how many strings.