midi-0.2.2.3: Handling of MIDI messages and files
Safe HaskellSafe-Inferred
LanguageHaskell2010

Sound.MIDI.Message.Channel.Voice

Description

Channel voice messages

Synopsis

Documentation

data T Source #

Instances

Instances details
Eq T Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Methods

(==) :: T -> T -> Bool #

(/=) :: T -> T -> Bool #

Ord T Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Methods

compare :: T -> T -> Ordering #

(<) :: T -> T -> Bool #

(<=) :: T -> T -> Bool #

(>) :: T -> T -> Bool #

(>=) :: T -> T -> Bool #

max :: T -> T -> T #

min :: T -> T -> T #

Show T Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Methods

showsPrec :: Int -> T -> ShowS #

show :: T -> String #

showList :: [T] -> ShowS #

Arbitrary T Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Methods

arbitrary :: Gen T #

shrink :: T -> [T] #

get :: C parser => Int -> Int -> Fragile parser T Source #

putWithStatus :: C writer => (Int -> T compress writer) -> T -> T compress writer Source #

isNoteOn :: T -> Bool Source #

NoteOn with zero velocity is considered NoteOff according to MIDI specification.

isNoteOff :: T -> Bool Source #

NoteOn with zero velocity is considered NoteOff according to MIDI specification.

zeroKey :: Pitch Source #

A MIDI problem is that one cannot uniquely map a MIDI key to a frequency. The frequency depends on the instrument. I don't know if the deviations are defined for General MIDI. If this applies one could add transposition information to the use patch map. For now I have chosen a value that leads to the right frequency for some piano sound in my setup.

explicitNoteOff :: T -> T Source #

Convert all NoteOn p 0 to NoteOff p 64. The latter one is easier to process.

implicitNoteOff :: T -> T Source #

Convert all NoteOff p 64 to NoteOn p 0. The latter one can be encoded more efficiently using the running status.

realFromControllerValue :: (Integral a, Fractional b) => a -> b Source #

Map integral MIDI controller value to floating point value. Maximum integral MIDI controller value 127 is mapped to 1. Minimum integral MIDI controller value 0 is mapped to 0.

data Pitch Source #

Instances

Instances details
Bounded Pitch Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Enum Pitch Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Eq Pitch Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Methods

(==) :: Pitch -> Pitch -> Bool #

(/=) :: Pitch -> Pitch -> Bool #

Ord Pitch Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Methods

compare :: Pitch -> Pitch -> Ordering #

(<) :: Pitch -> Pitch -> Bool #

(<=) :: Pitch -> Pitch -> Bool #

(>) :: Pitch -> Pitch -> Bool #

(>=) :: Pitch -> Pitch -> Bool #

max :: Pitch -> Pitch -> Pitch #

min :: Pitch -> Pitch -> Pitch #

Show Pitch Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Methods

showsPrec :: Int -> Pitch -> ShowS #

show :: Pitch -> String #

showList :: [Pitch] -> ShowS #

Ix Pitch Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Arbitrary Pitch Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Methods

arbitrary :: Gen Pitch #

shrink :: Pitch -> [Pitch] #

Random Pitch Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Methods

randomR :: RandomGen g => (Pitch, Pitch) -> g -> (Pitch, g) #

random :: RandomGen g => g -> (Pitch, g) #

randomRs :: RandomGen g => (Pitch, Pitch) -> g -> [Pitch] #

randoms :: RandomGen g => g -> [Pitch] #

data Velocity Source #

Instances

Instances details
Bounded Velocity Source #

ToDo: We have defined minBound = Velocity 0, but strictly spoken the minimum Velocity is 1, since Velocity zero means NoteOff. One can at least think of NoteOff with (Velocity 0), but I have never seen that.

Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Eq Velocity Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Ord Velocity Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Show Velocity Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Arbitrary Velocity Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Random Velocity Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Methods

randomR :: RandomGen g => (Velocity, Velocity) -> g -> (Velocity, g) #

random :: RandomGen g => g -> (Velocity, g) #

randomRs :: RandomGen g => (Velocity, Velocity) -> g -> [Velocity] #

randoms :: RandomGen g => g -> [Velocity] #

data Program Source #

Instances

Instances details
Bounded Program Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Enum Program Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Eq Program Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Methods

(==) :: Program -> Program -> Bool #

(/=) :: Program -> Program -> Bool #

Ord Program Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Show Program Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Ix Program Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Arbitrary Program Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Random Program Source # 
Instance details

Defined in Sound.MIDI.Message.Channel.Voice

Methods

randomR :: RandomGen g => (Program, Program) -> g -> (Program, g) #

random :: RandomGen g => g -> (Program, g) #

randomRs :: RandomGen g => (Program, Program) -> g -> [Program] #

randoms :: RandomGen g => g -> [Program] #

data Controller Source #

We do not define Controller as enumeration with many constructors, because some controllers have multiple names and some are undefined. It is also more efficient this way. Thus you cannot use case for processing controller types, but you can use lookup instead.

maybe (putStrLn "unsupported controller") putStrLn $
lookup ctrl $
   (portamento, "portamento") :
   (modulation, "modulation") :
   []

Instances

Instances details
Bounded Controller Source # 
Instance details

Defined in Sound.MIDI.ControllerPrivate

Enum Controller Source # 
Instance details

Defined in Sound.MIDI.ControllerPrivate

Eq Controller Source # 
Instance details

Defined in Sound.MIDI.ControllerPrivate

Ord Controller Source # 
Instance details

Defined in Sound.MIDI.ControllerPrivate

Show Controller Source # 
Instance details

Defined in Sound.MIDI.ControllerPrivate

Ix Controller Source # 
Instance details

Defined in Sound.MIDI.ControllerPrivate

Arbitrary Controller Source # 
Instance details

Defined in Sound.MIDI.ControllerPrivate

Random Controller Source # 
Instance details

Defined in Sound.MIDI.ControllerPrivate

Methods

randomR :: RandomGen g => (Controller, Controller) -> g -> (Controller, g) #

random :: RandomGen g => g -> (Controller, g) #

randomRs :: RandomGen g => (Controller, Controller) -> g -> [Controller] #

randoms :: RandomGen g => g -> [Controller] #

frequencyFromPitch :: Floating a => Pitch -> a Source #

Convert pitch to frequency according to the default tuning given in MIDI 1.0 Detailed Specification.

maximumVelocity :: Velocity Source #

The velocity of an ordinary key stroke and the maximum possible velocity.

normalVelocity :: Velocity Source #

The velocity of an ordinary key stroke and the maximum possible velocity.

realFromVelocity :: Fractional b => Velocity -> b Source #

MIDI specification says, if velocity is simply mapped to amplitude, then this should be done by an exponential function. Thus we map normalVelocity (64) to 0, maximumVelocity (127) to 1, and minimumVelocity (1) to -1. That is, normally you should write something like amplitude = 2 ** realFromVelocity vel or 3 ** realFromVelocity vel.