Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

Derive.C.Prelude.Trill

Description

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.

Synopsis

Documentation

tremolo_starts_curve Source #

Arguments

:: 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.

transitions

adjusted_transitions Source #

Arguments

:: 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.

types

data Config Source #

Constructors

Config 

Fields

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.

Constructors

High 
Low 

data Adjust Source #

How to adjust an ornament to fulfill its Direction restrictions.

Constructors

Shorten

Adjust by shortening the ornament.

Stretch

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.

get_trill_control :: Config -> (ScoreTime.ScoreTime, ScoreTime.ScoreTime) -> ScoreT.Function -> Deriver [(RealTime.RealTime, Signal.Y)] Source #

A signal that alternates between the base and neighbor values.