reactive-midyim- Process MIDI events via reactive-banana

Safe HaskellSafe




traverse :: (C msg, C msg) => msg -> State [Program] (Maybe msg) Source #

Before every note switch to another instrument according to a list of programs given as state of the State monad. I do not know how to handle multiple channels in a reasonable way. Currently I just switch the instrument independent from the channel, and send the program switch to the same channel as the beginning note.

traverseSeek :: (C msg, C msg) => Int -> msg -> State [Program] (Maybe msg) Source #

This function extends traverse. It reacts on external program changes by seeking an according program in the list. This way we can reset the pointer into the instrument list. However the search must be limited in order to prevent an infinite loop if we receive a program that is not contained in the list.

next :: C msg => Channel -> State [Program] (Maybe msg) Source #

maybeNoteOn :: C msg => msg -> Maybe Channel Source #

asBanks :: (C msg, C msg) => [Int] -> msg -> State [Int] msg Source #

Interpret program changes as a kind of bank switches in order to increase the range of instruments that can be selected via a block of patch select buttons.

asBanks ns divides the first sum ns instruments into sections of sizes ns!!0, ns!!1, .... Each program in those sections is interpreted as a bank in a hierarchy, where the lower program numbers are the least significant banks. Programs from sum ns on are passed through as they are. product ns is the number of instruments that you can address using this trick. In order to avoid overflow it should be less than 128.

E.g. asBanks [n,m] interprets subsequent program changes to a (0<=a<n) and n+b (0<=b<m) as a program change to b*n+a. asBanks [8,8] allows to select 64 instruments by 16 program change buttons, whereas asBanks [8,4,4] allows to address the full range of MIDI 128 instruments with the same number of buttons.