Simple keyboard functions for sending MIDI commands to the synthesizer
Summary
Functions
Change the current program (e.g., the current instrument)
Functions
@spec change_program( GenServer.server(), MIDISynth.Command.program(), MIDISynth.Command.channel() ) :: :ok
Change the current program (e.g., the current instrument)
The soundfont that's supplied to MIDISynth.start_link/2 determines the
mapping from program numbers to instruments. The default is to use a general
MIDI soundfont, and instrument mappings for those can be found by looking at
the General MIDI
1 and
General MIDI 2
specifications.
Example
# Play a violin iex> {:ok, synth} = MIDISynth.start_link([]) iex> MIDISynth.Keyboard.change_program(synth, 41) :ok iex> MIDISynth.Keyboard.play(synth, 60, 100) :ok
@spec play( GenServer.server(), MIDISynth.Command.note(), MIDISynth.Command.duration(), MIDISynth.Command.velocity(), MIDISynth.Command.channel() ) :: :ok
Play a note
This is a utility method for pressing a note down and then releasing it after a duration.
Example
iex> {:ok, synth} = MIDISynth.start_link([]) iex> MIDISynth.Keyboard.play(synth, 60, 100) :ok iex> MIDISynth.Keyboard.play(synth, 60, 100, 80) :ok