Safe Haskell | None |
---|
- data Handle = Handle {
- sequ :: T DuplexMode
- client :: T
- portPublic :: T
- portPrivate :: T
- queue :: T
- init :: IO Handle
- exit :: Handle -> IO ()
- with :: ReaderT Handle IO a -> IO a
- setTimeStamping :: ReaderT Handle IO ()
- startQueue :: ReaderT Handle IO ()
- connect :: [String] -> [String] -> ReaderT Handle IO ()
- connectFrom :: T -> ReaderT Handle IO T
- connectTo :: T -> ReaderT Handle IO T
- timidity :: String
- haskellSynth :: String
- inputs :: [String]
- outputs :: [String]
- connectTimidity :: ReaderT Handle IO ()
- connectLLVM :: ReaderT Handle IO ()
- connectAny :: ReaderT Handle IO ()
- parseAddresses :: [String] -> ReaderT Handle IO T
- sendNote :: Channel -> T -> Velocity -> Pitch -> ReaderT Handle IO ()
- sendKey :: Channel -> Bool -> Velocity -> Pitch -> ReaderT Handle IO ()
- sendController :: Channel -> Controller -> Int -> ReaderT Handle IO ()
- sendProgram :: Channel -> Program -> ReaderT Handle IO ()
- sendMode :: Channel -> T -> ReaderT Handle IO ()
- channel :: Int -> Channel
- pitch :: Int -> Pitch
- velocity :: Int -> Velocity
- controller :: Int -> Controller
- program :: Int -> Program
- normalVelocity :: Velocity
- defaultTempoCtrl :: (Channel, Controller)
- class Events ev where
- flattenEvents :: ev -> [Future Data]
- makeEvent :: Handle -> Abs -> Data -> T
- makeEcho :: Handle -> Abs -> T
- outputEvent :: Abs -> Data -> ReaderT Handle IO ()
- simpleNote :: Channel -> Pitch -> Velocity -> Note
- data Future a = Future {
- futureTime :: T
- futureData :: a
- type Bundle a = [Future a]
- type EventBundle = Bundle T
- type EventDataBundle = Bundle Data
- singletonBundle :: a -> Bundle a
- immediateBundle :: [a] -> Bundle a
- now :: a -> Future a
- transpose :: Int -> Data -> Maybe Data
- reverse :: Data -> Maybe Data
- setChannel :: Channel -> Data -> Data
- replaceProgram :: Real i => [i] -> i -> [i] -> (Bool, [i])
- programFromBanks :: Real i => [i] -> [i] -> i
- programsAsBanks :: [Int] -> Data -> State [Int] Data
- nextProgram :: Note -> State [Program] (Maybe Data)
- seekProgram :: Int -> Program -> State [Program] (Maybe Data)
- traversePrograms :: Data -> State [Program] (Maybe Data)
- traverseProgramsSeek :: Int -> Data -> State [Program] (Maybe Data)
- reduceNoteVelocity :: Velocity -> Note -> Note
- delayAdd :: Velocity -> T -> Data -> EventDataBundle
- controllerFromNote :: (Int -> Int) -> Controller -> Data -> Maybe Data
- type KeySet = Map (Pitch, Channel) Velocity
- type KeyQueue = [((Pitch, Channel), Velocity)]
- eventsFromKey :: T -> T -> ((Pitch, Channel), Velocity) -> EventDataBundle
- maybePitch :: Int -> Maybe Pitch
- increasePitch :: Int -> Pitch -> Maybe Pitch
- subtractPitch :: Pitch -> Pitch -> Int
- splitFraction :: RealFrac a => a -> (Int, a)
- fraction :: RealFrac a => a -> a
- ctrlDur :: (T, T) -> Int -> T
- ctrlDurLinear :: (T, T) -> Int -> T
- ctrlDurExponential :: (T, T) -> Int -> T
- controllerMatch :: Channel -> Controller -> Ctrl -> Bool
- checkChannel :: (Channel -> Bool) -> Data -> Bool
- checkPitch :: (Pitch -> Bool) -> Data -> Bool
- checkController :: (Controller -> Bool) -> Data -> Bool
- checkMode :: (T -> Bool) -> Data -> Bool
- checkProgram :: (Program -> Bool) -> Data -> Bool
- isAllNotesOff :: Data -> Bool
- data NoteBoundary = NoteBoundary (Pitch, Channel) Velocity Bool
- data NoteBoundaryExt
- maybeNote :: Data -> Maybe NoteBoundary
- maybeNoteExt :: Data -> Maybe NoteBoundaryExt
- noteFromBnd :: NoteBoundary -> Data
- mergeStable :: C time => T time body -> T time body -> T time body
- mergeEither :: C time => T time a -> T time b -> T time (Either a b)
helper functions
Handle | |
|
setTimeStamping :: ReaderT Handle IO ()Source
make ALSA set the time stamps in incoming events
startQueue :: ReaderT Handle IO ()Source
connect :: [String] -> [String] -> ReaderT Handle IO ()Source
Connect ourselve to an input client and an output client. The function expects a list of alternative clients that are checked successively.
connectTimidity :: ReaderT Handle IO ()Source
connectLLVM :: ReaderT Handle IO ()Source
connectAny :: ReaderT Handle IO ()Source
send single events
sendController :: Channel -> Controller -> Int -> ReaderT Handle IO ()Source
constructors
controller :: Int -> ControllerSource
events
This class unifies several ways of handling multiple events at once.
flattenEvents :: ev -> [Future Data]Source
The times are relative to the start time of the bundle and do not need to be ordered.
Future | |
|
type EventBundle = Bundle TSource
type EventDataBundle = Bundle DataSource
singletonBundle :: a -> Bundle aSource
immediateBundle :: [a] -> Bundle aSource
effects
transpose :: Int -> Data -> Maybe DataSource
Transpose a note event by the given number of semitones. Non-note events are returned without modification. If by transposition a note leaves the range of representable MIDI notes, then we return Nothing.
reverse :: Data -> Maybe DataSource
Swap order of keys. Non-note events are returned without modification. If by reversing a note leaves the range of representable MIDI notes, then we return Nothing.
setChannel :: Channel -> Data -> DataSource
replaceProgram :: Real i => [i] -> i -> [i] -> (Bool, [i])Source
> replaceProgram [1,2,3,4] 5 [10,11,12,13] (True,[10,11,2,13])
programFromBanks :: Real i => [i] -> [i] -> iSource
programsAsBanks :: [Int] -> Data -> State [Int] DataSource
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.
programAsBanks 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. programAsBanks [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
.
programAsBanks [8,8]
allows to select 64 instruments
by 16 program change buttons,
whereas programAsBanks [8,4,4]
allows to address the full range of MIDI 128 instruments
with the same number of buttons.
traversePrograms :: Data -> State [Program] (Maybe Data)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.
traverseProgramsSeek :: Int -> Data -> State [Program] (Maybe Data)Source
This function extends traversePrograms
.
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.
reduceNoteVelocity :: Velocity -> Note -> NoteSource
controllerFromNote :: (Int -> Int) -> Controller -> Data -> Maybe DataSource
Map NoteOn events to a controller value. This way you may play notes via the resonance frequency of a filter.
eventsFromKey :: T -> T -> ((Pitch, Channel), Velocity) -> EventDataBundleSource
maybePitch :: Int -> Maybe PitchSource
subtractPitch :: Pitch -> Pitch -> IntSource
splitFraction :: RealFrac a => a -> (Int, a)Source
properFraction is useless for negative numbers
predicates - may be moved to midi-alsa package
controllerMatch :: Channel -> Controller -> Ctrl -> BoolSource
checkController :: (Controller -> Bool) -> Data -> BoolSource
isAllNotesOff :: Data -> BoolSource
data NoteBoundary Source
data NoteBoundaryExt Source
maybeNote :: Data -> Maybe NoteBoundarySource