Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone



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.



convert :: Lookup -> (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_midi_pitch :: Log.LogMonad m => Instrument -> Patch.Patch -> Patch.Config -> ControlMap -> Score.Event -> m (Types.Patch, Signal.NoteNumber) 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_event_pitch :: Log.LogMonad m => Types.Patch -> Bool -> ControlMap -> Score.Event -> m Signal.NoteNumber Source #

Get the flattened Signal.NoteNumber from an event.

convert_controls Source #


:: Control.ControlMap

Instrument's control map.

-> ControlMap

Controls to convert.

-> Types.ControlMap 

Convert deriver controls to performance controls. Drop all non-MIDI controls, since those will inhibit channel sharing later.

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.