Class StdMidi
- Object
-
- StdMidi
-
public class StdMidi extends Object
TheStdMidi
class provides easy-to-use static methods for playing musical notes in real time using MIDI. It also supports reading and writing audio files in the MIDI format. The Musical Instrument Digital Interface (MIDI) standard is a communication protocol that allows computers, musical instruments, and other hardware to communicate.StdMidi
is built on top of Java's Sound API, a powerful framework for audio playback, recording, mixing, MIDI synthesis, and more. The goal is to make real-time MIDI synthesis accessible to novice programmers. Advanced features of MIDI (such as sequencing or multiple instruments at the same time) are beyond the scope of this library.Getting started. To use this class, you must have
StdMidi
in your Java classpath. Here are three possible ways to do this:- If you ran our autoinstaller, use the commands
javac-introcs
andjava-introcs
(orjavac-algs4
andjava-algs4
) when compiling and executing. These commands addstdlib.jar
(oralgs4.jar
) to the Java classpath, which provides access toStdMidi
. - Download stdlib.jar (or algs4.jar) and add it to the Java classpath.
- Download StdMidi.java and put it in the working directory.
As a test, cut-and-paste the following short program into your editor:
public class AxelF { StdMidi.setInstrument(StdMidi.SYNTH_BASS_1); StdMidi.setTempo(220); int[] pitches1 = { F4, REST, AF4, REST, F4, F4, BF4, F4, EF4 }; double[] beats1 = { QN, QN, QN, EN, QN, EN, QN, QN, QN }; int[] pitches2 = { F4, REST, C5, REST, F4, F4, DF5, C5, AF4 }; double[] beats2 = { QN, QN, QN, EN, QN, EN, QN, QN, QN }; int[] pitches3 = { F4, C5, F5, F4, EF4, EF4, C4, G4, F4, REST }; double[] beats3 = { QN, QN, QN, EN, QN, EN, QN, QN, DQN, WN }; for (int i = 0; i < pitches1.length; i++) StdMidi.playNote(pitches1[i], beats1[i]); for (int i = 0; i < pitches2.length; i++) StdMidi.playNote(pitches2[i], beats2[i]); for (int i = 0; i < pitches3.length; i++) StdMidi.playNote(pitches3[i], beats3[i]); } }
If you compile and execute the program, you should hear the first few notes of the electronic instrumental track Axel F by Harold Faltermeyer.
Playing pitched instruments. You can use the following method to play an individual MIDI note with a given pitch::
The MIDI note number is an integer between 0 and 127 (60 = Middle C) that specifies the pitch. The method plays the specified note for the specified duration (measured in beats). The special pitch
StdMidi.REST
corresponds to a rest. A rest has a duration but produces no sound.Playing unpitched percussion instruments. Unpitched instruments are not tuned to identifiable frequencies. You can use the following method to play unpitched percussion instruments (such as drums and cymbals):
The method plays the specified percussive instrument for the specified duration (measured in beats). The
percussionInstrument
is an integer between 35 (acoustic bass drum) and 81 (open triangle).Durations. The durations are measured in beats, with one beat corresponding to a quarter note. The length of a beat is determined by the tempo, which is measured in beats per minute. The default tempo is 120 beats per minute, so each beat (or quarter note) lasts 0.5 seconds.
There are a number of predefined constants for common tempos, ranging from
StdMidi.LARGHISSIMO
(20 beats per minute) toStdMidi.PRESTISSIMO
(200 beats per minute). You can set the tempo using the method:The
StdMidi
class provides predefined constants for standard musical durations (measured in beats), includingStdMidi.QUARTER_NOTE
(1 beat),StdMidi.HALF_NOTE
(2 beats),StdMidi.WHOLE_NOTE
(4 beats),StdMidi.EIGHTH_NOTE
(1/2 beat), andStdMidi.SIXTEENTH_NOTE
(1/4 beat). For brevity, you can also useStdMidi.QN
,StdMidi.HN
,StdMidi.WN
,StdMidi.EN
, andStdMidi.SN
.Key velocities. The key-down velocity indiciates the force with which a note is played. It controls the note's volume and/or brightness. Velocities range from 0 (silent) to 127 (loudest). The default MIDI velocity is 96. You can use change the key-down velocity using the method:
Instruments. The default MIDI instrument is an Acousic Grand Piano. You can use change the instrument using the method:
Subsequent notes will be synthesized using that instrument. The
instrument
argument must be an integer between 1 and 128. The instrument is identified using the General MIDI standard, which specifies 128 individual instruments and numbers them from 1 (Acoustic Grand Piano) to 128 (Gunshot). TheStdMidi
class provides pre-defined constants for these instruments, such asStdMidi.ACOUSTIC_GRAND_PIANO
andStdMidi.GUNSHOT
. Depending on the soundfont, each instrument may sound different.Playing multiple notes at the same time. For added control, you can use the following methods to play several notes (of different durations) at the same time.
-
noteOn(int note)
-
pause(double duration)
-
noteOff(int note)
-
percussionOn(int instrument)
-
percussionOff(int instrument)
If a note has a natural decay (such as a piano or bass drum), it is not strictly necessary to call
noteOff()
orpercussionOff()
. Nevertheless, it is good practice to do so in order to avoid allocating unnecessary resources for a note that is no longer making sound. Also, some instruments have limited polyphony (number of notes you can play at the same time), so you may exceed this limit if you don't explicitly turn off the notes.Playing MIDI files. You can use the following method to play a MIDI file:
The
play()
method plays the MIDI file and waits until the audio file finishes playing before continuing. TheplayInBackground()
method plays the MIDI file in a background thread (e.g., as a background score in your program). Thefilename
must have the extension.mid
or.midi
.Saving MIDI files. You can use the following method to save the sequence of notes to a MIDI file:
The
filename
must have the extension.mid
or.midi
.Soundfonts. A soundfont stores samples of musical instruments for MIDI playback. This determines how each musical instruments sounds. We recommend FluidR3, pro-quality soundfont developed by Frank Wen and released under an open-source license. If you ran our autoinstaller, it should be installed and configured automatically. If not, Java will default to an internal soundfont, known as Gervill. (On OS X, it is located in
~/.gervill/soundbank-emg.sf2
.) Alternatively, you can downloadFluidR3_GM2-2.sf2
and install it at/usr/local/lift/Soundfonts/FluidR3_GM2-2.sf2
.- Author:
- Kevin Wayne
- If you ran our autoinstaller, use the commands
-
-
Field Summary
Fields Modifier and Type Field Description static int
A_1
The note A in octave -1.static int
A0
The note A in octave 0.static int
A1
The note A in octave 1.static int
A2
The note A in octave 2.static int
A3
The note A in octave 3.static int
A4
The note A in octave 4.static int
A5
The note A in octave 5.static int
A6
The note A in octave 6.static int
A7
The note A in octave 7.static int
A8
The note A in octave 8.static int
ACCORDION
The instrument Accordion.static int
ACOUSTIC_BASS
The instrument Acoustic Bass.static int
ACOUSTIC_BASS_DRUM
The percussion instrument Acoustic Bass Drum.static int
ACOUSTIC_GRAND_PIANO
The instrument Acoustic Grand Piano.static int
ACOUSTIC_SNARE
The percussion instrument Acoustic Snare.static int
ADAGIETTO
The tempo adagietto (74 beats per minute).static int
ADAGIO
The tempo adagio (70 beats per minute).static int
AF_1
The note A♭ in octave -1.static int
AF0
The note A♭ in octave 0.static int
AF1
The note A♭ in octave 1.static int
AF2
The note A♭ in octave 2.static int
AF3
The note A♭ in octave 3.static int
AF4
The note A♭ in octave 4.static int
AF5
The note A♭ in octave 5.static int
AF6
The note A♭ in octave 6.static int
AF7
The note A♭ in octave 7.static int
AF8
The note A♭ in octave 8.static int
AGOGÔ
The instrument Agogô.static int
AHH_CHOIR
The instrument Ahh Choir.static int
ALLEGRO
The tempo allegro (140 beats per minute).static int
ALTO_SAX
The instrument Alto Sax.static int
ANDANTE
The tempo andante (90 beats per minute).static int
ANDANTINO
The tempo andantino (96 beats per minute).static int
APPLAUSE
The instrument Applause.static int
AS_1
The note A♯ in octave -1.static int
AS0
The note A♯ in octave 0.static int
AS1
The note A♯ in octave 1.static int
AS2
The note A♯ in octave 2.static int
AS3
The note A♯ in octave 3.static int
AS4
The note A♯ in octave 4.static int
AS5
The note A♯ in octave 5.static int
AS6
The note A♯ in octave 6.static int
AS7
The note A♯ in octave 7.static int
AS8
The note A♯ in octave 8.static int
ATMOSPHERE
The instrument Atmosphere.static int
B_1
The note B in octave -1.static int
B0
The note B in octave 0.static int
B1
The note B in octave 1.static int
B2
The note B in octave 2.static int
B3
The note B in octave 3.static int
B4
The note B in octave 4.static int
B5
The note B in octave 5.static int
B6
The note B in octave 6.static int
B7
The note B in octave 7.static int
B8
The note B in octave 8.static int
BAGPIPE
The instrument Bagpipe.static int
BANDONEON
The instrument Bandoneon.static int
BANJO
The instrument Banjo.static int
BARITONE_SAX
The instrument Baritone Sax.static int
BASS_AND_LEAD
The instrument Bass and Lead.static int
BASSOON
The instrument Bassoon.static int
BF_1
The note B♭ in octave -1.static int
BF0
The note B♭ in octave 0.static int
BF1
The note B♭ in octave 1.static int
BF2
The note B♭ in octave 2.static int
BF3
The note B♭ in octave 3.static int
BF4
The note B♭ in octave 4.static int
BF5
The note B♭ in octave 5.static int
BF6
The note B♭ in octave 6.static int
BF7
The note B♭ in octave 7.static int
BF8
The note B♭ in octave 8.static int
BIRD_TWEET
The instrument Bird Tweet.static int
BOTTLE_CHIFF
The instrument Bottle Chiff.static int
BOWED_GLASS
The instrument Bowed Glass.static int
BRASS_SECTION
The instrument Brass Section.static int
BREATH_NOISE
The instrument Breath Noise.static int
BRIGHT_ACOUSTIC_PIANO
The instrument Bright Acoustic Piano.static int
BRIGHTNESS
The instrument Brightness.static int
C_1
The note C in octave -1.static int
C0
The note C in octave 0.static int
C1
The note C in octave 1.static int
C2
The note C in octave 2.static int
C3
The note C in octave 3.static int
C4
The note C in octave 4.static int
C5
The note C in octave 5.static int
C6
The note C in octave 6.static int
C7
The note C in octave 7.static int
C8
The note C in octave 8.static int
C9
The note C in octave 9.static int
CABASA
The percussion instrument Cabasa.static int
CALLIOPE_LEAD
The instrument Calliope Lead.static int
CELESTA
The instrument Celesta.static int
CELLO
The instrument Cello.static int
CHARANG
The instrument Charang.static int
CHIFFER_LEAD
The instrument Chiffer Lead.static int
CHINESE_CYMBAL
The percussion instrument Chinese Cymbal.static int
CHURCH_ORGAN
The instrument Church Organ.static int
CLARINET
The instrument Clarinet.static int
CLAVES
The percussion instrument Claves.static int
CLAVINET
The instrument Clavinet.static int
CLEAN_GUITAR
The instrument Clean Guitar.static int
CLOSED_HI_HAT
The percussion instrument Closed Hi Hat.static int
CONCERT_A
The note A in octave 4, also known as Concert A and A440.static int
CONTRABASS
The instrument Contrabass.static int
COWBELL
The percussion instrument Cowbell.static int
CRASH_CYMBAL_1
The percussion instrument Crash Cymbal 1.static int
CRASH_CYMBAL_2
The percussion instrument Crash Cymbal 2.static int
CRYSTAL
The instrument Crystal.static int
CS_1
The note C♯ in octave -1.static int
CS0
The note C♯ in octave 0.static int
CS1
The note C♯ in octave 1.static int
CS2
The note C♯ in octave 2.static int
CS3
The note C♯ in octave 3.static int
CS4
The note C♯ in octave 4.static int
CS5
The note C♯ in octave 5.static int
CS6
The note C♯ in octave 6.static int
CS7
The note C♯ in octave 7.static int
CS8
The note C♯ in octave 8.static int
CS9
The note C♯ in octave 9.static int
D_1
The note D in octave -1.static int
D0
The note D in octave 0.static int
D1
The note D in octave 1.static int
D2
The note D in octave 2.static int
D3
The note D in octave 3.static int
D4
The note D in octave 4.static int
D5
The note D in octave 5.static int
D6
The note D in octave 6.static int
D7
The note D in octave 7.static int
D8
The note D in octave 8.static int
D9
The note D in octave 9.static double
DDEN
The duration of a double dotted eighth note (7/8 beat).static double
DDHN
The duration of a double dotted half note (7/2 beats).static double
DDQN
The duration of a double dotted quarter note (7/4 beats).static int
DEFAULT_INSTRUMENT
The default MIDI instrument (Acoustic Grand Piano).static int
DEFAULT_TEMPO
The default MIDI tempo (120 beats per minute).static int
DEFAULT_VELOCITY
The default MIDI velocity (96).static double
DEN
The duration of a double dotted eighth note (3/4 beats).static int
DF_1
The note D♭ in octave -1.static int
DF0
The note D♭ in octave 0.static int
DF1
The note D♭ in octave 1.static int
DF2
The note D♭ in octave 2.static int
DF3
The note D♭ in octave 3.static int
DF4
The note D♭ in octave 4.static int
DF5
The note D♭ in octave 5.static int
DF6
The note D♭ in octave 6.static int
DF7
The note D♭ in octave 7.static int
DF8
The note D♭ in octave 8.static int
DF9
The note D♭ in octave 9.static double
DHN
The duration of a dotted half note (3 beats).static int
DISTORTION_GUITAR
The instrument Distortion Guitar.static double
DOTTED_EIGHTH_NOTE
The duration of a double dotted eighth note (3/4 beats).static double
DOTTED_HALF_NOTE
The duration of a dotted half note (3 beats).static double
DOTTED_QUARTER_NOTE
The duration of a dotted quarter note (3/2 beats).static double
DOTTED_SIXTEENTH_NOTE
The duration of a dotted sixteenth note (3/8 beat).static double
DOUBLE_DOTTED_EIGHTH_NOTE
The duration of a double dotted eighth note (7/8 beat).static double
DOUBLE_DOTTED_HALF_NOTE
The duration of a double dotted half note (7/2 beats).static double
DOUBLE_DOTTED_QUARTER_NOTE
The duration of a double dotted quarter note (7/4 beats).static double
DQN
The duration of a dotted quarter note (3/2 beats).static int
DRAWBAR_ORGAN
The instrument Drawbar Organ.static int
DS_1
The note D♯ in octave -1.static int
DS0
The note D♯ in octave 0.static int
DS1
The note D♯ in octave 1.static int
DS2
The note D♯ in octave 2.static int
DS3
The note D♯ in octave 3.static int
DS4
The note D♯ in octave 4.static int
DS5
The note D♯ in octave 5.static int
DS6
The note D♯ in octave 6.static int
DS7
The note D♯ in octave 7.static int
DS8
The note D♯ in octave 8.static int
DS9
The note D♯ in octave 9.static double
DSN
The duration of a dotted sixteenth note (3/8 beat).static int
DULCIMER
The instrument Dulcimer.static int
E_1
The note E in octave -1.static int
E0
The note E in octave 0.static int
E1
The note E in octave 1.static int
E2
The note E in octave 2.static int
E3
The note E in octave 3.static int
E4
The note E in octave 4.static int
E5
The note E in octave 5.static int
E6
The note E in octave 6.static int
E7
The note E in octave 7.static int
E8
The note E in octave 8.static int
E9
The note E in octave 9.static int
ECHO_DROPS
The instrument Echo Drops.static int
EF_1
The note E♭ in octave -1.static int
EF0
The note E♭ in octave 0.static int
EF1
The note E♭ in octave 1.static int
EF2
The note E♭ in octave 2.static int
EF3
The note E♭ in octave 3.static int
EF4
The note E♭ in octave 4.static int
EF5
The note E♭ in octave 5.static int
EF6
The note E♭ in octave 6.static int
EF7
The note E♭ in octave 7.static int
EF8
The note E♭ in octave 8.static int
EF9
The note E♭ in octave 9.static double
EIGHTH_NOTE
The duration of an eighth note (1/2 beat).static double
EIGHTH_NOTE_TRIPLET
The duration of an eighth note triplet (1/3 beat).static int
ELECTRIC_BASS_DRUM
The percussion instrument Electric Bass Drum.static int
ELECTRIC_GRAND_PIANO
The instrument Electric Grand Piano.static int
ELECTRIC_PIANO_1
The instrument Electric Piano 1.static int
ELECTRIC_PIANO_2
The instrument Electric Piano 2.static int
ELECTRIC_SNARE
The percussion instrument Electric Snare.static double
EN
The duration of an eighth note (1/2 beat).static int
ENGLISH_HORN
The instrument English Horn.static double
ENT
The duration of an eighth note triplet (1/3 beat).static int
F_1
The note F in octave -1.static int
F0
The note F in octave 0.static int
F1
The note F in octave 1.static int
F2
The note F in octave 2.static int
F3
The note F in octave 3.static int
F4
The note F in octave 4.static int
F5
The note F in octave 5.static int
F6
The note F in octave 6.static int
F7
The note F in octave 7.static int
F8
The note F in octave 8.static int
F9
The note F in octave 9.static int
FANTASIA
The instrument Fantasia.static int
FIDDLE
The instrument Fiddle.static int
FIFTH_SAWTOOTH_WAVE
The instrument Fifth Sawtooth Wave.static int
FINGERED_BASS
The instrument Fingered Bass.static int
FLUTE
The instrument Flute.static int
FORTE
The velocity forte (85).static int
FORTISSIMO
The velocity fortissimo (100).static int
FORTISSISSIMO
The velocity fortississimo (120).static int
FRENCH_HORN
The instrument French Horn.static int
FRET_NOISE
The instrument Fret Noise.static int
FRETLESS_BASS
The instrument Fretless Bass.static int
FS_1
The note F♯ in octave -1.static int
FS0
The note F♯ in octave 0.static int
FS1
The note F♯ in octave 1.static int
FS2
The note F♯ in octave 2.static int
FS3
The note F♯ in octave 3.static int
FS4
The note F♯ in octave 4.static int
FS5
The note F♯ in octave 5.static int
FS6
The note F♯ in octave 6.static int
FS7
The note F♯ in octave 7.static int
FS8
The note F♯ in octave 8.static int
FS9
The note F♯ in octave 9.static int
G_1
The note G in octave -1.static int
G0
The note G in octave 0.static int
G1
The note G in octave 1.static int
G2
The note G in octave 2.static int
G3
The note G in octave 3.static int
G4
The note G in octave 4.static int
G5
The note G in octave 5.static int
G6
The note G in octave 6.static int
G7
The note G in octave 7.static int
G8
The note G in octave 8.static int
G9
The note G in octave 9.static int
GF_1
The note G♭ in octave -1.static int
GF0
The note G♭ in octave 0.static int
GF1
The note G♭ in octave 1.static int
GF2
The note G♭ in octave 2.static int
GF3
The note G♭ in octave 3.static int
GF4
The note G♭ in octave 4.static int
GF5
The note G♭ in octave 5.static int
GF6
The note G♭ in octave 6.static int
GF7
The note G♭ in octave 7.static int
GF8
The note G♭ in octave 8.static int
GF9
The note G♭ in octave 9.static int
GLOCKENSPIEL
The instrument Glockenspiel.static int
GOBLIN
The instrument Goblin.static int
GRAVE
The tempo grave (40 beats per minute).static int
GS_1
The note G♯ in octave -1.static int
GS0
The note G♯ in octave 0.static int
GS1
The note G♯ in octave 1.static int
GS2
The note G♯ in octave 2.static int
GS3
The note G♯ in octave 3.static int
GS4
The note G♯ in octave 4.static int
GS5
The note G♯ in octave 5.static int
GS6
The note G♯ in octave 6.static int
GS7
The note G♯ in octave 7.static int
GS8
The note G♯ in octave 8.static int
GUITAR_HARMONICS
The instrument Guitar Harmonics.static int
GUNSHOT
The instrument Gunshot.static double
HALF_NOTE
The duration of a half note (2 beats).static double
HALF_NOTE_TRIPLET
The duration of a half note triplet (4/3 beats).static int
HALO_PAD
The instrument Halo Pad.static int
HAND_CLAP
The percussion instrument Hand Clap.static int
HARMONICA
The instrument Harmonica.static int
HARP
The instrument Harp.static int
HARPSICHORD
The instrument Harpsichord.static int
HELICOPTER
The instrument Helicopter.static int
HIGH_AGOGÔ
The percussion instrument High Agogô.static int
HIGH_BONGO
The percussion instrument High Bongo.static int
HIGH_FLOOR_TOM
The percussion instrument High Floor Tom.static int
HIGH_MID_TOM
The percussion instrument High Mid Tom.static int
HIGH_TIMBALE
The percussion instrument High Timbale.static int
HIGH_TOM
The percussion instrument High Tom.static int
HIGH_WOODBLOCK
The percussion instrument High Woodblock.static double
HN
The duration of a half note (2 beats).static double
HNT
The duration of a half note triplet (4/3 beats).static int
HONKY_TONK_PIANO
The instrument Honky Tonk Piano.static int
ICE_RAIN
The instrument Ice Rain.static int
JAZZ_GUITAR
The instrument Jazz Guitar.static int
KALIMBA
The instrument Kalimba.static int
KOTO
The instrument Koto.static int
LARGHETTO
The tempo larghetto (60 beats per minute).static int
LARGHISSIMO
The tempo larghissimo (20 beats per minute).static int
LARGO
The tempo largo (50 beats per minute).static int
LONG_GUIRO
The percussion instrument Long Guiro.static int
LONG_WHISTLE
The percussion instrument Long Whistle.static int
LOW_AGOGÔ
The percussion instrument Low Agogô.static int
LOW_BONGO
The percussion instrument Low Bongo.static int
LOW_CONGA
The percussion instrument Low Conga.static int
LOW_FLOOR_TOM
The percussion instrument Low Floor Tom.static int
LOW_MID_TOM
The percussion instrument Low Mid Tom.static int
LOW_TIMBALE
The percussion instrument Low Timbale.static int
LOW_TOM
The percussion instrument Low Tom.static int
LOW_WOODBLOCK
The percussion instrument Low Woodblock.static int
MARACAS
The percussion instrument Maracas.static int
MARIMBA
The instrument Marimba.static int
MELODIC_TOM
The instrument Melodic Tom.static int
METAL_PAD
The instrument Metal Pad.static int
MEZZO_FORTE
The velocity mezzo forte (70).static int
MEZZO_PIANO
The velocity mezzo piano (60).static int
MIDDLE_C
The note C in octave 4, also known as Middle C.static int
MODERATO
The tempo moderato (110 beats per minute).static int
MUSIC_BOX
The instrument Music Box.static int
MUTE_CUICA
The percussion instrument Mute Cuica.static int
MUTE_HI_CONGA
The percussion instrument Mute Hi Conga.static int
MUTE_TRIANGLE
The percussion instrument Mute Triangle.static int
MUTED_TRUMPET
The instrument Muted Trumpet.static int
NYLON_STRING_GUITAR
The instrument Nylon String Guitar.static int
OBOE
The instrument Oboe.static int
OCARINA
The instrument Ocarina.static int
OHH_VOICES
The instrument Ohh Voices.static int
OPEN_CUICA
The percussion instrument Open Cuica.static int
OPEN_HI_CONGA
The percussion instrument Open Hi Conga.static int
OPEN_HI_HAT
The percussion instrument Open Hi Hat.static int
OPEN_TRIANGLE
The percussion instrument Open Triangle.static int
ORCHESTRA_HIT
The instrument Orchestra Hit.static int
OVERDRIVE_GUITAR
The instrument Overdrive Guitar.static int
PALM_MUTED_GUITAR
The instrument Palm Muted Guitar.static int
PAN_FLUTE
The instrument Pan Flute.static int
PEDAL_HI_HAT
The percussion instrument Pedal Hi Hat.static int
PERCUSSIVE_ORGAN
The instrument Percussive Organ.static int
PIANISSIMO
The velocity pianissimo (25).static int
PIANISSISSIMO
The velocity pianississimo (10).static int
PIANO
The velocity piano (50).static int
PICCOLO
The instrument Piccolo.static int
PICKED_BASS
The instrument Picked Bass.static int
PIZZICATO_STRINGS
The instrument Pizzicato Strings.static int
POLYSYNTH
The instrument Polysynth.static int
POP_BASS
The instrument Pop Bass.static int
PRESTISSIMO
The tempo prestissimo (200 beats per minute).static int
PRESTO
The tempo presto (180 beats per minute).static double
QN
The duration of a quarter note (1 beat).static double
QNT
The duration of a quarter note triplet (2/3 beat).static double
QUARTER_NOTE
The duration of a quarter note (1 beat).static double
QUARTER_NOTE_TRIPLET
The duration of a quarter note triplet (2/3 beat).static int
RECORDER
The instrument Recorder.static int
REED_ORGAN
The instrument Reed Organ.static int
REST
The note number corresponding to a rest.static int
REVERSE_CYMBAL
The instrument Reverse Cymbal.static int
RIDE_BELL
The percussion instrument Ride Bell.static int
RIDE_CYMBAL_1
The percussion instrument Ride Cymbal 1.static int
RIDE_CYMBAL_2
The percussion instrument Ride Cymbal 2.static int
ROCK_ORGAN
The instrument Rock Organ.static int
SAW_WAVE
The instrument Saw Wave.static int
SEA_SHORE
The instrument Sea Shore.static int
SHAKUHACHI
The instrument Shakuhachi.static int
SHAMISEN
The instrument Shamisen.static int
SHEHNAI
The instrument Shehnai.static int
SHORT_GUIRO
The percussion instrument Short Guiro.static int
SHORT_WHISTLE
The percussion instrument Short Whistle.static int
SIDE_STICK
The percussion instrument Side Stick.static int
SILENT
The velocity 0.static int
SITAR
The instrument Sitar.static double
SIXTEENTH_NOTE
The duration of a sixteenth note (1/4 beat).static double
SIXTEENTH_NOTE_TRIPLET
The duration of a sixteenth note triplet (1/6 beat).static int
SLAP_BASS
The instrument Slap Bass.static int
SLOW_STRINGS
The instrument Slow Strings.static double
SN
The duration of a sixteenth note (1/4 beat).static double
SNT
The duration of a sixteenth note triplet (1/6 beat).static int
SOLO_VOX
The instrument Solo Vox.static int
SOPRANO_SAX
The instrument Soprano Sax.static int
SOUNDTRACK
The instrument Soundtrack.static int
SPACE_VOICE
The instrument Space Voice.static int
SPLASH_CYMBAL
The percussion instrument Splash Cymbal.static int
SQUARE_LEAD
The instrument Square Lead.static int
STAR_THEME
The instrument Star Theme.static int
STEEL_DRUMS
The instrument Steel Drums.static int
STEEL_STRING_GUITAR
The instrument Steel String Guitar.static int
STRINGS
The instrument Strings.static int
SWEEP_PAD
The instrument Sweep Pad.static int
SYNTH_BASS_1
The instrument Synth Bass 1.static int
SYNTH_BASS_2
The instrument Synth Bass 2.static int
SYNTH_BRASS_1
The instrument Synth Brass 1.static int
SYNTH_BRASS_2
The instrument Synth Brass 2.static int
SYNTH_DRUM
The instrument Synth Drum.static int
SYNTH_STRINGS_1
The instrument Synth Strings 1.static int
SYNTH_STRINGS_2
The instrument Synth Strings 2.static int
SYNTH_VOICE
The instrument Synth Voice.static int
TAIKO_DRUM
The instrument Taiko Drum.static int
TAMBOURINE
The percussion instrument Tambourine.static int
TELEPHONE
The instrument Telephone.static int
TENOR_SAX
The instrument Tenor Sax.static double
THIRTYSECOND_NOTE
The duration of a thirty-second note (1/8 beat).static double
THIRTYSECOND_NOTE_TRIPLET
The duration of a thirty-second note triplet (1/12 beat).static int
TIMPANI
The instrument Timpani.static int
TINKLE_BELL
The instrument Tinkle Bell.static double
TN
The duration of a thirty-second note (1/8 beat).static double
TNT
The duration of a thirty-second note (1/8 beat).static int
TREMOLO_STRINGS
The instrument Tremolo Strings.static int
TROMBONE
The instrument Trombone.static int
TRUMPET
The instrument Trumpet.static int
TUBA
The instrument Tuba.static int
TUBULAR_BELLS
The instrument Tubular Bells.static int
VIBRAPHONE
The instrument Vibraphone.static int
VIBRASLAP
The percussion instrument Vibraslap.static int
VIOLA
The instrument Viola.static int
VIOLIN
The instrument Violin.static int
VIVACE
The tempo vivace (166 beats per minute).static int
VIVACISSIMO
The tempo vivacissimo (174 beats per minute).static int
WARM_PAD
The instrument Warm Pad.static int
WHISTLE
The instrument Whistle.static double
WHOLE_NOTE
The duration of a whole note (4 beats).static double
WN
The duration of a whole note (4 beats).static int
WOODBLOCK
The instrument Woodblock.static int
XYLOPHONE
The instrument Xylophone.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
allNotesOff()
Turns all notes off, but allows decaying notes to complete.static void
allSoundOff()
Turns all notes off immediately.static int
getInstrument()
Returns the MIDI instrument number (between 1 and 128).static void
main(String[] args)
Test client - plays the first few notes from Axel F by Harold Faltermeyer.static void
noteOff(int note)
Turns the specified note off.static void
noteOn(int note)
Turns the specified note on.static void
pause(double beats)
Pauses for the specified duration.static void
percussionOff(int instrument)
static void
percussionOn(int instrument)
static void
percussionOn(int instrument, int velocity)
static void
play(String filename)
Plays the specified MIDI file and waits until the audio file finishes playing before continuing.static void
playInBackground(String filename)
Plays the specified MIDI file in a background thread.static void
playNote(int note, double beats)
Plays the specified note for the given duration (measured in beats).static void
playNotes(int[] notes, double beats)
Plays the specified notes for the given duration (measured in beats).static void
playPercussion(int instrument, double beats)
Plays the specified percussion instrument for the given duration (measured in beats).static void
save(String filename)
Saves the sequence of notes to the specified MIDI file.static void
setInstrument(int instrument)
Sets the MIDI instrument to the specified value.static void
setTempo(int beatsPerMinute)
Sets the tempo to the specified number of beats per minute.static void
setVelocity(int val)
Sets the velocity to the specified value between 0 (silent) and 127 (loudest).
-
-
-
Field Detail
-
DEFAULT_TEMPO
public static final int DEFAULT_TEMPO
The default MIDI tempo (120 beats per minute).- See Also:
- Constant Field Values
-
DEFAULT_VELOCITY
public static final int DEFAULT_VELOCITY
The default MIDI velocity (96).- See Also:
- Constant Field Values
-
DEFAULT_INSTRUMENT
public static final int DEFAULT_INSTRUMENT
The default MIDI instrument (Acoustic Grand Piano).- See Also:
- Constant Field Values
-
LARGHISSIMO
public static final int LARGHISSIMO
The tempo larghissimo (20 beats per minute).- See Also:
- Constant Field Values
-
GRAVE
public static final int GRAVE
The tempo grave (40 beats per minute).- See Also:
- Constant Field Values
-
LARGO
public static final int LARGO
The tempo largo (50 beats per minute).- See Also:
- Constant Field Values
-
LARGHETTO
public static final int LARGHETTO
The tempo larghetto (60 beats per minute).- See Also:
- Constant Field Values
-
ADAGIO
public static final int ADAGIO
The tempo adagio (70 beats per minute).- See Also:
- Constant Field Values
-
ADAGIETTO
public static final int ADAGIETTO
The tempo adagietto (74 beats per minute).- See Also:
- Constant Field Values
-
ANDANTE
public static final int ANDANTE
The tempo andante (90 beats per minute).- See Also:
- Constant Field Values
-
ANDANTINO
public static final int ANDANTINO
The tempo andantino (96 beats per minute).- See Also:
- Constant Field Values
-
MODERATO
public static final int MODERATO
The tempo moderato (110 beats per minute).- See Also:
- Constant Field Values
-
ALLEGRO
public static final int ALLEGRO
The tempo allegro (140 beats per minute).- See Also:
- Constant Field Values
-
VIVACE
public static final int VIVACE
The tempo vivace (166 beats per minute).- See Also:
- Constant Field Values
-
VIVACISSIMO
public static final int VIVACISSIMO
The tempo vivacissimo (174 beats per minute).- See Also:
- Constant Field Values
-
PRESTO
public static final int PRESTO
The tempo presto (180 beats per minute).- See Also:
- Constant Field Values
-
PRESTISSIMO
public static final int PRESTISSIMO
The tempo prestissimo (200 beats per minute).- See Also:
- Constant Field Values
-
SILENT
public static final int SILENT
The velocity 0. Playing a note with this velocity is equivalent to turning it off.- See Also:
- Constant Field Values
-
PIANISSISSIMO
public static final int PIANISSISSIMO
The velocity pianississimo (10).- See Also:
- Constant Field Values
-
PIANISSIMO
public static final int PIANISSIMO
The velocity pianissimo (25).- See Also:
- Constant Field Values
-
PIANO
public static final int PIANO
The velocity piano (50).- See Also:
- Constant Field Values
-
MEZZO_PIANO
public static final int MEZZO_PIANO
The velocity mezzo piano (60).- See Also:
- Constant Field Values
-
MEZZO_FORTE
public static final int MEZZO_FORTE
The velocity mezzo forte (70).- See Also:
- Constant Field Values
-
FORTE
public static final int FORTE
The velocity forte (85).- See Also:
- Constant Field Values
-
FORTISSIMO
public static final int FORTISSIMO
The velocity fortissimo (100).- See Also:
- Constant Field Values
-
FORTISSISSIMO
public static final int FORTISSISSIMO
The velocity fortississimo (120).- See Also:
- Constant Field Values
-
CONCERT_A
public static final int CONCERT_A
The note A in octave 4, also known as Concert A and A440.- See Also:
- Constant Field Values
-
MIDDLE_C
public static final int MIDDLE_C
The note C in octave 4, also known as Middle C.- See Also:
- Constant Field Values
-
REST
public static final int REST
The note number corresponding to a rest.- See Also:
- Constant Field Values
-
C_1
public static final int C_1
The note C in octave -1.- See Also:
- Constant Field Values
-
CS_1
public static final int CS_1
The note C♯ in octave -1.- See Also:
- Constant Field Values
-
DF_1
public static final int DF_1
The note D♭ in octave -1.- See Also:
- Constant Field Values
-
D_1
public static final int D_1
The note D in octave -1.- See Also:
- Constant Field Values
-
DS_1
public static final int DS_1
The note D♯ in octave -1.- See Also:
- Constant Field Values
-
EF_1
public static final int EF_1
The note E♭ in octave -1.- See Also:
- Constant Field Values
-
E_1
public static final int E_1
The note E in octave -1.- See Also:
- Constant Field Values
-
F_1
public static final int F_1
The note F in octave -1.- See Also:
- Constant Field Values
-
FS_1
public static final int FS_1
The note F♯ in octave -1.- See Also:
- Constant Field Values
-
GF_1
public static final int GF_1
The note G♭ in octave -1.- See Also:
- Constant Field Values
-
G_1
public static final int G_1
The note G in octave -1.- See Also:
- Constant Field Values
-
GS_1
public static final int GS_1
The note G♯ in octave -1.- See Also:
- Constant Field Values
-
AF_1
public static final int AF_1
The note A♭ in octave -1.- See Also:
- Constant Field Values
-
A_1
public static final int A_1
The note A in octave -1.- See Also:
- Constant Field Values
-
AS_1
public static final int AS_1
The note A♯ in octave -1.- See Also:
- Constant Field Values
-
BF_1
public static final int BF_1
The note B♭ in octave -1.- See Also:
- Constant Field Values
-
B_1
public static final int B_1
The note B in octave -1.- See Also:
- Constant Field Values
-
C0
public static final int C0
The note C in octave 0.- See Also:
- Constant Field Values
-
CS0
public static final int CS0
The note C♯ in octave 0.- See Also:
- Constant Field Values
-
DF0
public static final int DF0
The note D♭ in octave 0.- See Also:
- Constant Field Values
-
D0
public static final int D0
The note D in octave 0.- See Also:
- Constant Field Values
-
DS0
public static final int DS0
The note D♯ in octave 0.- See Also:
- Constant Field Values
-
EF0
public static final int EF0
The note E♭ in octave 0.- See Also:
- Constant Field Values
-
E0
public static final int E0
The note E in octave 0.- See Also:
- Constant Field Values
-
F0
public static final int F0
The note F in octave 0.- See Also:
- Constant Field Values
-
FS0
public static final int FS0
The note F♯ in octave 0.- See Also:
- Constant Field Values
-
GF0
public static final int GF0
The note G♭ in octave 0.- See Also:
- Constant Field Values
-
G0
public static final int G0
The note G in octave 0.- See Also:
- Constant Field Values
-
GS0
public static final int GS0
The note G♯ in octave 0.- See Also:
- Constant Field Values
-
AF0
public static final int AF0
The note A♭ in octave 0.- See Also:
- Constant Field Values
-
A0
public static final int A0
The note A in octave 0.- See Also:
- Constant Field Values
-
AS0
public static final int AS0
The note A♯ in octave 0.- See Also:
- Constant Field Values
-
BF0
public static final int BF0
The note B♭ in octave 0.- See Also:
- Constant Field Values
-
B0
public static final int B0
The note B in octave 0.- See Also:
- Constant Field Values
-
C1
public static final int C1
The note C in octave 1.- See Also:
- Constant Field Values
-
CS1
public static final int CS1
The note C♯ in octave 1.- See Also:
- Constant Field Values
-
DF1
public static final int DF1
The note D♭ in octave 1.- See Also:
- Constant Field Values
-
D1
public static final int D1
The note D in octave 1.- See Also:
- Constant Field Values
-
DS1
public static final int DS1
The note D♯ in octave 1.- See Also:
- Constant Field Values
-
EF1
public static final int EF1
The note E♭ in octave 1.- See Also:
- Constant Field Values
-
E1
public static final int E1
The note E in octave 1.- See Also:
- Constant Field Values
-
F1
public static final int F1
The note F in octave 1.- See Also:
- Constant Field Values
-
FS1
public static final int FS1
The note F♯ in octave 1.- See Also:
- Constant Field Values
-
GF1
public static final int GF1
The note G♭ in octave 1.- See Also:
- Constant Field Values
-
G1
public static final int G1
The note G in octave 1.- See Also:
- Constant Field Values
-
GS1
public static final int GS1
The note G♯ in octave 1.- See Also:
- Constant Field Values
-
AF1
public static final int AF1
The note A♭ in octave 1.- See Also:
- Constant Field Values
-
A1
public static final int A1
The note A in octave 1.- See Also:
- Constant Field Values
-
AS1
public static final int AS1
The note A♯ in octave 1.- See Also:
- Constant Field Values
-
BF1
public static final int BF1
The note B♭ in octave 1.- See Also:
- Constant Field Values
-
B1
public static final int B1
The note B in octave 1.- See Also:
- Constant Field Values
-
C2
public static final int C2
The note C in octave 2.- See Also:
- Constant Field Values
-
CS2
public static final int CS2
The note C♯ in octave 2.- See Also:
- Constant Field Values
-
DF2
public static final int DF2
The note D♭ in octave 2.- See Also:
- Constant Field Values
-
D2
public static final int D2
The note D in octave 2.- See Also:
- Constant Field Values
-
DS2
public static final int DS2
The note D♯ in octave 2.- See Also:
- Constant Field Values
-
EF2
public static final int EF2
The note E♭ in octave 2.- See Also:
- Constant Field Values
-
E2
public static final int E2
The note E in octave 2.- See Also:
- Constant Field Values
-
F2
public static final int F2
The note F in octave 2.- See Also:
- Constant Field Values
-
FS2
public static final int FS2
The note F♯ in octave 2.- See Also:
- Constant Field Values
-
GF2
public static final int GF2
The note G♭ in octave 2.- See Also:
- Constant Field Values
-
G2
public static final int G2
The note G in octave 2.- See Also:
- Constant Field Values
-
GS2
public static final int GS2
The note G♯ in octave 2.- See Also:
- Constant Field Values
-
AF2
public static final int AF2
The note A♭ in octave 2.- See Also:
- Constant Field Values
-
A2
public static final int A2
The note A in octave 2.- See Also:
- Constant Field Values
-
AS2
public static final int AS2
The note A♯ in octave 2.- See Also:
- Constant Field Values
-
BF2
public static final int BF2
The note B♭ in octave 2.- See Also:
- Constant Field Values
-
B2
public static final int B2
The note B in octave 2.- See Also:
- Constant Field Values
-
C3
public static final int C3
The note C in octave 3.- See Also:
- Constant Field Values
-
CS3
public static final int CS3
The note C♯ in octave 3.- See Also:
- Constant Field Values
-
DF3
public static final int DF3
The note D♭ in octave 3.- See Also:
- Constant Field Values
-
D3
public static final int D3
The note D in octave 3.- See Also:
- Constant Field Values
-
DS3
public static final int DS3
The note D♯ in octave 3.- See Also:
- Constant Field Values
-
EF3
public static final int EF3
The note E♭ in octave 3.- See Also:
- Constant Field Values
-
E3
public static final int E3
The note E in octave 3.- See Also:
- Constant Field Values
-
F3
public static final int F3
The note F in octave 3.- See Also:
- Constant Field Values
-
FS3
public static final int FS3
The note F♯ in octave 3.- See Also:
- Constant Field Values
-
GF3
public static final int GF3
The note G♭ in octave 3.- See Also:
- Constant Field Values
-
G3
public static final int G3
The note G in octave 3.- See Also:
- Constant Field Values
-
GS3
public static final int GS3
The note G♯ in octave 3.- See Also:
- Constant Field Values
-
AF3
public static final int AF3
The note A♭ in octave 3.- See Also:
- Constant Field Values
-
A3
public static final int A3
The note A in octave 3.- See Also:
- Constant Field Values
-
AS3
public static final int AS3
The note A♯ in octave 3.- See Also:
- Constant Field Values
-
BF3
public static final int BF3
The note B♭ in octave 3.- See Also:
- Constant Field Values
-
B3
public static final int B3
The note B in octave 3.- See Also:
- Constant Field Values
-
C4
public static final int C4
The note C in octave 4.- See Also:
- Constant Field Values
-
CS4
public static final int CS4
The note C♯ in octave 4.- See Also:
- Constant Field Values
-
DF4
public static final int DF4
The note D♭ in octave 4.- See Also:
- Constant Field Values
-
D4
public static final int D4
The note D in octave 4.- See Also:
- Constant Field Values
-
DS4
public static final int DS4
The note D♯ in octave 4.- See Also:
- Constant Field Values
-
EF4
public static final int EF4
The note E♭ in octave 4.- See Also:
- Constant Field Values
-
E4
public static final int E4
The note E in octave 4.- See Also:
- Constant Field Values
-
F4
public static final int F4
The note F in octave 4.- See Also:
- Constant Field Values
-
FS4
public static final int FS4
The note F♯ in octave 4.- See Also:
- Constant Field Values
-
GF4
public static final int GF4
The note G♭ in octave 4.- See Also:
- Constant Field Values
-
G4
public static final int G4
The note G in octave 4.- See Also:
- Constant Field Values
-
GS4
public static final int GS4
The note G♯ in octave 4.- See Also:
- Constant Field Values
-
AF4
public static final int AF4
The note A♭ in octave 4.- See Also:
- Constant Field Values
-
A4
public static final int A4
The note A in octave 4.- See Also:
- Constant Field Values
-
AS4
public static final int AS4
The note A♯ in octave 4.- See Also:
- Constant Field Values
-
BF4
public static final int BF4
The note B♭ in octave 4.- See Also:
- Constant Field Values
-
B4
public static final int B4
The note B in octave 4.- See Also:
- Constant Field Values
-
C5
public static final int C5
The note C in octave 5.- See Also:
- Constant Field Values
-
CS5
public static final int CS5
The note C♯ in octave 5.- See Also:
- Constant Field Values
-
DF5
public static final int DF5
The note D♭ in octave 5.- See Also:
- Constant Field Values
-
D5
public static final int D5
The note D in octave 5.- See Also:
- Constant Field Values
-
DS5
public static final int DS5
The note D♯ in octave 5.- See Also:
- Constant Field Values
-
EF5
public static final int EF5
The note E♭ in octave 5.- See Also:
- Constant Field Values
-
E5
public static final int E5
The note E in octave 5.- See Also:
- Constant Field Values
-
F5
public static final int F5
The note F in octave 5.- See Also:
- Constant Field Values
-
FS5
public static final int FS5
The note F♯ in octave 5.- See Also:
- Constant Field Values
-
GF5
public static final int GF5
The note G♭ in octave 5.- See Also:
- Constant Field Values
-
G5
public static final int G5
The note G in octave 5.- See Also:
- Constant Field Values
-
GS5
public static final int GS5
The note G♯ in octave 5.- See Also:
- Constant Field Values
-
AF5
public static final int AF5
The note A♭ in octave 5.- See Also:
- Constant Field Values
-
A5
public static final int A5
The note A in octave 5.- See Also:
- Constant Field Values
-
AS5
public static final int AS5
The note A♯ in octave 5.- See Also:
- Constant Field Values
-
BF5
public static final int BF5
The note B♭ in octave 5.- See Also:
- Constant Field Values
-
B5
public static final int B5
The note B in octave 5.- See Also:
- Constant Field Values
-
C6
public static final int C6
The note C in octave 6.- See Also:
- Constant Field Values
-
CS6
public static final int CS6
The note C♯ in octave 6.- See Also:
- Constant Field Values
-
DF6
public static final int DF6
The note D♭ in octave 6.- See Also:
- Constant Field Values
-
D6
public static final int D6
The note D in octave 6.- See Also:
- Constant Field Values
-
DS6
public static final int DS6
The note D♯ in octave 6.- See Also:
- Constant Field Values
-
EF6
public static final int EF6
The note E♭ in octave 6.- See Also:
- Constant Field Values
-
E6
public static final int E6
The note E in octave 6.- See Also:
- Constant Field Values
-
F6
public static final int F6
The note F in octave 6.- See Also:
- Constant Field Values
-
FS6
public static final int FS6
The note F♯ in octave 6.- See Also:
- Constant Field Values
-
GF6
public static final int GF6
The note G♭ in octave 6.- See Also:
- Constant Field Values
-
G6
public static final int G6
The note G in octave 6.- See Also:
- Constant Field Values
-
GS6
public static final int GS6
The note G♯ in octave 6.- See Also:
- Constant Field Values
-
AF6
public static final int AF6
The note A♭ in octave 6.- See Also:
- Constant Field Values
-
A6
public static final int A6
The note A in octave 6.- See Also:
- Constant Field Values
-
AS6
public static final int AS6
The note A♯ in octave 6.- See Also:
- Constant Field Values
-
BF6
public static final int BF6
The note B♭ in octave 6.- See Also:
- Constant Field Values
-
B6
public static final int B6
The note B in octave 6.- See Also:
- Constant Field Values
-
C7
public static final int C7
The note C in octave 7.- See Also:
- Constant Field Values
-
CS7
public static final int CS7
The note C♯ in octave 7.- See Also:
- Constant Field Values
-
DF7
public static final int DF7
The note D♭ in octave 7.- See Also:
- Constant Field Values
-
D7
public static final int D7
The note D in octave 7.- See Also:
- Constant Field Values
-
DS7
public static final int DS7
The note D♯ in octave 7.- See Also:
- Constant Field Values
-
EF7
public static final int EF7
The note E♭ in octave 7.- See Also:
- Constant Field Values
-
E7
public static final int E7
The note E in octave 7.- See Also:
- Constant Field Values
-
F7
public static final int F7
The note F in octave 7.- See Also:
- Constant Field Values
-
FS7
public static final int FS7
The note F♯ in octave 7.- See Also:
- Constant Field Values
-
GF7
public static final int GF7
The note G♭ in octave 7.- See Also:
- Constant Field Values
-
G7
public static final int G7
The note G in octave 7.- See Also:
- Constant Field Values
-
GS7
public static final int GS7
The note G♯ in octave 7.- See Also:
- Constant Field Values
-
AF7
public static final int AF7
The note A♭ in octave 7.- See Also:
- Constant Field Values
-
A7
public static final int A7
The note A in octave 7.- See Also:
- Constant Field Values
-
AS7
public static final int AS7
The note A♯ in octave 7.- See Also:
- Constant Field Values
-
BF7
public static final int BF7
The note B♭ in octave 7.- See Also:
- Constant Field Values
-
B7
public static final int B7
The note B in octave 7.- See Also:
- Constant Field Values
-
C8
public static final int C8
The note C in octave 8.- See Also:
- Constant Field Values
-
CS8
public static final int CS8
The note C♯ in octave 8.- See Also:
- Constant Field Values
-
DF8
public static final int DF8
The note D♭ in octave 8.- See Also:
- Constant Field Values
-
D8
public static final int D8
The note D in octave 8.- See Also:
- Constant Field Values
-
DS8
public static final int DS8
The note D♯ in octave 8.- See Also:
- Constant Field Values
-
EF8
public static final int EF8
The note E♭ in octave 8.- See Also:
- Constant Field Values
-
E8
public static final int E8
The note E in octave 8.- See Also:
- Constant Field Values
-
F8
public static final int F8
The note F in octave 8.- See Also:
- Constant Field Values
-
FS8
public static final int FS8
The note F♯ in octave 8.- See Also:
- Constant Field Values
-
GF8
public static final int GF8
The note G♭ in octave 8.- See Also:
- Constant Field Values
-
G8
public static final int G8
The note G in octave 8.- See Also:
- Constant Field Values
-
GS8
public static final int GS8
The note G♯ in octave 8.- See Also:
- Constant Field Values
-
AF8
public static final int AF8
The note A♭ in octave 8.- See Also:
- Constant Field Values
-
A8
public static final int A8
The note A in octave 8.- See Also:
- Constant Field Values
-
AS8
public static final int AS8
The note A♯ in octave 8.- See Also:
- Constant Field Values
-
BF8
public static final int BF8
The note B♭ in octave 8.- See Also:
- Constant Field Values
-
B8
public static final int B8
The note B in octave 8.- See Also:
- Constant Field Values
-
C9
public static final int C9
The note C in octave 9.- See Also:
- Constant Field Values
-
CS9
public static final int CS9
The note C♯ in octave 9.- See Also:
- Constant Field Values
-
DF9
public static final int DF9
The note D♭ in octave 9.- See Also:
- Constant Field Values
-
D9
public static final int D9
The note D in octave 9.- See Also:
- Constant Field Values
-
DS9
public static final int DS9
The note D♯ in octave 9.- See Also:
- Constant Field Values
-
EF9
public static final int EF9
The note E♭ in octave 9.- See Also:
- Constant Field Values
-
E9
public static final int E9
The note E in octave 9.- See Also:
- Constant Field Values
-
F9
public static final int F9
The note F in octave 9.- See Also:
- Constant Field Values
-
FS9
public static final int FS9
The note F♯ in octave 9.- See Also:
- Constant Field Values
-
GF9
public static final int GF9
The note G♭ in octave 9.- See Also:
- Constant Field Values
-
G9
public static final int G9
The note G in octave 9.- See Also:
- Constant Field Values
-
WN
public static final double WN
The duration of a whole note (4 beats).- See Also:
- Constant Field Values
-
DDHN
public static final double DDHN
The duration of a double dotted half note (7/2 beats).- See Also:
- Constant Field Values
-
DHN
public static final double DHN
The duration of a dotted half note (3 beats).- See Also:
- Constant Field Values
-
HN
public static final double HN
The duration of a half note (2 beats).- See Also:
- Constant Field Values
-
DDQN
public static final double DDQN
The duration of a double dotted quarter note (7/4 beats).- See Also:
- Constant Field Values
-
DQN
public static final double DQN
The duration of a dotted quarter note (3/2 beats).- See Also:
- Constant Field Values
-
HNT
public static final double HNT
The duration of a half note triplet (4/3 beats).- See Also:
- Constant Field Values
-
QN
public static final double QN
The duration of a quarter note (1 beat).- See Also:
- Constant Field Values
-
DDEN
public static final double DDEN
The duration of a double dotted eighth note (7/8 beat).- See Also:
- Constant Field Values
-
QNT
public static final double QNT
The duration of a quarter note triplet (2/3 beat).- See Also:
- Constant Field Values
-
DEN
public static final double DEN
The duration of a double dotted eighth note (3/4 beats).- See Also:
- Constant Field Values
-
EN
public static final double EN
The duration of an eighth note (1/2 beat).- See Also:
- Constant Field Values
-
DSN
public static final double DSN
The duration of a dotted sixteenth note (3/8 beat).- See Also:
- Constant Field Values
-
ENT
public static final double ENT
The duration of an eighth note triplet (1/3 beat).- See Also:
- Constant Field Values
-
SN
public static final double SN
The duration of a sixteenth note (1/4 beat).- See Also:
- Constant Field Values
-
TN
public static final double TN
The duration of a thirty-second note (1/8 beat).- See Also:
- Constant Field Values
-
SNT
public static final double SNT
The duration of a sixteenth note triplet (1/6 beat).- See Also:
- Constant Field Values
-
TNT
public static final double TNT
The duration of a thirty-second note (1/8 beat).- See Also:
- Constant Field Values
-
WHOLE_NOTE
public static final double WHOLE_NOTE
The duration of a whole note (4 beats).- See Also:
- Constant Field Values
-
DOTTED_HALF_NOTE
public static final double DOTTED_HALF_NOTE
The duration of a dotted half note (3 beats).- See Also:
- Constant Field Values
-
DOUBLE_DOTTED_HALF_NOTE
public static final double DOUBLE_DOTTED_HALF_NOTE
The duration of a double dotted half note (7/2 beats).- See Also:
- Constant Field Values
-
HALF_NOTE
public static final double HALF_NOTE
The duration of a half note (2 beats).- See Also:
- Constant Field Values
-
DOUBLE_DOTTED_QUARTER_NOTE
public static final double DOUBLE_DOTTED_QUARTER_NOTE
The duration of a double dotted quarter note (7/4 beats).- See Also:
- Constant Field Values
-
DOTTED_QUARTER_NOTE
public static final double DOTTED_QUARTER_NOTE
The duration of a dotted quarter note (3/2 beats).- See Also:
- Constant Field Values
-
HALF_NOTE_TRIPLET
public static final double HALF_NOTE_TRIPLET
The duration of a half note triplet (4/3 beats).- See Also:
- Constant Field Values
-
QUARTER_NOTE
public static final double QUARTER_NOTE
The duration of a quarter note (1 beat).- See Also:
- Constant Field Values
-
DOUBLE_DOTTED_EIGHTH_NOTE
public static final double DOUBLE_DOTTED_EIGHTH_NOTE
The duration of a double dotted eighth note (7/8 beat).- See Also:
- Constant Field Values
-
DOTTED_EIGHTH_NOTE
public static final double DOTTED_EIGHTH_NOTE
The duration of a double dotted eighth note (3/4 beats).- See Also:
- Constant Field Values
-
QUARTER_NOTE_TRIPLET
public static final double QUARTER_NOTE_TRIPLET
The duration of a quarter note triplet (2/3 beat).- See Also:
- Constant Field Values
-
EIGHTH_NOTE
public static final double EIGHTH_NOTE
The duration of an eighth note (1/2 beat).- See Also:
- Constant Field Values
-
DOTTED_SIXTEENTH_NOTE
public static final double DOTTED_SIXTEENTH_NOTE
The duration of a dotted sixteenth note (3/8 beat).- See Also:
- Constant Field Values
-
EIGHTH_NOTE_TRIPLET
public static final double EIGHTH_NOTE_TRIPLET
The duration of an eighth note triplet (1/3 beat).- See Also:
- Constant Field Values
-
SIXTEENTH_NOTE
public static final double SIXTEENTH_NOTE
The duration of a sixteenth note (1/4 beat).- See Also:
- Constant Field Values
-
SIXTEENTH_NOTE_TRIPLET
public static final double SIXTEENTH_NOTE_TRIPLET
The duration of a sixteenth note triplet (1/6 beat).- See Also:
- Constant Field Values
-
THIRTYSECOND_NOTE
public static final double THIRTYSECOND_NOTE
The duration of a thirty-second note (1/8 beat).- See Also:
- Constant Field Values
-
THIRTYSECOND_NOTE_TRIPLET
public static final double THIRTYSECOND_NOTE_TRIPLET
The duration of a thirty-second note triplet (1/12 beat).- See Also:
- Constant Field Values
-
ACOUSTIC_GRAND_PIANO
public static final int ACOUSTIC_GRAND_PIANO
The instrument Acoustic Grand Piano.- See Also:
- Constant Field Values
-
BRIGHT_ACOUSTIC_PIANO
public static final int BRIGHT_ACOUSTIC_PIANO
The instrument Bright Acoustic Piano.- See Also:
- Constant Field Values
-
ELECTRIC_GRAND_PIANO
public static final int ELECTRIC_GRAND_PIANO
The instrument Electric Grand Piano.- See Also:
- Constant Field Values
-
HONKY_TONK_PIANO
public static final int HONKY_TONK_PIANO
The instrument Honky Tonk Piano.- See Also:
- Constant Field Values
-
ELECTRIC_PIANO_1
public static final int ELECTRIC_PIANO_1
The instrument Electric Piano 1.- See Also:
- Constant Field Values
-
ELECTRIC_PIANO_2
public static final int ELECTRIC_PIANO_2
The instrument Electric Piano 2.- See Also:
- Constant Field Values
-
HARPSICHORD
public static final int HARPSICHORD
The instrument Harpsichord.- See Also:
- Constant Field Values
-
CLAVINET
public static final int CLAVINET
The instrument Clavinet.- See Also:
- Constant Field Values
-
CELESTA
public static final int CELESTA
The instrument Celesta.- See Also:
- Constant Field Values
-
GLOCKENSPIEL
public static final int GLOCKENSPIEL
The instrument Glockenspiel.- See Also:
- Constant Field Values
-
MUSIC_BOX
public static final int MUSIC_BOX
The instrument Music Box.- See Also:
- Constant Field Values
-
VIBRAPHONE
public static final int VIBRAPHONE
The instrument Vibraphone.- See Also:
- Constant Field Values
-
MARIMBA
public static final int MARIMBA
The instrument Marimba.- See Also:
- Constant Field Values
-
XYLOPHONE
public static final int XYLOPHONE
The instrument Xylophone.- See Also:
- Constant Field Values
-
TUBULAR_BELLS
public static final int TUBULAR_BELLS
The instrument Tubular Bells.- See Also:
- Constant Field Values
-
DULCIMER
public static final int DULCIMER
The instrument Dulcimer.- See Also:
- Constant Field Values
-
DRAWBAR_ORGAN
public static final int DRAWBAR_ORGAN
The instrument Drawbar Organ.- See Also:
- Constant Field Values
-
PERCUSSIVE_ORGAN
public static final int PERCUSSIVE_ORGAN
The instrument Percussive Organ.- See Also:
- Constant Field Values
-
ROCK_ORGAN
public static final int ROCK_ORGAN
The instrument Rock Organ.- See Also:
- Constant Field Values
-
CHURCH_ORGAN
public static final int CHURCH_ORGAN
The instrument Church Organ.- See Also:
- Constant Field Values
-
REED_ORGAN
public static final int REED_ORGAN
The instrument Reed Organ.- See Also:
- Constant Field Values
-
ACCORDION
public static final int ACCORDION
The instrument Accordion.- See Also:
- Constant Field Values
-
HARMONICA
public static final int HARMONICA
The instrument Harmonica.- See Also:
- Constant Field Values
-
BANDONEON
public static final int BANDONEON
The instrument Bandoneon.- See Also:
- Constant Field Values
-
NYLON_STRING_GUITAR
public static final int NYLON_STRING_GUITAR
The instrument Nylon String Guitar.- See Also:
- Constant Field Values
-
STEEL_STRING_GUITAR
public static final int STEEL_STRING_GUITAR
The instrument Steel String Guitar.- See Also:
- Constant Field Values
-
JAZZ_GUITAR
public static final int JAZZ_GUITAR
The instrument Jazz Guitar.- See Also:
- Constant Field Values
-
CLEAN_GUITAR
public static final int CLEAN_GUITAR
The instrument Clean Guitar.- See Also:
- Constant Field Values
-
PALM_MUTED_GUITAR
public static final int PALM_MUTED_GUITAR
The instrument Palm Muted Guitar.- See Also:
- Constant Field Values
-
OVERDRIVE_GUITAR
public static final int OVERDRIVE_GUITAR
The instrument Overdrive Guitar.- See Also:
- Constant Field Values
-
DISTORTION_GUITAR
public static final int DISTORTION_GUITAR
The instrument Distortion Guitar.- See Also:
- Constant Field Values
-
GUITAR_HARMONICS
public static final int GUITAR_HARMONICS
The instrument Guitar Harmonics.- See Also:
- Constant Field Values
-
ACOUSTIC_BASS
public static final int ACOUSTIC_BASS
The instrument Acoustic Bass.- See Also:
- Constant Field Values
-
FINGERED_BASS
public static final int FINGERED_BASS
The instrument Fingered Bass.- See Also:
- Constant Field Values
-
PICKED_BASS
public static final int PICKED_BASS
The instrument Picked Bass.- See Also:
- Constant Field Values
-
FRETLESS_BASS
public static final int FRETLESS_BASS
The instrument Fretless Bass.- See Also:
- Constant Field Values
-
SLAP_BASS
public static final int SLAP_BASS
The instrument Slap Bass.- See Also:
- Constant Field Values
-
POP_BASS
public static final int POP_BASS
The instrument Pop Bass.- See Also:
- Constant Field Values
-
SYNTH_BASS_1
public static final int SYNTH_BASS_1
The instrument Synth Bass 1.- See Also:
- Constant Field Values
-
SYNTH_BASS_2
public static final int SYNTH_BASS_2
The instrument Synth Bass 2.- See Also:
- Constant Field Values
-
VIOLIN
public static final int VIOLIN
The instrument Violin.- See Also:
- Constant Field Values
-
VIOLA
public static final int VIOLA
The instrument Viola.- See Also:
- Constant Field Values
-
CELLO
public static final int CELLO
The instrument Cello.- See Also:
- Constant Field Values
-
CONTRABASS
public static final int CONTRABASS
The instrument Contrabass.- See Also:
- Constant Field Values
-
TREMOLO_STRINGS
public static final int TREMOLO_STRINGS
The instrument Tremolo Strings.- See Also:
- Constant Field Values
-
PIZZICATO_STRINGS
public static final int PIZZICATO_STRINGS
The instrument Pizzicato Strings.- See Also:
- Constant Field Values
-
HARP
public static final int HARP
The instrument Harp.- See Also:
- Constant Field Values
-
TIMPANI
public static final int TIMPANI
The instrument Timpani.- See Also:
- Constant Field Values
-
STRINGS
public static final int STRINGS
The instrument Strings.- See Also:
- Constant Field Values
-
SLOW_STRINGS
public static final int SLOW_STRINGS
The instrument Slow Strings.- See Also:
- Constant Field Values
-
SYNTH_STRINGS_1
public static final int SYNTH_STRINGS_1
The instrument Synth Strings 1.- See Also:
- Constant Field Values
-
SYNTH_STRINGS_2
public static final int SYNTH_STRINGS_2
The instrument Synth Strings 2.- See Also:
- Constant Field Values
-
AHH_CHOIR
public static final int AHH_CHOIR
The instrument Ahh Choir.- See Also:
- Constant Field Values
-
OHH_VOICES
public static final int OHH_VOICES
The instrument Ohh Voices.- See Also:
- Constant Field Values
-
SYNTH_VOICE
public static final int SYNTH_VOICE
The instrument Synth Voice.- See Also:
- Constant Field Values
-
ORCHESTRA_HIT
public static final int ORCHESTRA_HIT
The instrument Orchestra Hit.- See Also:
- Constant Field Values
-
TRUMPET
public static final int TRUMPET
The instrument Trumpet.- See Also:
- Constant Field Values
-
TROMBONE
public static final int TROMBONE
The instrument Trombone.- See Also:
- Constant Field Values
-
TUBA
public static final int TUBA
The instrument Tuba.- See Also:
- Constant Field Values
-
MUTED_TRUMPET
public static final int MUTED_TRUMPET
The instrument Muted Trumpet.- See Also:
- Constant Field Values
-
FRENCH_HORN
public static final int FRENCH_HORN
The instrument French Horn.- See Also:
- Constant Field Values
-
BRASS_SECTION
public static final int BRASS_SECTION
The instrument Brass Section.- See Also:
- Constant Field Values
-
SYNTH_BRASS_1
public static final int SYNTH_BRASS_1
The instrument Synth Brass 1.- See Also:
- Constant Field Values
-
SYNTH_BRASS_2
public static final int SYNTH_BRASS_2
The instrument Synth Brass 2.- See Also:
- Constant Field Values
-
SOPRANO_SAX
public static final int SOPRANO_SAX
The instrument Soprano Sax.- See Also:
- Constant Field Values
-
ALTO_SAX
public static final int ALTO_SAX
The instrument Alto Sax.- See Also:
- Constant Field Values
-
TENOR_SAX
public static final int TENOR_SAX
The instrument Tenor Sax.- See Also:
- Constant Field Values
-
BARITONE_SAX
public static final int BARITONE_SAX
The instrument Baritone Sax.- See Also:
- Constant Field Values
-
OBOE
public static final int OBOE
The instrument Oboe.- See Also:
- Constant Field Values
-
ENGLISH_HORN
public static final int ENGLISH_HORN
The instrument English Horn.- See Also:
- Constant Field Values
-
BASSOON
public static final int BASSOON
The instrument Bassoon.- See Also:
- Constant Field Values
-
CLARINET
public static final int CLARINET
The instrument Clarinet.- See Also:
- Constant Field Values
-
PICCOLO
public static final int PICCOLO
The instrument Piccolo.- See Also:
- Constant Field Values
-
FLUTE
public static final int FLUTE
The instrument Flute.- See Also:
- Constant Field Values
-
RECORDER
public static final int RECORDER
The instrument Recorder.- See Also:
- Constant Field Values
-
PAN_FLUTE
public static final int PAN_FLUTE
The instrument Pan Flute.- See Also:
- Constant Field Values
-
BOTTLE_CHIFF
public static final int BOTTLE_CHIFF
The instrument Bottle Chiff.- See Also:
- Constant Field Values
-
SHAKUHACHI
public static final int SHAKUHACHI
The instrument Shakuhachi.- See Also:
- Constant Field Values
-
WHISTLE
public static final int WHISTLE
The instrument Whistle.- See Also:
- Constant Field Values
-
OCARINA
public static final int OCARINA
The instrument Ocarina.- See Also:
- Constant Field Values
-
SQUARE_LEAD
public static final int SQUARE_LEAD
The instrument Square Lead.- See Also:
- Constant Field Values
-
SAW_WAVE
public static final int SAW_WAVE
The instrument Saw Wave.- See Also:
- Constant Field Values
-
CALLIOPE_LEAD
public static final int CALLIOPE_LEAD
The instrument Calliope Lead.- See Also:
- Constant Field Values
-
CHIFFER_LEAD
public static final int CHIFFER_LEAD
The instrument Chiffer Lead.- See Also:
- Constant Field Values
-
CHARANG
public static final int CHARANG
The instrument Charang.- See Also:
- Constant Field Values
-
SOLO_VOX
public static final int SOLO_VOX
The instrument Solo Vox.- See Also:
- Constant Field Values
-
FIFTH_SAWTOOTH_WAVE
public static final int FIFTH_SAWTOOTH_WAVE
The instrument Fifth Sawtooth Wave.- See Also:
- Constant Field Values
-
BASS_AND_LEAD
public static final int BASS_AND_LEAD
The instrument Bass and Lead.- See Also:
- Constant Field Values
-
FANTASIA
public static final int FANTASIA
The instrument Fantasia.- See Also:
- Constant Field Values
-
WARM_PAD
public static final int WARM_PAD
The instrument Warm Pad.- See Also:
- Constant Field Values
-
POLYSYNTH
public static final int POLYSYNTH
The instrument Polysynth.- See Also:
- Constant Field Values
-
SPACE_VOICE
public static final int SPACE_VOICE
The instrument Space Voice.- See Also:
- Constant Field Values
-
BOWED_GLASS
public static final int BOWED_GLASS
The instrument Bowed Glass.- See Also:
- Constant Field Values
-
METAL_PAD
public static final int METAL_PAD
The instrument Metal Pad.- See Also:
- Constant Field Values
-
HALO_PAD
public static final int HALO_PAD
The instrument Halo Pad.- See Also:
- Constant Field Values
-
SWEEP_PAD
public static final int SWEEP_PAD
The instrument Sweep Pad.- See Also:
- Constant Field Values
-
ICE_RAIN
public static final int ICE_RAIN
The instrument Ice Rain.- See Also:
- Constant Field Values
-
SOUNDTRACK
public static final int SOUNDTRACK
The instrument Soundtrack.- See Also:
- Constant Field Values
-
CRYSTAL
public static final int CRYSTAL
The instrument Crystal.- See Also:
- Constant Field Values
-
ATMOSPHERE
public static final int ATMOSPHERE
The instrument Atmosphere.- See Also:
- Constant Field Values
-
BRIGHTNESS
public static final int BRIGHTNESS
The instrument Brightness.- See Also:
- Constant Field Values
-
GOBLIN
public static final int GOBLIN
The instrument Goblin.- See Also:
- Constant Field Values
-
ECHO_DROPS
public static final int ECHO_DROPS
The instrument Echo Drops.- See Also:
- Constant Field Values
-
STAR_THEME
public static final int STAR_THEME
The instrument Star Theme.- See Also:
- Constant Field Values
-
SITAR
public static final int SITAR
The instrument Sitar.- See Also:
- Constant Field Values
-
BANJO
public static final int BANJO
The instrument Banjo.- See Also:
- Constant Field Values
-
SHAMISEN
public static final int SHAMISEN
The instrument Shamisen.- See Also:
- Constant Field Values
-
KOTO
public static final int KOTO
The instrument Koto.- See Also:
- Constant Field Values
-
KALIMBA
public static final int KALIMBA
The instrument Kalimba.- See Also:
- Constant Field Values
-
BAGPIPE
public static final int BAGPIPE
The instrument Bagpipe.- See Also:
- Constant Field Values
-
FIDDLE
public static final int FIDDLE
The instrument Fiddle.- See Also:
- Constant Field Values
-
SHEHNAI
public static final int SHEHNAI
The instrument Shehnai.- See Also:
- Constant Field Values
-
TINKLE_BELL
public static final int TINKLE_BELL
The instrument Tinkle Bell.- See Also:
- Constant Field Values
-
AGOGÔ
public static final int AGOGÔ
The instrument Agogô.- See Also:
- Constant Field Values
-
STEEL_DRUMS
public static final int STEEL_DRUMS
The instrument Steel Drums.- See Also:
- Constant Field Values
-
WOODBLOCK
public static final int WOODBLOCK
The instrument Woodblock.- See Also:
- Constant Field Values
-
TAIKO_DRUM
public static final int TAIKO_DRUM
The instrument Taiko Drum.- See Also:
- Constant Field Values
-
MELODIC_TOM
public static final int MELODIC_TOM
The instrument Melodic Tom.- See Also:
- Constant Field Values
-
SYNTH_DRUM
public static final int SYNTH_DRUM
The instrument Synth Drum.- See Also:
- Constant Field Values
-
REVERSE_CYMBAL
public static final int REVERSE_CYMBAL
The instrument Reverse Cymbal.- See Also:
- Constant Field Values
-
FRET_NOISE
public static final int FRET_NOISE
The instrument Fret Noise.- See Also:
- Constant Field Values
-
BREATH_NOISE
public static final int BREATH_NOISE
The instrument Breath Noise.- See Also:
- Constant Field Values
-
SEA_SHORE
public static final int SEA_SHORE
The instrument Sea Shore.- See Also:
- Constant Field Values
-
BIRD_TWEET
public static final int BIRD_TWEET
The instrument Bird Tweet.- See Also:
- Constant Field Values
-
TELEPHONE
public static final int TELEPHONE
The instrument Telephone.- See Also:
- Constant Field Values
-
HELICOPTER
public static final int HELICOPTER
The instrument Helicopter.- See Also:
- Constant Field Values
-
APPLAUSE
public static final int APPLAUSE
The instrument Applause.- See Also:
- Constant Field Values
-
GUNSHOT
public static final int GUNSHOT
The instrument Gunshot.- See Also:
- Constant Field Values
-
ACOUSTIC_BASS_DRUM
public static final int ACOUSTIC_BASS_DRUM
The percussion instrument Acoustic Bass Drum.- See Also:
- Constant Field Values
-
ELECTRIC_BASS_DRUM
public static final int ELECTRIC_BASS_DRUM
The percussion instrument Electric Bass Drum.- See Also:
- Constant Field Values
-
SIDE_STICK
public static final int SIDE_STICK
The percussion instrument Side Stick.- See Also:
- Constant Field Values
-
ACOUSTIC_SNARE
public static final int ACOUSTIC_SNARE
The percussion instrument Acoustic Snare.- See Also:
- Constant Field Values
-
HAND_CLAP
public static final int HAND_CLAP
The percussion instrument Hand Clap.- See Also:
- Constant Field Values
-
ELECTRIC_SNARE
public static final int ELECTRIC_SNARE
The percussion instrument Electric Snare.- See Also:
- Constant Field Values
-
LOW_FLOOR_TOM
public static final int LOW_FLOOR_TOM
The percussion instrument Low Floor Tom.- See Also:
- Constant Field Values
-
CLOSED_HI_HAT
public static final int CLOSED_HI_HAT
The percussion instrument Closed Hi Hat.- See Also:
- Constant Field Values
-
HIGH_FLOOR_TOM
public static final int HIGH_FLOOR_TOM
The percussion instrument High Floor Tom.- See Also:
- Constant Field Values
-
PEDAL_HI_HAT
public static final int PEDAL_HI_HAT
The percussion instrument Pedal Hi Hat.- See Also:
- Constant Field Values
-
LOW_TOM
public static final int LOW_TOM
The percussion instrument Low Tom.- See Also:
- Constant Field Values
-
OPEN_HI_HAT
public static final int OPEN_HI_HAT
The percussion instrument Open Hi Hat.- See Also:
- Constant Field Values
-
LOW_MID_TOM
public static final int LOW_MID_TOM
The percussion instrument Low Mid Tom.- See Also:
- Constant Field Values
-
HIGH_MID_TOM
public static final int HIGH_MID_TOM
The percussion instrument High Mid Tom.- See Also:
- Constant Field Values
-
CRASH_CYMBAL_1
public static final int CRASH_CYMBAL_1
The percussion instrument Crash Cymbal 1.- See Also:
- Constant Field Values
-
HIGH_TOM
public static final int HIGH_TOM
The percussion instrument High Tom.- See Also:
- Constant Field Values
-
RIDE_CYMBAL_1
public static final int RIDE_CYMBAL_1
The percussion instrument Ride Cymbal 1.- See Also:
- Constant Field Values
-
CHINESE_CYMBAL
public static final int CHINESE_CYMBAL
The percussion instrument Chinese Cymbal.- See Also:
- Constant Field Values
-
RIDE_BELL
public static final int RIDE_BELL
The percussion instrument Ride Bell.- See Also:
- Constant Field Values
-
TAMBOURINE
public static final int TAMBOURINE
The percussion instrument Tambourine.- See Also:
- Constant Field Values
-
SPLASH_CYMBAL
public static final int SPLASH_CYMBAL
The percussion instrument Splash Cymbal.- See Also:
- Constant Field Values
-
COWBELL
public static final int COWBELL
The percussion instrument Cowbell.- See Also:
- Constant Field Values
-
CRASH_CYMBAL_2
public static final int CRASH_CYMBAL_2
The percussion instrument Crash Cymbal 2.- See Also:
- Constant Field Values
-
VIBRASLAP
public static final int VIBRASLAP
The percussion instrument Vibraslap.- See Also:
- Constant Field Values
-
RIDE_CYMBAL_2
public static final int RIDE_CYMBAL_2
The percussion instrument Ride Cymbal 2.- See Also:
- Constant Field Values
-
HIGH_BONGO
public static final int HIGH_BONGO
The percussion instrument High Bongo.- See Also:
- Constant Field Values
-
LOW_BONGO
public static final int LOW_BONGO
The percussion instrument Low Bongo.- See Also:
- Constant Field Values
-
MUTE_HI_CONGA
public static final int MUTE_HI_CONGA
The percussion instrument Mute Hi Conga.- See Also:
- Constant Field Values
-
OPEN_HI_CONGA
public static final int OPEN_HI_CONGA
The percussion instrument Open Hi Conga.- See Also:
- Constant Field Values
-
LOW_CONGA
public static final int LOW_CONGA
The percussion instrument Low Conga.- See Also:
- Constant Field Values
-
HIGH_TIMBALE
public static final int HIGH_TIMBALE
The percussion instrument High Timbale.- See Also:
- Constant Field Values
-
LOW_TIMBALE
public static final int LOW_TIMBALE
The percussion instrument Low Timbale.- See Also:
- Constant Field Values
-
HIGH_AGOGÔ
public static final int HIGH_AGOGÔ
The percussion instrument High Agogô.- See Also:
- Constant Field Values
-
LOW_AGOGÔ
public static final int LOW_AGOGÔ
The percussion instrument Low Agogô.- See Also:
- Constant Field Values
-
CABASA
public static final int CABASA
The percussion instrument Cabasa.- See Also:
- Constant Field Values
-
MARACAS
public static final int MARACAS
The percussion instrument Maracas.- See Also:
- Constant Field Values
-
SHORT_WHISTLE
public static final int SHORT_WHISTLE
The percussion instrument Short Whistle.- See Also:
- Constant Field Values
-
LONG_WHISTLE
public static final int LONG_WHISTLE
The percussion instrument Long Whistle.- See Also:
- Constant Field Values
-
SHORT_GUIRO
public static final int SHORT_GUIRO
The percussion instrument Short Guiro.- See Also:
- Constant Field Values
-
LONG_GUIRO
public static final int LONG_GUIRO
The percussion instrument Long Guiro.- See Also:
- Constant Field Values
-
CLAVES
public static final int CLAVES
The percussion instrument Claves.- See Also:
- Constant Field Values
-
HIGH_WOODBLOCK
public static final int HIGH_WOODBLOCK
The percussion instrument High Woodblock.- See Also:
- Constant Field Values
-
LOW_WOODBLOCK
public static final int LOW_WOODBLOCK
The percussion instrument Low Woodblock.- See Also:
- Constant Field Values
-
MUTE_CUICA
public static final int MUTE_CUICA
The percussion instrument Mute Cuica.- See Also:
- Constant Field Values
-
OPEN_CUICA
public static final int OPEN_CUICA
The percussion instrument Open Cuica.- See Also:
- Constant Field Values
-
MUTE_TRIANGLE
public static final int MUTE_TRIANGLE
The percussion instrument Mute Triangle.- See Also:
- Constant Field Values
-
OPEN_TRIANGLE
public static final int OPEN_TRIANGLE
The percussion instrument Open Triangle.- See Also:
- Constant Field Values
-
-
Method Detail
-
setInstrument
public static void setInstrument(int instrument)
Sets the MIDI instrument to the specified value. For example 1 corresponds to an acoustic grand piano and 39 corresponds to a synthetic bass. You can specify the instrument numbers using predefined constants, such asStdMidi.ACOUSTIC_GRAND_PIANO
andStdMidi.SYNTH_BASS_1
.- Parameters:
instrument
- the integer corresponding to the MIDI instrument- Throws:
IllegalArgumentException
- unlessinstrument
is between 1 and 128
-
getInstrument
public static int getInstrument()
Returns the MIDI instrument number (between 1 and 128).- Returns:
- the integer corresponding to the MIDI instrument
-
setVelocity
public static void setVelocity(int val)
Sets the velocity to the specified value between 0 (silent) and 127 (loudest). The key-down velocity indicates the force with which a note is played. It controls the note's volume and/or brightness.- Parameters:
val
- the velocity of the note- Throws:
IllegalArgumentException
- unlessvelocity
is between 0 and 127
-
setTempo
public static void setTempo(int beatsPerMinute)
Sets the tempo to the specified number of beats per minute.- Parameters:
beatsPerMinute
- the number of beats per minute- Throws:
IllegalArgumentException
- unlessbeatsPerMinute
is a positive integer
-
playNote
public static void playNote(int note, double beats)
Plays the specified note for the given duration (measured in beats). Uses the current instrument, velocity, and tempo. The callplayNote(note, beats)
is equivalent to the sequence of callsnoteOn(note)
,pause(beats)
, andnoteOff(note)
.- Parameters:
note
- the MIDI note number (between 0 and 127)beats
- the duration, measured in beats (quarter note = 1 beat)- Throws:
IllegalArgumentException
- unlessnote
is between 0 and 127IllegalArgumentException
- unlessbeats
is non-negative
-
noteOn
public static void noteOn(int note)
Turns the specified note on.- Parameters:
note
- the MIDI note number (between 0 and 127)- Throws:
IllegalArgumentException
- unlessnote
is between 0 and 127
-
noteOff
public static void noteOff(int note)
Turns the specified note off.- Parameters:
note
- the MIDI note number (between 0 and 127)- Throws:
IllegalArgumentException
- unlessnote
is between 0 and 127
-
pause
public static void pause(double beats)
Pauses for the specified duration. The duration is measured in beats, where a quarter note is one beat.- Parameters:
beats
- the duration, measured in beats (quarter note = 1 beat)- Throws:
IllegalArgumentException
- unlessbeats
is non-negative
-
playNotes
public static void playNotes(int[] notes, double beats)
Plays the specified notes for the given duration (measured in beats). All notes must have the same duration. Uses the current instrument, velocity, and tempo.- Parameters:
notes
- the MIDI note numbers (between 0 and 127)beats
- the duration, measured in beats (quarter note = 1 beat)- Throws:
IllegalArgumentException
- unlessnote
is between 0 and 127IllegalArgumentException
- unlessbeats
is non-negative
-
playPercussion
public static void playPercussion(int instrument, double beats)
Plays the specified percussion instrument for the given duration (measured in beats). Uses the current velocity and tempo.- Parameters:
instrument
- the MIDI percussion instrument number (between 35 and 81)beats
- the duration, measured in beats (quarter note = 1 beat)- Throws:
IllegalArgumentException
- unlessinstrument
is between 35 and 81IllegalArgumentException
- unlessbeats
is non-negative
-
percussionOn
public static void percussionOn(int instrument)
-
percussionOn
public static void percussionOn(int instrument, int velocity)
-
percussionOff
public static void percussionOff(int instrument)
-
allNotesOff
public static void allNotesOff()
Turns all notes off, but allows decaying notes to complete.
-
allSoundOff
public static void allSoundOff()
Turns all notes off immediately.
-
play
public static void play(String filename)
Plays the specified MIDI file and waits until the audio file finishes playing before continuing.- Parameters:
filename
- the name of the MIDI file- Throws:
IllegalArgumentException
- iffilename
isnull
IllegalArgumentException
- iffilename
is not a MIDI fileIllegalArgumentException
- iffilename
cannot be read
-
playInBackground
public static void playInBackground(String filename)
Plays the specified MIDI file in a background thread. It is possible to play multiple MIDI files at the same time, e.g., a background musical score and sound effects.- Parameters:
filename
- the name of the MIDI file- Throws:
IllegalArgumentException
- iffilename
isnull
IllegalArgumentException
- iffilename
is not a MIDI fileIllegalArgumentException
- iffilename
cannot be read
-
save
public static void save(String filename)
Saves the sequence of notes to the specified MIDI file. The file extension must be.mid
or.midi
.- Parameters:
filename
- the filename- Throws:
IllegalArgumentException
- iffilename
isnull
IllegalArgumentException
- iffilename
is the empty stringIllegalArgumentException
- iffilename
has wrong extensionIllegalArgumentException
- iffilename
cannot be written
-
main
public static void main(String[] args)
Test client - plays the first few notes from Axel F by Harold Faltermeyer.- Parameters:
args
- the command-line arguments (none should be specified)
-
-