1 {-# LANGUAGE Arrows #-}
3 module RCMA.Translator.Note where
7 import RCMA.Global.Clock
8 import RCMA.Layer.Layer
10 import RCMA.Translator.Message
12 messageToNote :: Message -> Note
13 messageToNote (NoteOn _ p s) = Note { notePch = p
19 -- noteToMessage gives a pair of two time-stamped messages. The one on
20 -- the left is a note message, the other a note off.
22 -- For now this is only a tuple but a list will probably be necessary.
23 noteToMessages :: Tempo -> Layer -> Int -> (Time,Note)
24 -> ((Time,Message),(Time,Message))
25 noteToMessages tempo l@(Layer { relTempo = rt }) chan =
26 proc m@(t,n@Note { notePch = p
31 nm <- noteOnToMessage l chan -< n
32 t' <- returnA -< t + fromRational $ d * tempoToDTime $ rt * fromIntegral tempo
33 returnA -< ((t,nm),(t',switchOnOff nm))
35 noteOnToMessage :: Int -> Note -> Message
36 noteOnToMessage c (Note { notePch = p
38 }) = NoteOn (makeChannel c) p s
40 convertControl :: Message -> Controller
41 convertControl _ = Lol