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

Safe HaskellNone



Post-processing to apply a string idiom.



string_idiom Source #


:: PitchUtil.Interpolate

interpolator to draw the attack curve

-> PitchUtil.Interpolate

draw the release curve

-> [BaseTypes.Pitch]

Pitches of open strings.

-> BaseTypes.ControlRef

Attack time.

-> BaseTypes.ControlRef

Release delay.

-> BaseTypes.ControlRef

Time for string to return to its open pitch.

-> Stream.Stream Score.Event 
-> NoteDeriver 

Post-process events to play them in a monophonic 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 the following note, 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.

TODO It would be possible to have a polyphonic effect by allowing more than one stopped string at a time.

process Source #


:: Map Pitch.NoteNumber BaseTypes.Pitch

The strings are tuned to Pitches, but to compare Pitches I have to evaluate them to NoteNumbers first.

-> PitchUtil.Interpolate 
-> PitchUtil.Interpolate 
-> (RealTime, RealTime, RealTime) 
-> State 
-> Score.Event 
-> Deriver (State, [Score.Event]) 


  • If the note falls on a new string, release the previously playing note (bend down to its open position) and emit it.
  • If the note falls on the string in use, bend that string up to the note to be played and emit it.

attack :: PitchUtil.Interpolate -> RealTime -> BaseTypes.Pitch -> RealTime -> Score.Event -> Maybe Score.Event Source #

Bend the event up to the next note.

release :: PitchUtil.Interpolate -> RealTime -> RealTime -> BaseTypes.Pitch -> RealTime -> Score.Event -> Maybe Score.Event Source #

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

data State Source #

Keep track of the current string state.