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



Various kinds of trills.

Trills want to generate an integral number of cycles. For the purpose of counting integral cycles, trills count the end (either the end of the event, or the start of the next event). This is different than other control calls, which tend to omit the end point, expecting that the next call will place a sample there. This is so that a trill can end on an off note if it exactly fits into its allotted space, otherwise a 16th note trill in a quarter note would degenerate into a mordent.

Various flavors of trills:

  • Trill cycles depend on real duration of note. Cycle durations are given in real time.
  • As above, but durations are given in score time.
  • Number of trill cycles given as argument, and note stretches normally.
  • Sung style vibrato in a sine wave rather than a square wave.
  • Trill that simply adds an attribute, instrument will handle it.

The generic tr symbol can be bound to whichever variant is locally appropriate.

It's easy to think of more variants of trills: hold the starting note briefly, hold the final note briefly, inject a little randomness, smooth the pitch curve by a variable amount, or variants that cover the range between trill and vibrato, etc. One can also imagine dynamic effects.

Instead of trying to provide a million functions here or a few with a million parameters, it should be relatively easy to reuse the functions in here to write a specific kind of trill for the particular piece.



tremolo_starts_curve Source #


:: ControlUtil.CurveF 
-> DeriveT.Duration 
-> Speed.Speed 
-> Speed.Speed 
-> (ScoreTime.ScoreTime, ScoreTime.ScoreTime) 
-> Deriver [ScoreTime.ScoreTime]

start time for each note, and one for the end of the last one

This is like tremolo_starts, but takes a start and end speed instead of a speed signal. In exchange, it can have start and end be different time types, which a signal can't express. Of course I could make the signal into duration and then do the reciprocal in the score as a val call, but that seems too complicated for tracklang.


adjusted_transitions Source #


:: Config 
-> ScoreTime.ScoreTime 
-> Maybe.Maybe Bool

emit an even number of transitions, or Nothing for however many will fit

-> (ScoreTime.ScoreTime, ScoreTime.ScoreTime) 
-> Deriver [RealTime.RealTime] 

Get trill transition times, adjusted for all the various fancy parameters that trills have.


data Config Source #





Instances details
Show Config Source # 
Instance details

Defined in Derive.C.Prelude.Trill

data Direction Source #

Whether the trill starts or ends on the high or low note. This is another way to express AbsoluteMode.

I had a lot of debate about whether I should use High and Low, or Unison and Neighbor. Unison-Neighbor is more convenient for the implementation but High-Low I think is more musically intuitive.



data Adjust Source #

How to adjust an ornament to fulfill its Direction restrictions.



Adjust by shortening the ornament.


Adjust by increasing the speed.

full_notes :: Ord a => a -> [a] -> [a] Source #

Given start times, return only ones whose full duration fits before the end time. This is the tremolo analog to full_cycles. Unlike a trill, it emits both the starts and ends, and therefore the last sample will be at the end time, rather than before it. It should always emit an even number of elements.

chord_tremolo :: forall a. [ScoreTime.ScoreTime] -> [[SubT.EventT a]] -> [SubT.EventT a] Source #

Alternate each note with the other notes within its range, in order from the lowest track to the highest.

This doesn't restart the tremolo when a new note enters, if you want that you can have multiple tremolo events.