Safe Haskell | Safe-Inferred |
---|
Convert from the Derive events to MIDI performer specific events.
Since this module depends on both the Derive and Perform.Midi layers, it should be called from Derive or Cmd, not Perform.Midi, even though it's physically located in Perform.Midi.
Synopsis
- default_srate :: RealTime
- data MidiLookup = MidiLookup {}
- convert :: RealTime -> MidiLookup -> (ScoreT.Instrument -> Maybe Cmd.ResolvedInstrument) -> [Score.Event] -> [LEvent.LEvent Types.Event]
- convert_event :: RealTime -> MidiLookup -> Patch.Patch -> Patch.Config -> Score.Event -> [LEvent.LEvent Types.Event]
- make_controls :: [(Midi.Control, Midi.ControlValue)] -> Map ScoreT.Control MSignal.Signal
- run :: Log.LogId a -> [LEvent.LEvent a]
- type PitchSignal = MSignal.Signal
- convert_midi_pitch :: Log.LogMonad m => RealTime -> ScoreT.Instrument -> Patch.Patch -> Patch.Config -> ScoreT.ControlMap -> Score.Event -> m ((Types.Patch, [(Midi.Control, Midi.ControlValue)]), PitchSignal)
- mode_keyswitches :: DeriveT.Environ -> Patch.ModeMap -> Map ScoreT.Control Signal.Y
- convert_pitched_keymap :: Signal.Y -> Signal.Y -> Midi.Key -> PitchSignal -> PitchSignal
- convert_event_pitch :: Log.LogMonad m => RealTime -> Types.Patch -> ScoreT.ControlMap -> Score.Event -> m PitchSignal
- convert_pitch :: Log.LogMonad m => DeriveT.Environ -> ScoreT.ControlMap -> RealTime -> DeriveT.PSignal -> m Signal.NoteNumber
- apply_patch_scale :: Log.LogMonad m => Maybe Patch.Scale -> PitchSignal -> m PitchSignal
- round_pitch :: Signal.Y -> Signal.Y
- convert_scale :: Maybe Patch.Scale -> PitchSignal -> (PitchSignal, [(X, Signal.Y)])
- convert_controls :: RealTime -> Control.ControlMap -> ScoreT.ControlMap -> Map ScoreT.Control MSignal.Signal
- convert_dynamic :: Bool -> ScoreT.ControlMap -> ScoreT.ControlMap
Documentation
default_srate :: RealTime Source #
This is the sampling rate used to convert linear segments from
Signal.Signal
to MSignal.Signal
.
Since this is only used to interpolate linear segments, it probably doesn't need to be as high as one needed to express the nuances of more complicated curves. If the tracklang srate is higher, then the MIDI output will be denser and more accurate.
data MidiLookup Source #
convert :: RealTime -> MidiLookup -> (ScoreT.Instrument -> Maybe Cmd.ResolvedInstrument) -> [Score.Event] -> [LEvent.LEvent Types.Event] Source #
Convert Score events to Perform events, emitting warnings that may have happened along the way.
convert_event :: RealTime -> MidiLookup -> Patch.Patch -> Patch.Config -> Score.Event -> [LEvent.LEvent Types.Event] Source #
run :: Log.LogId a -> [LEvent.LEvent a] Source #
type PitchSignal = MSignal.Signal Source #
convert_midi_pitch :: Log.LogMonad m => RealTime -> ScoreT.Instrument -> Patch.Patch -> Patch.Config -> ScoreT.ControlMap -> Score.Event -> m ((Types.Patch, [(Midi.Control, Midi.ControlValue)]), PitchSignal) Source #
If the Event has an attribute matching its keymap, use the pitch from the keymap. Otherwise convert the pitch signal.
TODO this used to warn about unmatched attributes, but it got annoying because I use attributes freely. It still seems like it could be useful, so maybe I want to put it back in again someday.
convert_pitched_keymap :: Signal.Y -> Signal.Y -> Midi.Key -> PitchSignal -> PitchSignal Source #
convert_event_pitch :: Log.LogMonad m => RealTime -> Types.Patch -> ScoreT.ControlMap -> Score.Event -> m PitchSignal Source #
Get the flattened Signal.NoteNumber from an event.
convert_pitch :: Log.LogMonad m => DeriveT.Environ -> ScoreT.ControlMap -> RealTime -> DeriveT.PSignal -> m Signal.NoteNumber Source #
apply_patch_scale :: Log.LogMonad m => Maybe Patch.Scale -> PitchSignal -> m PitchSignal Source #
round_pitch :: Signal.Y -> Signal.Y Source #
Round pitches to the nearest tenth of a cent. Differences below this are probably imperceptible. Due to floating point inaccuracy, pitches can wind up being slightly off of integral, leading to pitch bending where there should be none.
convert_scale :: Maybe Patch.Scale -> PitchSignal -> (PitchSignal, [(X, Signal.Y)]) Source #
:: RealTime | |
-> Control.ControlMap | Instrument's control map. |
-> ScoreT.ControlMap | Controls to convert. |
-> Map ScoreT.Control MSignal.Signal |
Convert deriver controls to performance controls. Drop all non-MIDI controls, since those will inhibit channel sharing later.
convert_dynamic :: Bool -> ScoreT.ControlMap -> ScoreT.ControlMap Source #
If it's a Patch.Pressure
instrument, move the Controls.dynamic
control to Controls.breath
.