public class TarsosSynth extends java.lang.Object implements Configuration.ConfigChangeListener
Modifier and Type | Field and Description |
---|---|
static int |
TUNED_MIDI_CHANNEL
The channel used to tune a keyboard and send messages.
|
Constructor and Description |
---|
TarsosSynth()
Listen to configuration changes.
|
Modifier and Type | Method and Description |
---|---|
void |
addReceiver(javax.sound.midi.Receiver receiver)
Adds a receiver to the underlying list of receivers.
|
java.util.List<java.lang.String> |
availableInstruments() |
void |
close() |
void |
configurationChanged(ConfKey key)
Fires when a configuration setting changes.
|
static TarsosSynth |
getInstance() |
void |
noteOff(int midiKey,
int channel)
Send a note off message to the MIDI key.
|
void |
noteOn(int midiKey,
int velocity,
int channel)
Send a Note ON message to a MIDI key with a velocity.
|
void |
pitchBend(double deviationInCents)
Send a pitch bend message to the channel.
|
void |
playAbsoluteCents(double absoluteCent,
int velocity)
Send a MIDI pitch bend and a MIDI note ON OFF pair to render a certain
value in absolute cents.
|
void |
playRelativeCents(double relativeCents,
int velocity)
Play a pitch bended note defined by relative cents and a velocity.
|
void |
setDefaultReceiver() |
void |
tune(double[] tuning)
Tune the receiver with the MIDI Tuning Standard.
|
public static final int TUNED_MIDI_CHANNEL
public void setDefaultReceiver()
public void playRelativeCents(double relativeCents, int velocity)
relativeCents
- The relative cents pitch to play. This could be a number
between [0,1200] but it is actually possible to play any
velocity
- The MIDI key velocity. A value in [0,127].public void playAbsoluteCents(double absoluteCent, int velocity)
absoluteCent
- The value in absolute cents.velocity
- The velocity of the note on message.public void pitchBend(double deviationInCents)
deviationInCents
- The deviation in cents. Can be positive or negative but some
synthesizers only support positive pitch bend messages.public void noteOn(int midiKey, int velocity, int channel)
midiKey
- The MIDI key number.velocity
- The velocity of the note on message.channel
- The MIDI channel (0-16).public void noteOff(int midiKey, int channel)
midiKey
- The MIDI key to send the note off message to.channel
- The MIDI channel (0-16).public void tune(double[] tuning)
tuning
- public void addReceiver(javax.sound.midi.Receiver receiver)
receiver
- The receiver to add.public void configurationChanged(ConfKey key)
Configuration.ConfigChangeListener
configurationChanged
in interface Configuration.ConfigChangeListener
key
- The changed configuration setting.public java.util.List<java.lang.String> availableInstruments()
public void close()
public static TarsosSynth getInstance()