Commit bb152b14 authored by Guerric Chupin's avatar Guerric Chupin

Corrections to the beat generation.

parent 3db9c177
......@@ -100,7 +100,7 @@ onChange' = proc x -> do
varFreqSine :: SF DTime Double
varFreqSine = sin ^<< (2*pi*) ^<< integral <<^ (1/)
-- | Generates an 'Event' at a regular frequency, which is given as an input to the signal function.
-- | Generates an 'Event' with a regular period, which is given as an input to the signal function.
repeatedlyS :: a -> SF DTime (Event a)
repeatedlyS x = edgeBy (\a b -> maybeIf (a * b < 0) $> x) 0
<<< varFreqSine <<^ (2*)
......
......@@ -29,7 +29,7 @@ maxAbsBeat = 16
-- its own fraction, discarding the unecessary beats.
metronome :: SF Tempo (Event AbsBeat)
metronome = accumBy (\pb _ -> nextBeatNo maxAbsBeat pb) 1 <<<
repeatedlyS () <<^ (/4) <<^ tempoToQNoteIvl
repeatedlyS () <<^ (15*) <<^ (1/) <<^ fromIntegral
-- Tempo is the number of quarter notes per minute.
tempoToQNoteIvl :: Tempo -> DTime
......
......@@ -30,7 +30,7 @@ noteToMessages :: SampleRate
-> LTempo
-> (Frames,Note)
-> [(Frames,Message)]
noteToMessages sr chan lt (t,n@Note { noteDur = d }) =
noteToMessages sr chan lt (t,n@Note { noteDur = d })
| d == 0 = []
| otherwise = [(t,nm),(t + dn,switchOnOff nm)]
where nm = noteOnToMessage chan n
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment