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

Safe HaskellNone

Derive.Call.Prelude.Trill

Contents

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

note calls

tremolo_starts Source #

Arguments

:: BaseTypes.Duration 
-> BaseTypes.ControlRef 
-> (ScoreTime.ScoreTime, ScoreTime.ScoreTime) 
-> Deriver [ScoreTime.ScoreTime]

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

tremolo_starts_curve Source #

Arguments

:: ControlUtil.Curve 
-> BaseTypes.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.

chord_tremolo :: forall a. [ScoreTime.ScoreTime] -> [[Sub.GenericEvent a]] -> [Sub.GenericEvent 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.

simple_tremolo :: [ScoreTime.ScoreTime] -> [NoteDeriver] -> NoteDeriver Source #

Just cycle the given notes.

c_attr_tremolo :: Make.Calls Note Source #

This is defined here instead of in Derive.Call.Attribute so it can be next to c_tremolo.

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.

pitch calls

control calls

sine

data SineMode Source #

Constructors

Bipolar 
Negative 
Positive 

Instances

c_sine :: SineMode -> Generator Control Source #

This is probably not terribly convenient to use on its own, I should have some more specialized calls based on this.

xcut

util

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 

convert_direction Source #

Arguments

:: RealTime.RealTime 
-> Typecheck.Function 
-> Maybe.Maybe Direction 
-> Maybe.Maybe Direction 
-> ((Typecheck.Function, Typecheck.Function), Maybe.Maybe Bool)

Signals for the first and second trill notes. The boolean indicates whether the transitions should be even to end on the expected end Direction, and Nothing if it doesn't matter.

Resolve start and end Directions to the first and second trill notes.

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.

transitions

adjusted_transitions Source #

Arguments

:: Bool

include a transition at the end time

-> Maybe.Maybe Bool

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

-> Adjust

how to fit the transitions into the time range

-> Double

offset every other transition by this amount, from -1--1

-> ScoreTime.ScoreTime

extend the first transition by this amount

-> BaseTypes.ControlRef

transition speed

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

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

trill_from_transitions :: Typecheck.Function -> Typecheck.Function -> [RealTime.RealTime] -> Signal.Control Source #

Make a trill signal from a list of transition times.

full_cycles :: (Ord a, Num a) => a -> a -> Bool -> [a] -> [a] Source #

Given a list of trill transition times, take only ones with a complete duration. Otherwise a trill can wind up with a short note at the end, which sounds funny. However it's ok if the note is slightly too short, as tends to happen with floating point.