- data Handle = Handle {}
- 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 ()
- connectTimidity :: ReaderT Handle IO ()
- connectLLVM :: ReaderT Handle IO ()
- channel :: Int -> Channel
- pitch :: Int -> Pitch
- velocity :: Int -> Velocity
- controller :: Int -> Controller
- program :: Int -> Program
- type TimeAbs = Rational
- newtype Time = Time {}
- consTime :: String -> Rational -> Time
- incTime :: Time -> TimeAbs -> TimeAbs
- nano :: Num a => a
- makeEvent :: Handle -> TimeAbs -> Data -> T
- makeEcho :: Handle -> TimeAbs -> Custom -> T
- type Bundle a = [(Time, a)]
- type EventDataBundle = Bundle Data
- singletonBundle :: a -> Bundle a
- timeFromStamp :: TimeStamp -> Time
- defaultTempoCtrl :: (Channel, Controller)
- transpose :: Int -> Data -> Maybe Data
- setChannel :: Channel -> Data -> Data
- replaceProgram :: [Int32] -> Int32 -> [Int32] -> (Bool, [Int32])
- programFromBanks :: [Int32] -> [Int32] -> Int32
- programsAsBanks :: [Int32] -> Data -> State [Int32] Data
- nextProgram :: Note -> State [Program] EventDataBundle
- traversePrograms :: Data -> State [Program] EventDataBundle
- traverseProgramsSeek :: Int -> Data -> State [Program] EventDataBundle
- reduceNoteVelocity :: Word8 -> Note -> Note
- delayAdd :: Word8 -> Time -> Data -> EventDataBundle
- simpleNote :: Channel -> Pitch -> Velocity -> Note
- type KeySet = Map (Pitch, Channel) Velocity
- type KeyQueue = [((Pitch, Channel), Velocity)]
- eventsFromKey :: Time -> ((Pitch, Channel), Velocity) -> EventDataBundle
- selectFromLimittedChord :: Int -> Time -> KeyQueue -> EventDataBundle
- selectFromOctaveChord :: Int -> Time -> KeyQueue -> EventDataBundle
- selectFromChord :: Integer -> Time -> KeyQueue -> EventDataBundle
- selectFromChordRatio :: Double -> Time -> KeyQueue -> EventDataBundle
- increasePitch :: Int -> Pitch -> Maybe Pitch
- selectInversion :: Double -> Time -> KeyQueue -> EventDataBundle
- updateChord :: NoteEv -> Note -> KeySet -> KeySet
- controllerMatch :: Channel -> Controller -> Ctrl -> Bool
- updateDur :: Ctrl -> (Time, Time) -> Time
- type Selector i = i -> Time -> KeyQueue -> EventDataBundle
- type Pattern i = (Selector i, [i])
- data IndexNote i = IndexNote Int i
- item :: i -> Int -> IndexNote i
- type PatternMulti i = (Selector i, T Int [IndexNote i])
- fraction :: RealFrac a => a -> a
- data SweepState = SweepState {}
- flipSeq :: Int -> [Int]
- cycleDown :: Int -> Pattern Int
- pingPong :: Int -> Pattern Int
- crossSum :: Int -> Pattern Int
- cycleUp :: Int -> Pattern Int
- cycleDownAuto :: Pattern Integer
- pingPongAuto :: Pattern Integer
- crossSumAuto :: Pattern Integer
- cycleUpAuto :: Pattern Integer
- binaryLegato :: PatternMulti Int
- binaryAccident :: PatternMulti Int
- binaryStaccato :: PatternMulti Int
- decomposePositional :: Integer -> Integer -> [Integer]
- cycleUpOctave :: Int -> Pattern Int
- randomInversions :: Pattern Double
- random :: Pattern Double
- cycleUpInversions :: Int -> Pattern Double
- inversions :: [Double] -> Pattern Double
- examplePatternMultiTempo0 :: T Int [IndexNote Int]
- examplePatternMultiTempo1 :: T Int [IndexNote Int]
- checkChannel :: (Channel -> Bool) -> Data -> Bool
- checkPitch :: (Pitch -> Bool) -> Data -> Bool
- checkController :: (Controller -> Bool) -> Data -> Bool
- checkProgram :: (Program -> Bool) -> Data -> Bool
helper functions
helper
controller :: Int -> ControllerSource
time
The Time
types are used instead of floating point types,
because the latter ones caused unpredictable 'negative number' errors.
The denominator must always be a power of 10,
this way we can prevent unlimited grow of denominators.
events
type Bundle a = [(Time, a)]Source
The times are relative to the start time of the bundle and do not need to be ordered.
type EventDataBundle = Bundle DataSource
singletonBundle :: a -> Bundle aSource
timeFromStamp :: TimeStamp -> TimeSource
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.
setChannel :: Channel -> Data -> DataSource
replaceProgram :: [Int32] -> Int32 -> [Int32] -> (Bool, [Int32])Source
> replaceProgram [1,2,3,4] 5 [10,11,12,13] (True,[10,11,2,13])
programFromBanks :: [Int32] -> [Int32] -> Int32Source
programsAsBanks :: [Int32] -> Data -> State [Int32] 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.
nextProgram :: Note -> State [Program] EventDataBundleSource
traversePrograms :: Data -> State [Program] EventDataBundleSource
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] EventDataBundleSource
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 :: Word8 -> Note -> NoteSource
eventsFromKey :: Time -> ((Pitch, Channel), Velocity) -> EventDataBundleSource
selectFromLimittedChord :: Int -> Time -> KeyQueue -> EventDataBundleSource
selectFromOctaveChord :: Int -> Time -> KeyQueue -> EventDataBundleSource
Generate notes according to the key set, where notes for negative and too large indices are padded with keys that are transposed by octaves.
selectFromChord :: Integer -> Time -> KeyQueue -> EventDataBundleSource
selectFromChordRatio :: Double -> Time -> KeyQueue -> EventDataBundleSource
selectInversion :: Double -> Time -> KeyQueue -> EventDataBundleSource
controllerMatch :: Channel -> Controller -> Ctrl -> BoolSource
type Selector i = i -> Time -> KeyQueue -> EventDataBundleSource
data SweepState Source
SweepState | |
|
patterns
decomposePositional :: Integer -> Integer -> [Integer]Source
cycleUpOctave :: Int -> Pattern IntSource
inversions :: [Double] -> Pattern DoubleSource
predicates
checkController :: (Controller -> Bool) -> Data -> BoolSource