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*)
-- 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
-> 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