hmt-0.20: Haskell Music Theory
Safe HaskellSafe-Inferred
LanguageHaskell2010

Music.Theory.Duration.ClickTrack

Contents

Description

Functions to generate a click track from a metric structure.

Synopsis

Documentation

type Measure = Int Source #

1-indexed.

type Pulse = Int Source #

1-indexed.

type Mdv = [[Rq]] Source #

Measures given as Rq divisions, Mdv abbreviates measure divisions.

type Mrq = [[Rq]] Source #

Absolute Rq locations grouped in measures. mrq abbreviates measure rational quarter-notes. Locations are zero-indexed.

mdv_to_mrq :: Mdv -> Mrq Source #

Transform Mdv to Mrq.

mdv_to_mrq [[1,2,1],[3,2,1]] == [[0,1,3],[4,7,9]]

mp_lookup_err :: [[t]] -> (Measure, Pulse) -> t Source #

Lookup function for (Measure,Pulse) indexed structure. mp abbreviates Measure Pulse.

mp_compare :: (Measure, Pulse) -> (Measure, Pulse) -> Ordering Source #

Comparison for (Measure,Pulse) indices.

Ct

ct_ext :: Int -> t -> Tseq Measure t -> Tseq Measure t Source #

Latch measures (ie. make measures contiguous, hold previous value). Arguments are the number of measures and the default (intial) value.

unzip (ct_ext 10 'a' [(3,'b'),(8,'c')]) == ([1..10],"aabbbbbccc")

ct_ext1 :: Int -> Tseq Measure t -> Tseq Measure t Source #

Variant that requires a value at measure one (first measure).

ct_mdv_seq :: Int -> Tseq Measure Rational_Time_Signature -> [[Rq]] Source #

ct_dv_seq without measures numbers (which are 1..n)

ct_m_to_rq :: [[Rq]] -> [(Measure, t)] -> [(Rq, t)] Source #

ct_mark_seq :: Int -> Tseq Measure Char -> Tseq Measure (Maybe Char) Source #

Latch rehearsal mark sequence, only indicating marks. Initial mark is ..

ct_mark_seq 2 [] == [(1,Just '.'),(2,Nothing)]
let r = [(1,Just '.'),(3,Just 'A'),(8,Just 'B')]
in filter (isJust . snd) (ct_mark_seq 10 [(3,'A'),(8,'B')]) == r

ct_pre_mark :: [(Measure, a)] -> [(Measure, Maybe ())] Source #

Indicate measures prior to marks.

ct_pre_mark [] == []
ct_pre_mark [(1,'A')] == []
ct_pre_mark [(3,'A'),(8,'B')] == [(2,Just ()),(7,Just ())]

ct_pre_mark_seq :: Measure -> Tseq Measure Char -> Tseq Measure (Maybe ()) Source #

Contiguous pre-mark sequence.

ct_pre_mark_seq 1 [(1,'A')] == [(1,Nothing)]
ct_pre_mark_seq 10 [(3,'A'),(8,'B')]

ct_tempo_at :: Lseq Rq Rq -> Rq -> Rational Source #

Interpolating lookup of tempo sequence (lseq_lookup_err).

data Ct_Node Source #

Types of nodes.

Constructors

Ct_Mark Rq

The start of a measure with a rehearsal mark.

Ct_Start Rq

The start of a regular measure.

Ct_Normal Rq

A regular pulse.

Ct_Edge Rq

The start of a pulse group within a measure.

Ct_Pre Rq

A regular pulse in a measure prior to a rehearsal mark.

Ct_End

The end of the track.

Instances

Instances details
Show Ct_Node Source # 
Instance details

Defined in Music.Theory.Duration.ClickTrack

Eq Ct_Node Source # 
Instance details

Defined in Music.Theory.Duration.ClickTrack

Methods

(==) :: Ct_Node -> Ct_Node -> Bool #

(/=) :: Ct_Node -> Ct_Node -> Bool #

ct_leadin :: (Rq, Double, Int) -> Dseq Double Ct_Node Source #

Lead-in of (pulse,tempo,count).

delay1 :: [a] -> [a] Source #

Prepend initial element to start of list.

delay1 "abc" == "aabc"

ct_measure :: Lseq Rq Rq -> ([Rq], Maybe Char, Maybe (), [[Rq]]) -> [(Rational, Ct_Node)] Source #

Generate Ct measure. Calculates durations of events considering only the tempo at the start of the event. To be correct it should consider the tempo envelope through the event.

data Ct Source #

Click track definition.

Constructors

Ct 

Instances

Instances details
Show Ct Source # 
Instance details

Defined in Music.Theory.Duration.ClickTrack

Methods

showsPrec :: Int -> Ct -> ShowS #

show :: Ct -> String #

showList :: [Ct] -> ShowS #

ct_tempo0 :: Ct -> Maybe Rq Source #

Initial tempo, if given.

ct_tempo0_err :: Ct -> Rq Source #

Erroring variant.

Indirect

ct_mp_to_rq :: [[Rq]] -> [((Measure, Pulse), t)] -> [(Rq, t)] Source #