Safe Haskell | Safe-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.
Synopsis
- library :: Library.Library
- c_note_trill :: Bool -> Maybe.Maybe Direction -> Maybe.Maybe Direction -> Generator Note
- c_tremolo_generator :: Maybe.Maybe ([Attrs.Attributes], Attrs.Attributes) -> Generator Note
- hold_env :: Sig.Parser DeriveT.Duration
- tremolo_starts_curve :: ControlUtil.CurveF -> DeriveT.Duration -> Speed.Speed -> Speed.Speed -> (ScoreTime.ScoreTime, ScoreTime.ScoreTime) -> Deriver [ScoreTime.ScoreTime]
- trill_transitions :: (ScoreTime.ScoreTime, ScoreTime.ScoreTime) -> Bool -> Typecheck.RealTimeFunctionT -> Deriver [RealTime.RealTime]
- adjusted_transitions :: Config -> ScoreTime.ScoreTime -> Maybe.Maybe Bool -> (ScoreTime.ScoreTime, ScoreTime.ScoreTime) -> Deriver [RealTime.RealTime]
- data Config = Config {
- _speed :: !Typecheck.RealTimeFunctionT
- _start_dir :: !(Maybe.Maybe Direction)
- _end_dir :: !(Maybe.Maybe Direction)
- _hold :: !DeriveT.Duration
- _adjust :: !Adjust
- _bias :: !Double
- _include_end :: !Bool
- data Direction
- direction_affix :: Maybe.Maybe Direction -> Text
- data AbsoluteMode
- data Adjust
- adjust_env :: Sig.Parser Adjust
- get_trill_control_smooth :: Config -> ControlUtil.Curve -> (ScoreTime.ScoreTime, ScoreTime.ScoreTime) -> ScoreT.Function -> Deriver Signal.Control
- full_notes :: Ord a => a -> [a] -> [a]
- chord_tremolo :: forall a. [ScoreTime.ScoreTime] -> [[SubT.EventT a]] -> [SubT.EventT a]
- get_trill_control :: Config -> (ScoreTime.ScoreTime, ScoreTime.ScoreTime) -> ScoreT.Function -> Deriver [(RealTime.RealTime, Signal.Y)]
- xcut_control :: Bool -> Signal.Control -> Signal.Control -> [RealTime.RealTime] -> Signal.Control
Documentation
c_note_trill :: Bool -> Maybe.Maybe Direction -> Maybe.Maybe Direction -> Generator Note Source #
c_tremolo_generator :: Maybe.Maybe ([Attrs.Attributes], Attrs.Attributes) -> Generator Note 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.
transitions
trill_transitions :: (ScoreTime.ScoreTime, ScoreTime.ScoreTime) -> Bool -> Typecheck.RealTimeFunctionT -> Deriver [RealTime.RealTime] Source #
Create trill transition points from a speed.
:: 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
Config | |
|
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.
Instances
Bounded Direction Source # | |
Enum Direction Source # | |
Defined in Derive.C.Prelude.Trill succ :: Direction -> Direction # pred :: Direction -> Direction # fromEnum :: Direction -> Int # enumFrom :: Direction -> [Direction] # enumFromThen :: Direction -> Direction -> [Direction] # enumFromTo :: Direction -> Direction -> [Direction] # enumFromThenTo :: Direction -> Direction -> Direction -> [Direction] # | |
Show Direction Source # | |
Eq Direction Source # | |
ShowVal.ShowVal Direction Source # | |
Typecheck.ToVal Direction Source # | |
Defined in Derive.C.Prelude.Trill to_val :: Direction -> DeriveT.Val Source # | |
Typecheck.Typecheck Direction Source # | |
Defined in Derive.C.Prelude.Trill |
data AbsoluteMode Source #
This is the like Direction
, but in terms of the unison and neighbor
pitches, instead of high and low.
Instances
Bounded AbsoluteMode Source # | |
Defined in Derive.C.Prelude.Trill | |
Enum AbsoluteMode Source # | |
Defined in Derive.C.Prelude.Trill succ :: AbsoluteMode -> AbsoluteMode # pred :: AbsoluteMode -> AbsoluteMode # toEnum :: Int -> AbsoluteMode # fromEnum :: AbsoluteMode -> Int # enumFrom :: AbsoluteMode -> [AbsoluteMode] # enumFromThen :: AbsoluteMode -> AbsoluteMode -> [AbsoluteMode] # enumFromTo :: AbsoluteMode -> AbsoluteMode -> [AbsoluteMode] # enumFromThenTo :: AbsoluteMode -> AbsoluteMode -> AbsoluteMode -> [AbsoluteMode] # | |
Show AbsoluteMode Source # | |
Defined in Derive.C.Prelude.Trill showsPrec :: Int -> AbsoluteMode -> ShowS # show :: AbsoluteMode -> String # showList :: [AbsoluteMode] -> ShowS # | |
Eq AbsoluteMode Source # | |
Defined in Derive.C.Prelude.Trill (==) :: AbsoluteMode -> AbsoluteMode -> Bool # (/=) :: AbsoluteMode -> AbsoluteMode -> Bool # |
How to adjust an ornament to fulfill its Direction
restrictions.
Instances
Bounded Adjust Source # | |
Enum Adjust Source # | |
Defined in Derive.C.Prelude.Trill | |
Show Adjust Source # | |
Eq Adjust Source # | |
ShowVal.ShowVal Adjust Source # | |
Typecheck.ToVal Adjust Source # | |
Defined in Derive.C.Prelude.Trill to_val :: Adjust -> DeriveT.Val Source # | |
Typecheck.Typecheck Adjust Source # | |
Defined in Derive.C.Prelude.Trill |
get_trill_control_smooth :: Config -> ControlUtil.Curve -> (ScoreTime.ScoreTime, ScoreTime.ScoreTime) -> ScoreT.Function -> Deriver Signal.Control Source #
Like get_trill_control
, but for a curved trill.
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.
xcut_control :: Bool -> Signal.Control -> Signal.Control -> [RealTime.RealTime] -> Signal.Control Source #