public abstract class MetroMidi
extends java.lang.Object
Since the parameters of a notifyMidiEvent method differ by the target MIDI messages of the method, we cannot define an abstract common method for the notifyMidiEvent method. Therefore, we merely defines a convention that the constant objects defined here must contain a method which name is "notifyMidiEvent".
Channel Voice Messages [nnnn = 0-15 (MIDI Channel Number 1-16)] |
||
1000nnnn | 0kkkkkkk 0vvvvvvv |
Note Off event. This message is sent when a note is released (ended). (kkkkkkk) is the key (note) number. (vvvvvvv) is the velocity. |
1001nnnn | 0kkkkkkk 0vvvvvvv |
Note On event. This message is sent when a note is depressed (start). (kkkkkkk) is the key (note) number. (vvvvvvv) is the velocity. |
1010nnnn | 0kkkkkkk 0vvvvvvv |
Polyphonic Key Pressure (Aftertouch). This message is most often sent by pressing down on the key after it "bottoms out". (kkkkkkk) is the key (note) number. (vvvvvvv) is the pressure value. |
1011nnnn | 0ccccccc 0vvvvvvv |
Control Change. This message is sent when a controller value changes. Controllers include devices such as pedals and levers. Controller numbers 120-127 are reserved as "Channel Mode Messages" (below). (ccccccc) is the controller number (0-119). (vvvvvvv) is the controller value (0-127). |
1100nnnn | 0ppppppp | Program Change. This message sent when the patch number changes. (ppppppp) is the new program number. |
1101nnnn | 0vvvvvvv | Channel Pressure (After-touch). This message is most often sent by pressing down on the key after it "bottoms out". This message is different from polyphonic after-touch. Use this message to send the single greatest pressure value (of all the current depressed keys). (vvvvvvv) is the pressure value. |
1110nnnn | 0lllllll 0mmmmmmm |
Pitch Bend Change. This message is sent to indicate a change in the pitch bender (wheel or lever, typically). The pitch bender is measured by a fourteen bit value. Center (no pitch change) is 2000H. Sensitivity is a function of the receiver, but may be set using RPN 0. (lllllll) are the least significant 7 bits. (mmmmmmm) are the most significant 7 bits. |
When I wrote this class, I was looking for the official specification of MIDI control change messages but I could not find it. It seems that MIDI control change messages are privately defined by each developer of those commercial products and there is no officially declared specification.
This is the reason why I referred http://nickfever.com/music/midi-cc-list. This is a very good explanation about MIDI control change messages. Special thanks go to nickfever. The designing of this class is based on the document.
The following table is an excerpt from the site.
0 | "Bank Select" | "Allows user to switch bank for patch selection. Program change used with Bank Select. MIDI can access 16,384 patches per MIDI channel." |
1 | "Modulation" | "Generally this CC controls a vibrato effect (pitch, loudness, brightness ). What is modulated is based on the patch." |
2 | "Breath Controller" | "Often times associated with aftertouch messages. It was originally intended for use with a breath MIDI controller in which blowing harder produced higher MIDI control values. It can be used for modulation as well." |
4 | "Foot Controller" | "Often used with aftertouch messages. It can send a continuous stream of values based on how the pedal is used." |
5 | "PortamentoTime" | "Controls portamento rate to slide between 2 notes played subsequently." |
6 | "Data InitializerEntry Most Significant Bit(MSB)" | "Controls Value for NRPN or RPN parameters." |
7 | "Volume" | "Control the volume of the channel" |
8 | "Balance" | "Controls the left and right balance, generally for stereo patches.0 = hard left, 64 = center, 127 = hard right" |
10 | "Pan" | "Controls the left and right balance, generally for mono patches.0 = hard left, 64 = center, 127 = hard right" |
11 | "Expression" | "Expression is a percentage of volume (CC7)." |
12 | "Effect Controller 1" | "Usually used to control a parameter of an effect within the synth/workstation." |
13 | "Effect Controller 2" | "Usually used to control a parameter of an effect within the synth/workstation." |
64 | "Damper Pedal /Sustain Pedal" | "On/Off switch that controls sustain. (See also Sostenuto CC 66)0 to 63 = Off, 64 to 127 = On" |
65 | "Portamento On/Off Switch" | "On/Off switch0 to 63 = Off, 64 to 127 = On" |
66 | "Sostenuto On/Off Switch" | "On/Off switch – Like the Sustain controller (CC 64), However it only holds notes that were “On” when the pedal was pressed. People use it to “hold” chords” and play melodies over the held chord.0 to 63 = Off, 64 to 127 = On" |
67 | "Soft Pedal On/Off Switch" | "On/Off switch- Lowers the volume of notes played.0 to 63 = Off, 64 to 127 = On" |
68 | "Legato FootSwitch" | "On/Off switch- Turns Legato effect between 2 subsequent notes On or Off.0 to 63 = Off, 64 to 127 = On" |
69 | "Hold 2" | "Another way to “hold notes” (see MIDI CC 64 and MIDI CC 66). However notes fade out according to their release parameter rather than when the pedal is released." |
70 | "Sound Controller 1" | "Usually controls the way a sound is produced. Default = Sound Variation." |
71 | "Sound Controller 2" | "Allows shaping the Voltage Controlled Filter (VCF). Default = Resonance -also(Timbre or Harmonics)" |
72 | "Sound Controller 3" | "Controls release time of the Voltage controlled Amplifier (VCA). Default = Release Time." |
73 | "Sound Controller 4" | "Controls the “Attack’ of a sound. The attack is the amount of time it takes forthe sound to reach maximum amplitude." |
74 | "Sound Controller 5" | "Controls VCFs cutoff frequency of the filter." |
75 | "Sound Controller 6" | "Generic – Some manufacturers may use to further shave their sounds." |
76 | "Sound Controller 7" | "Generic – Some manufacturers may use to further shave their sounds." |
77 | "Sound Controller 8" | "Generic – Some manufacturers may use to further shave their sounds." |
78 | "Sound Controller 9" | "Generic – Some manufacturers may use to further shave their sounds." |
79 | "Sound Controller 10" | "Generic – Some manufacturers may use to further shave their sounds." |
80 | "General PurposeMIDI CC Controller" | "GenericOn/Off switch0 to 63 = Off, 64 to 127 = On" |
81 | "General Purpose MIDI CC Controller" | "GenericOn/Off switch0 to 63 = Off, 64 to 127 = On" |
82 | "General PurposeMIDI CC Controller" | "GenericOn/Off switch0 to 63 = Off, 64 to 127 = On" |
83 | "General Purpose MIDI CC Controller" | "GenericOn/Off switch0 to 63 = Off, 64 to 127 = On" |
84 | "Portamento CC Control" | "Controls the amount of Portamento." |
91 | "Effect 1 Depth" | "Usually controls reverb send amount" |
92 | "Effect 2 Depth" | "Usually controls tremolo amount" |
93 | "Effect 3 Depth" | "Usually controls chorus amount" |
94 | "Effect 4 Depth" | "Usually controls detune amount" |
95 | "Effect 5 Depth" | "Usually controls phaser amount" |
96 | "(+1) Data Increment" | "Usually used to increment data for RPN and NRPN messages." |
97 | "(-1) Data Decrement" | "Usually used to decrement data for RPN and NRPN messages." |
98 | "Non-Registered Parameter Number LSB (NRPN)" | "For controllers 6, 38, 96, and 97, it selects the NRPN parameter." |
99 | "Non-Registered Parameter Number MSB (NRPN)" | "For controllers 6, 38, 96, and 97, it selects the NRPN parameter." |
100 | "Registered Parameter Number LSB (RPN)" | "For controllers 6, 38, 96, and 97, it selects the RPN parameter." |
101 | "Registered Parameter Number MSB (RPN)" | "For controllers 6, 38, 96, and 97, it selects the RPN parameter." |
3 | Undefined | |
9 | Undefined | |
14 | Undefined | |
15 | Undefined | |
16 – 19 | General Purpose | |
20 – 31 | Undefined | |
32 – 63 | Controller 0-31 Least Significant Bit (LSB) | |
85 – 90 | Undefined | |
102 – 119 | Undefined | |
120 to 127 are “Channel Mode Messages.” | ||
120 | All Sound Off | Mutes all sounding notes. It does so regardless of release time or sustain. (See MIDI CC 123) |
121 | Reset All Controllers | It will reset all controllers to their default. |
122 | Local On/Off Switch | Turns internal connection of a MIDI keyboard/workstation, etc. On or Off. If you use a computer, you will most likely want local control off to avoid notes being played twice. Once locally and twice whent the note is sent back from the computer to your keyboard. |
123 | All Notes Off | Mutes all sounding notes. Release time will still be maintained, and notes held by sustain will not turn off until sustain pedal is depressed. |
124 | Omni Mode Off | Sets to “Omni Off” mode. |
125 | Omni Mode On | Sets to “Omni On” mode. |
126 | Mono Mode | Sets device mode to Monophonic. |
127 | Poly Mode | Sets device mode to Polyphonic. |
Constructor and Description |
---|
MetroMidi() |
Modifier and Type | Method and Description |
---|---|
int |
getControlChange8bit() |
static MetroMidi |
getInfo(java.lang.String id) |
java.lang.String |
getLongDescription() |
java.lang.String |
getLongName() |
java.lang.String |
getShortDescription() |
java.lang.String |
getShortName() |
int |
getStatusHigher4bit() |
int |
getStatusLower4bit() |
abstract void |
receiveBufferedMidi(MetroBufferedMidiReceiver receiver,
MetroMidiEvent event) |
static void |
receiveBufferedMidiMessage(MetroBufferedMidiReceiver receiver,
MetroMidiEvent event) |
abstract <T> T |
receiveMidi(MetroMidiReceiver<T> receiver,
byte[] message) |
static <T> void |
receiveMidiMessage(MetroBufferedMidiReceiver receiver,
java.util.List<MetroMidiEvent> in) |
static <T> void |
receiveMidiMessage(MetroMidiReceiver<T> receiver,
java.util.List<MetroMidiEvent> in) |
static <T> T |
receiveMidiMessage(MetroMidiReceiver<T> receiver,
MetroMidiEvent event) |
protected java.lang.String shortName
protected java.lang.String longName
protected java.lang.String shortDescription
protected java.lang.String longDescription
protected int statusHigher4bit
protected int statusLower4bit
protected int controlChange8bit
public static final int STATUS_HIGHER_4BIT_CONTROL_CHANGE
public static final int STATUS_HIGHER_4BIT_CHANNEL_MODE
public static final int STATUS_HIGHER_4BIT_SYSTEM_COMMON_MESSAGE
public static final int STATUS_HIGHER_4BIT_SYSTEM_REALTIME_MESSAGE
public static final int MASK_4BIT
public static final int MASK_7BIT
public static final MetroMidi.MetroMidiError MIDI_ERROR
public static final MetroMidi.MetroMidiNoteOn MIDI_NOTE_ON
public static final MetroMidi.MetroMidiNoteOff MIDI_NOTE_OFF
public static final MetroMidi.MetroMidiKeyPressure MIDI_KEY_PRESSURE
public static final MetroMidi.MetroMidiControlChange MIDI_CONTROL_CHANGE
public static final MetroMidi.MetroMidiProgramChange MIDI_PROGRAM_CHANGE
public static final MetroMidi.MetroMidiChannelPressure MIDI_CHANNEL_PRESSURE
public static final MetroMidi.MetroMidiPitchBend MIDI_PITCH_BEND
public static final MetroMidi.MetroSystemCommon MIDI_SYSTEM_COMMON
public static final int CC_ALL_SOUND_OFF
public static final int CC_RESET_ALL_CONTROLLERS
public static final int CC_LOCAL_CONTROLS
public static final int CC_ALL_NOTE_OFF
public static final int CC_OMNI_MODE_OFF
public static final int CC_OMNI_MODE_ON
public static final int CC_MONO_MODE_ON
public static final int CC_POLY_MODE_ON
public static final MetroMidi.MetroMidiAllSoundOff MIDI_ALL_SOUND_OFF
public static final MetroMidi.MetroMidiResetAllControllers MIDI_RESET_ALL_CONTROLLERS
public static final MetroMidi.MetroMidiLocalControls MIDI_LOCAL_CONTROLS
public static final MetroMidi.MetroMidiAllNoteOff MIDI_ALL_NOTE_OFF
public static final MetroMidi.MetroMidiOmniModeOff MIDI_OMNI_MODE_OFF
public static final MetroMidi.MetroMidiOmniModeOn MIDI_OMNI_MODE_ON
public static final MetroMidi.MetroMidiMonoModeOn MIDI_MONO_MODE_ON
public static final MetroMidi.MetroMidiPolyModeOn MIDI_POLY_MODE_ON
public static final MetroMidi.MetroSystemExclusive MIDI_SYSTEM_EXCLUSIVE
public static final MetroMidi.MetroTimeCodeQuarterFrame MIDI_TIME_CODE_QUARTER_FRAME
public static final MetroMidi.MetroMidiSongPositionPointer MIDI_SONG_POSITION_POINTER
public static final MetroMidi.MetroMidiSongSelect MIDI_SONG_SELECT
public static final MetroMidi.MetroTuneRequest MIDI_TUNE_REQUEST
public static final MetroMidi.MetroMidiEndOfExclusive MIDI_END_OF_EXCLUSIVE
public static final MetroMidi.MetroMidiClock MIDI_CLOCK
public static final MetroMidi.MetroMidiStart MIDI_START
public static final MetroMidi.MetroMidiContinue MIDI_CONTINUE
public static final MetroMidi.MetroMidiStop MIDI_STOP
public static final MetroMidi.MetroActiveSensing MIDI_ACTIVE_SENSING
public static final MetroMidi.MetroMidiReset MIDI_RESET
public static final int CC_BANK_SELECT
public static final MetroMidi.MetroMidiControlBankSelect MIDI_BANK_SELECT
public static final int CC_MODULATION
public static final MetroMidi.MetroMidiControlModulation MIDI_MODULATION
public static final int CC_BREATH_CTRL
public static final MetroMidi.MetroMidiControlBreathController MIDI_BREATH_CTRL
public static final int CC_FOOT_CTRL
public static final MetroMidi.MetroMidiControlFootController MIDI_FOOT_CTRL
public static final int CC_PORTAMENTO_TIME
public static final MetroMidi.MetroMidiControlPortamentoTime MIDI_PORTAMENTO_TIME
public static final int CC_DATA_ENTRY_MSB
public static final MetroMidi.MetroMidiControlDataEntryMsb MIDI_DATA_ENTRY_MSB
public static final int CC_VOLUME
public static final MetroMidi.MetroMidiControlVolume MIDI_VOLUME
public static final int CC_BALANCE
public static final MetroMidi.MetroMidiControlBalance MIDI_BALANCE
public static final int CC_PAN
public static final MetroMidi.MetroMidiControlPan MIDI_PAN
public static final int CC_EXPRESSION
public static final MetroMidi.MetroMidiControlExpression MIDI_EXPRESSION
public static final int CC_EFFECT_CTRL_1
public static final MetroMidi.MetroMidiControlEffectController1 MIDI_EFFECT_CTRL_1
public static final int CC_EFFECT_CTRL_2
public static final MetroMidi.MetroMidiControlEffectController2 MIDI_EFFECT_CTRL_2
public static final int CC_SUSTAIN_PEDAL
public static final MetroMidi.MetroMidiControlSustainPedal MIDI_SUSTAIN_PEDAL
public static final int CC_PORTAMENTO_SWITCH
public static final MetroMidi.MetroMidiControlPortamentoSwitch MIDI_PORTAMENTO_SWITCH
public static final int CC_SOSTENUTO_SWITCH
public static final MetroMidi.MetroMidiControlSostenutoSwitch MIDI_SOSTENUTO_SWITCH
public static final int CC_SOFT_PEDAL_SWITCH
public static final MetroMidi.MetroMidiControlPedalSwitch MIDI_SOFT_PEDAL_SWITCH
public static final int CC_LEGATO_FOOTSWITCH
public static final MetroMidi.MetroMidiControlLegatoSwitch MIDI_LEGATO_FOOTSWITCH
public static final int CC_HOLD_2
public static final MetroMidi.MetroMidiControlHold2 MIDI_HOLD_2
public static final int CC_SOUND_CTRL_01
public static final MetroMidi.MetroMidiControlSoundController1 MIDI_SOUND_CTRL_01
public static final int CC_SOUND_CTRL_02
public static final MetroMidi.MetroMidiControlSoundController2 MIDI_SOUND_CTRL_02
public static final int CC_SOUND_CTRL_03
public static final MetroMidi.MetroMidiControlSoundController3 MIDI_SOUND_CTRL_03
public static final int CC_SOUND_CTRL_04
public static final MetroMidi.MetroMidiControlSoundController4 MIDI_SOUND_CTRL_04
public static final int CC_SOUND_CTRL_05
public static final MetroMidi.MetroMidiControlSoundController5 MIDI_SOUND_CTRL_05
public static final int CC_SOUND_CTRL_06
public static final MetroMidi.MetroMidiControlSoundController6 MIDI_SOUND_CTRL_06
public static final int CC_SOUND_CTRL_07
public static final MetroMidi.MetroMidiControlSoundController7 MIDI_SOUND_CTRL_07
public static final int CC_SOUND_CTRL_08
public static final MetroMidi.MetroMidiControlSoundController8 MIDI_SOUND_CTRL_08
public static final int CC_SOUND_CTRL_09
public static final MetroMidi.MetroMidiControlSoundController9 MIDI_SOUND_CTRL_09
public static final int CC_SOUND_CTRL_10
public static final MetroMidi.MetroMidiControlSoundController10 MIDI_SOUND_CTRL_10
public static final int CC_GENERAL_PURPOSE_01
public static final MetroMidi.MetroMidiControlGeneralPurpose01 MIDI_GENERAL_PURPOSE_01
public static final int CC_GENERAL_PURPOSE_02
public static final MetroMidi.MetroMidiControlGeneralPurpose02 MIDI_GENERAL_PURPOSE_02
public static final int CC_GENERAL_PURPOSE_03
public static final MetroMidi.MetroMidiControlGeneralPurpose03 MIDI_GENERAL_PURPOSE_03
public static final int CC_GENERAL_PURPOSE_04
public static final MetroMidi.MetroMidiControlGeneralPurpose04 MIDI_GENERAL_PURPOSE_04
public static final int CC_PORTAMENTO_CC_CTRL
public static final MetroMidi.MetroMidiControlPortamento MIDI_PORTAMENTO_CC_CTRL
public static final int CC_EFFECT_1_DEPTH
public static final MetroMidi.MetroMidiControlEffect1 MIDI_EFFECT_1_DEPTH
public static final int CC_EFFECT_2_DEPTH
public static final MetroMidi.MetroMidiControlEffect2 MIDI_EFFECT_2_DEPTH
public static final int CC_EFFECT_3_DEPTH
public static final MetroMidi.MetroMidiControlEffect3 MIDI_EFFECT_3_DEPTH
public static final int CC_EFFECT_4_DEPTH
public static final MetroMidi.MetroMidiControlEffect4 MIDI_EFFECT_4_DEPTH
public static final int CC_EFFECT_5_DEPTH
public static final MetroMidi.MetroMidiControlEffect5 MIDI_EFFECT_5_DEPTH
public static final int CC_DATA_INCREMENT
public static final MetroMidi.MetroMidiControlDataIncrement MIDI_DATA_INCREMENT
public static final int CC_DATA_DECREMENT
public static final MetroMidi.MetroMidiControlDataDecrement MIDI_DATA_DECREMENT
public static final int CC_NRPN_LSB
public static final MetroMidi.MetroMidiControlNrpnLsb MIDI_NRPN_LSB
public static final int CC_NRPN_MSB
public static final MetroMidi.MetroMidiControlNrpnMsb MIDI_NRPN_MSB
public static final int CC_RPN_LSB
public static final MetroMidi.MetroMidiControlRpnLsb MIDI_RPN_LSB
public static final int CC_RPN_MSB
public static final MetroMidi.MetroMidiControlRpnMsb MIDI_RPN_MSB
public java.lang.String getShortName()
public java.lang.String getLongName()
public java.lang.String getShortDescription()
public java.lang.String getLongDescription()
public int getStatusHigher4bit()
public int getStatusLower4bit()
public int getControlChange8bit()
public abstract <T> T receiveMidi(MetroMidiReceiver<T> receiver, byte[] message)
public abstract void receiveBufferedMidi(MetroBufferedMidiReceiver receiver, MetroMidiEvent event)
public static MetroMidi getInfo(java.lang.String id)
public static <T> void receiveMidiMessage(MetroMidiReceiver<T> receiver, java.util.List<MetroMidiEvent> in)
public static <T> T receiveMidiMessage(MetroMidiReceiver<T> receiver, MetroMidiEvent event)
public static <T> void receiveMidiMessage(MetroBufferedMidiReceiver receiver, java.util.List<MetroMidiEvent> in)
public static void receiveBufferedMidiMessage(MetroBufferedMidiReceiver receiver, MetroMidiEvent event)