Class StdMidi
- Object
-
- StdMidi
-
public class StdMidi extends Object
TheStdMidiclass 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.StdMidiis 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
StdMidiin your Java classpath. Here are three possible ways to do this:- If you ran our autoinstaller, use the commands
javac-introcsandjava-introcs(orjavac-algs4andjava-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.RESTcorresponds 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
percussionInstrumentis 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
StdMidiclass 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
instrumentargument 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). TheStdMidiclass provides pre-defined constants for these instruments, such asStdMidi.ACOUSTIC_GRAND_PIANOandStdMidi.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). Thefilenamemust have the extension.midor.midi.Saving MIDI files. You can use the following method to save the sequence of notes to a MIDI file:
The
filenamemust have the extension.midor.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.sf2and 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 intA_1The note A in octave -1.static intA0The note A in octave 0.static intA1The note A in octave 1.static intA2The note A in octave 2.static intA3The note A in octave 3.static intA4The note A in octave 4.static intA5The note A in octave 5.static intA6The note A in octave 6.static intA7The note A in octave 7.static intA8The note A in octave 8.static intACCORDIONThe instrument Accordion.static intACOUSTIC_BASSThe instrument Acoustic Bass.static intACOUSTIC_BASS_DRUMThe percussion instrument Acoustic Bass Drum.static intACOUSTIC_GRAND_PIANOThe instrument Acoustic Grand Piano.static intACOUSTIC_SNAREThe percussion instrument Acoustic Snare.static intADAGIETTOThe tempo adagietto (74 beats per minute).static intADAGIOThe tempo adagio (70 beats per minute).static intAF_1The note A♭ in octave -1.static intAF0The note A♭ in octave 0.static intAF1The note A♭ in octave 1.static intAF2The note A♭ in octave 2.static intAF3The note A♭ in octave 3.static intAF4The note A♭ in octave 4.static intAF5The note A♭ in octave 5.static intAF6The note A♭ in octave 6.static intAF7The note A♭ in octave 7.static intAF8The note A♭ in octave 8.static intAGOGÔThe instrument Agogô.static intAHH_CHOIRThe instrument Ahh Choir.static intALLEGROThe tempo allegro (140 beats per minute).static intALTO_SAXThe instrument Alto Sax.static intANDANTEThe tempo andante (90 beats per minute).static intANDANTINOThe tempo andantino (96 beats per minute).static intAPPLAUSEThe instrument Applause.static intAS_1The note A♯ in octave -1.static intAS0The note A♯ in octave 0.static intAS1The note A♯ in octave 1.static intAS2The note A♯ in octave 2.static intAS3The note A♯ in octave 3.static intAS4The note A♯ in octave 4.static intAS5The note A♯ in octave 5.static intAS6The note A♯ in octave 6.static intAS7The note A♯ in octave 7.static intAS8The note A♯ in octave 8.static intATMOSPHEREThe instrument Atmosphere.static intB_1The note B in octave -1.static intB0The note B in octave 0.static intB1The note B in octave 1.static intB2The note B in octave 2.static intB3The note B in octave 3.static intB4The note B in octave 4.static intB5The note B in octave 5.static intB6The note B in octave 6.static intB7The note B in octave 7.static intB8The note B in octave 8.static intBAGPIPEThe instrument Bagpipe.static intBANDONEONThe instrument Bandoneon.static intBANJOThe instrument Banjo.static intBARITONE_SAXThe instrument Baritone Sax.static intBASS_AND_LEADThe instrument Bass and Lead.static intBASSOONThe instrument Bassoon.static intBF_1The note B♭ in octave -1.static intBF0The note B♭ in octave 0.static intBF1The note B♭ in octave 1.static intBF2The note B♭ in octave 2.static intBF3The note B♭ in octave 3.static intBF4The note B♭ in octave 4.static intBF5The note B♭ in octave 5.static intBF6The note B♭ in octave 6.static intBF7The note B♭ in octave 7.static intBF8The note B♭ in octave 8.static intBIRD_TWEETThe instrument Bird Tweet.static intBOTTLE_CHIFFThe instrument Bottle Chiff.static intBOWED_GLASSThe instrument Bowed Glass.static intBRASS_SECTIONThe instrument Brass Section.static intBREATH_NOISEThe instrument Breath Noise.static intBRIGHT_ACOUSTIC_PIANOThe instrument Bright Acoustic Piano.static intBRIGHTNESSThe instrument Brightness.static intC_1The note C in octave -1.static intC0The note C in octave 0.static intC1The note C in octave 1.static intC2The note C in octave 2.static intC3The note C in octave 3.static intC4The note C in octave 4.static intC5The note C in octave 5.static intC6The note C in octave 6.static intC7The note C in octave 7.static intC8The note C in octave 8.static intC9The note C in octave 9.static intCABASAThe percussion instrument Cabasa.static intCALLIOPE_LEADThe instrument Calliope Lead.static intCELESTAThe instrument Celesta.static intCELLOThe instrument Cello.static intCHARANGThe instrument Charang.static intCHIFFER_LEADThe instrument Chiffer Lead.static intCHINESE_CYMBALThe percussion instrument Chinese Cymbal.static intCHURCH_ORGANThe instrument Church Organ.static intCLARINETThe instrument Clarinet.static intCLAVESThe percussion instrument Claves.static intCLAVINETThe instrument Clavinet.static intCLEAN_GUITARThe instrument Clean Guitar.static intCLOSED_HI_HATThe percussion instrument Closed Hi Hat.static intCONCERT_AThe note A in octave 4, also known as Concert A and A440.static intCONTRABASSThe instrument Contrabass.static intCOWBELLThe percussion instrument Cowbell.static intCRASH_CYMBAL_1The percussion instrument Crash Cymbal 1.static intCRASH_CYMBAL_2The percussion instrument Crash Cymbal 2.static intCRYSTALThe instrument Crystal.static intCS_1The note C♯ in octave -1.static intCS0The note C♯ in octave 0.static intCS1The note C♯ in octave 1.static intCS2The note C♯ in octave 2.static intCS3The note C♯ in octave 3.static intCS4The note C♯ in octave 4.static intCS5The note C♯ in octave 5.static intCS6The note C♯ in octave 6.static intCS7The note C♯ in octave 7.static intCS8The note C♯ in octave 8.static intCS9The note C♯ in octave 9.static intD_1The note D in octave -1.static intD0The note D in octave 0.static intD1The note D in octave 1.static intD2The note D in octave 2.static intD3The note D in octave 3.static intD4The note D in octave 4.static intD5The note D in octave 5.static intD6The note D in octave 6.static intD7The note D in octave 7.static intD8The note D in octave 8.static intD9The note D in octave 9.static doubleDDENThe duration of a double dotted eighth note (7/8 beat).static doubleDDHNThe duration of a double dotted half note (7/2 beats).static doubleDDQNThe duration of a double dotted quarter note (7/4 beats).static intDEFAULT_INSTRUMENTThe default MIDI instrument (Acoustic Grand Piano).static intDEFAULT_TEMPOThe default MIDI tempo (120 beats per minute).static intDEFAULT_VELOCITYThe default MIDI velocity (96).static doubleDENThe duration of a double dotted eighth note (3/4 beats).static intDF_1The note D♭ in octave -1.static intDF0The note D♭ in octave 0.static intDF1The note D♭ in octave 1.static intDF2The note D♭ in octave 2.static intDF3The note D♭ in octave 3.static intDF4The note D♭ in octave 4.static intDF5The note D♭ in octave 5.static intDF6The note D♭ in octave 6.static intDF7The note D♭ in octave 7.static intDF8The note D♭ in octave 8.static intDF9The note D♭ in octave 9.static doubleDHNThe duration of a dotted half note (3 beats).static intDISTORTION_GUITARThe instrument Distortion Guitar.static doubleDOTTED_EIGHTH_NOTEThe duration of a double dotted eighth note (3/4 beats).static doubleDOTTED_HALF_NOTEThe duration of a dotted half note (3 beats).static doubleDOTTED_QUARTER_NOTEThe duration of a dotted quarter note (3/2 beats).static doubleDOTTED_SIXTEENTH_NOTEThe duration of a dotted sixteenth note (3/8 beat).static doubleDOUBLE_DOTTED_EIGHTH_NOTEThe duration of a double dotted eighth note (7/8 beat).static doubleDOUBLE_DOTTED_HALF_NOTEThe duration of a double dotted half note (7/2 beats).static doubleDOUBLE_DOTTED_QUARTER_NOTEThe duration of a double dotted quarter note (7/4 beats).static doubleDQNThe duration of a dotted quarter note (3/2 beats).static intDRAWBAR_ORGANThe instrument Drawbar Organ.static intDS_1The note D♯ in octave -1.static intDS0The note D♯ in octave 0.static intDS1The note D♯ in octave 1.static intDS2The note D♯ in octave 2.static intDS3The note D♯ in octave 3.static intDS4The note D♯ in octave 4.static intDS5The note D♯ in octave 5.static intDS6The note D♯ in octave 6.static intDS7The note D♯ in octave 7.static intDS8The note D♯ in octave 8.static intDS9The note D♯ in octave 9.static doubleDSNThe duration of a dotted sixteenth note (3/8 beat).static intDULCIMERThe instrument Dulcimer.static intE_1The note E in octave -1.static intE0The note E in octave 0.static intE1The note E in octave 1.static intE2The note E in octave 2.static intE3The note E in octave 3.static intE4The note E in octave 4.static intE5The note E in octave 5.static intE6The note E in octave 6.static intE7The note E in octave 7.static intE8The note E in octave 8.static intE9The note E in octave 9.static intECHO_DROPSThe instrument Echo Drops.static intEF_1The note E♭ in octave -1.static intEF0The note E♭ in octave 0.static intEF1The note E♭ in octave 1.static intEF2The note E♭ in octave 2.static intEF3The note E♭ in octave 3.static intEF4The note E♭ in octave 4.static intEF5The note E♭ in octave 5.static intEF6The note E♭ in octave 6.static intEF7The note E♭ in octave 7.static intEF8The note E♭ in octave 8.static intEF9The note E♭ in octave 9.static doubleEIGHTH_NOTEThe duration of an eighth note (1/2 beat).static doubleEIGHTH_NOTE_TRIPLETThe duration of an eighth note triplet (1/3 beat).static intELECTRIC_BASS_DRUMThe percussion instrument Electric Bass Drum.static intELECTRIC_GRAND_PIANOThe instrument Electric Grand Piano.static intELECTRIC_PIANO_1The instrument Electric Piano 1.static intELECTRIC_PIANO_2The instrument Electric Piano 2.static intELECTRIC_SNAREThe percussion instrument Electric Snare.static doubleENThe duration of an eighth note (1/2 beat).static intENGLISH_HORNThe instrument English Horn.static doubleENTThe duration of an eighth note triplet (1/3 beat).static intF_1The note F in octave -1.static intF0The note F in octave 0.static intF1The note F in octave 1.static intF2The note F in octave 2.static intF3The note F in octave 3.static intF4The note F in octave 4.static intF5The note F in octave 5.static intF6The note F in octave 6.static intF7The note F in octave 7.static intF8The note F in octave 8.static intF9The note F in octave 9.static intFANTASIAThe instrument Fantasia.static intFIDDLEThe instrument Fiddle.static intFIFTH_SAWTOOTH_WAVEThe instrument Fifth Sawtooth Wave.static intFINGERED_BASSThe instrument Fingered Bass.static intFLUTEThe instrument Flute.static intFORTEThe velocity forte (85).static intFORTISSIMOThe velocity fortissimo (100).static intFORTISSISSIMOThe velocity fortississimo (120).static intFRENCH_HORNThe instrument French Horn.static intFRET_NOISEThe instrument Fret Noise.static intFRETLESS_BASSThe instrument Fretless Bass.static intFS_1The note F♯ in octave -1.static intFS0The note F♯ in octave 0.static intFS1The note F♯ in octave 1.static intFS2The note F♯ in octave 2.static intFS3The note F♯ in octave 3.static intFS4The note F♯ in octave 4.static intFS5The note F♯ in octave 5.static intFS6The note F♯ in octave 6.static intFS7The note F♯ in octave 7.static intFS8The note F♯ in octave 8.static intFS9The note F♯ in octave 9.static intG_1The note G in octave -1.static intG0The note G in octave 0.static intG1The note G in octave 1.static intG2The note G in octave 2.static intG3The note G in octave 3.static intG4The note G in octave 4.static intG5The note G in octave 5.static intG6The note G in octave 6.static intG7The note G in octave 7.static intG8The note G in octave 8.static intG9The note G in octave 9.static intGF_1The note G♭ in octave -1.static intGF0The note G♭ in octave 0.static intGF1The note G♭ in octave 1.static intGF2The note G♭ in octave 2.static intGF3The note G♭ in octave 3.static intGF4The note G♭ in octave 4.static intGF5The note G♭ in octave 5.static intGF6The note G♭ in octave 6.static intGF7The note G♭ in octave 7.static intGF8The note G♭ in octave 8.static intGF9The note G♭ in octave 9.static intGLOCKENSPIELThe instrument Glockenspiel.static intGOBLINThe instrument Goblin.static intGRAVEThe tempo grave (40 beats per minute).static intGS_1The note G♯ in octave -1.static intGS0The note G♯ in octave 0.static intGS1The note G♯ in octave 1.static intGS2The note G♯ in octave 2.static intGS3The note G♯ in octave 3.static intGS4The note G♯ in octave 4.static intGS5The note G♯ in octave 5.static intGS6The note G♯ in octave 6.static intGS7The note G♯ in octave 7.static intGS8The note G♯ in octave 8.static intGUITAR_HARMONICSThe instrument Guitar Harmonics.static intGUNSHOTThe instrument Gunshot.static doubleHALF_NOTEThe duration of a half note (2 beats).static doubleHALF_NOTE_TRIPLETThe duration of a half note triplet (4/3 beats).static intHALO_PADThe instrument Halo Pad.static intHAND_CLAPThe percussion instrument Hand Clap.static intHARMONICAThe instrument Harmonica.static intHARPThe instrument Harp.static intHARPSICHORDThe instrument Harpsichord.static intHELICOPTERThe instrument Helicopter.static intHIGH_AGOGÔThe percussion instrument High Agogô.static intHIGH_BONGOThe percussion instrument High Bongo.static intHIGH_FLOOR_TOMThe percussion instrument High Floor Tom.static intHIGH_MID_TOMThe percussion instrument High Mid Tom.static intHIGH_TIMBALEThe percussion instrument High Timbale.static intHIGH_TOMThe percussion instrument High Tom.static intHIGH_WOODBLOCKThe percussion instrument High Woodblock.static doubleHNThe duration of a half note (2 beats).static doubleHNTThe duration of a half note triplet (4/3 beats).static intHONKY_TONK_PIANOThe instrument Honky Tonk Piano.static intICE_RAINThe instrument Ice Rain.static intJAZZ_GUITARThe instrument Jazz Guitar.static intKALIMBAThe instrument Kalimba.static intKOTOThe instrument Koto.static intLARGHETTOThe tempo larghetto (60 beats per minute).static intLARGHISSIMOThe tempo larghissimo (20 beats per minute).static intLARGOThe tempo largo (50 beats per minute).static intLONG_GUIROThe percussion instrument Long Guiro.static intLONG_WHISTLEThe percussion instrument Long Whistle.static intLOW_AGOGÔThe percussion instrument Low Agogô.static intLOW_BONGOThe percussion instrument Low Bongo.static intLOW_CONGAThe percussion instrument Low Conga.static intLOW_FLOOR_TOMThe percussion instrument Low Floor Tom.static intLOW_MID_TOMThe percussion instrument Low Mid Tom.static intLOW_TIMBALEThe percussion instrument Low Timbale.static intLOW_TOMThe percussion instrument Low Tom.static intLOW_WOODBLOCKThe percussion instrument Low Woodblock.static intMARACASThe percussion instrument Maracas.static intMARIMBAThe instrument Marimba.static intMELODIC_TOMThe instrument Melodic Tom.static intMETAL_PADThe instrument Metal Pad.static intMEZZO_FORTEThe velocity mezzo forte (70).static intMEZZO_PIANOThe velocity mezzo piano (60).static intMIDDLE_CThe note C in octave 4, also known as Middle C.static intMODERATOThe tempo moderato (110 beats per minute).static intMUSIC_BOXThe instrument Music Box.static intMUTE_CUICAThe percussion instrument Mute Cuica.static intMUTE_HI_CONGAThe percussion instrument Mute Hi Conga.static intMUTE_TRIANGLEThe percussion instrument Mute Triangle.static intMUTED_TRUMPETThe instrument Muted Trumpet.static intNYLON_STRING_GUITARThe instrument Nylon String Guitar.static intOBOEThe instrument Oboe.static intOCARINAThe instrument Ocarina.static intOHH_VOICESThe instrument Ohh Voices.static intOPEN_CUICAThe percussion instrument Open Cuica.static intOPEN_HI_CONGAThe percussion instrument Open Hi Conga.static intOPEN_HI_HATThe percussion instrument Open Hi Hat.static intOPEN_TRIANGLEThe percussion instrument Open Triangle.static intORCHESTRA_HITThe instrument Orchestra Hit.static intOVERDRIVE_GUITARThe instrument Overdrive Guitar.static intPALM_MUTED_GUITARThe instrument Palm Muted Guitar.static intPAN_FLUTEThe instrument Pan Flute.static intPEDAL_HI_HATThe percussion instrument Pedal Hi Hat.static intPERCUSSIVE_ORGANThe instrument Percussive Organ.static intPIANISSIMOThe velocity pianissimo (25).static intPIANISSISSIMOThe velocity pianississimo (10).static intPIANOThe velocity piano (50).static intPICCOLOThe instrument Piccolo.static intPICKED_BASSThe instrument Picked Bass.static intPIZZICATO_STRINGSThe instrument Pizzicato Strings.static intPOLYSYNTHThe instrument Polysynth.static intPOP_BASSThe instrument Pop Bass.static intPRESTISSIMOThe tempo prestissimo (200 beats per minute).static intPRESTOThe tempo presto (180 beats per minute).static doubleQNThe duration of a quarter note (1 beat).static doubleQNTThe duration of a quarter note triplet (2/3 beat).static doubleQUARTER_NOTEThe duration of a quarter note (1 beat).static doubleQUARTER_NOTE_TRIPLETThe duration of a quarter note triplet (2/3 beat).static intRECORDERThe instrument Recorder.static intREED_ORGANThe instrument Reed Organ.static intRESTThe note number corresponding to a rest.static intREVERSE_CYMBALThe instrument Reverse Cymbal.static intRIDE_BELLThe percussion instrument Ride Bell.static intRIDE_CYMBAL_1The percussion instrument Ride Cymbal 1.static intRIDE_CYMBAL_2The percussion instrument Ride Cymbal 2.static intROCK_ORGANThe instrument Rock Organ.static intSAW_WAVEThe instrument Saw Wave.static intSEA_SHOREThe instrument Sea Shore.static intSHAKUHACHIThe instrument Shakuhachi.static intSHAMISENThe instrument Shamisen.static intSHEHNAIThe instrument Shehnai.static intSHORT_GUIROThe percussion instrument Short Guiro.static intSHORT_WHISTLEThe percussion instrument Short Whistle.static intSIDE_STICKThe percussion instrument Side Stick.static intSILENTThe velocity 0.static intSITARThe instrument Sitar.static doubleSIXTEENTH_NOTEThe duration of a sixteenth note (1/4 beat).static doubleSIXTEENTH_NOTE_TRIPLETThe duration of a sixteenth note triplet (1/6 beat).static intSLAP_BASSThe instrument Slap Bass.static intSLOW_STRINGSThe instrument Slow Strings.static doubleSNThe duration of a sixteenth note (1/4 beat).static doubleSNTThe duration of a sixteenth note triplet (1/6 beat).static intSOLO_VOXThe instrument Solo Vox.static intSOPRANO_SAXThe instrument Soprano Sax.static intSOUNDTRACKThe instrument Soundtrack.static intSPACE_VOICEThe instrument Space Voice.static intSPLASH_CYMBALThe percussion instrument Splash Cymbal.static intSQUARE_LEADThe instrument Square Lead.static intSTAR_THEMEThe instrument Star Theme.static intSTEEL_DRUMSThe instrument Steel Drums.static intSTEEL_STRING_GUITARThe instrument Steel String Guitar.static intSTRINGSThe instrument Strings.static intSWEEP_PADThe instrument Sweep Pad.static intSYNTH_BASS_1The instrument Synth Bass 1.static intSYNTH_BASS_2The instrument Synth Bass 2.static intSYNTH_BRASS_1The instrument Synth Brass 1.static intSYNTH_BRASS_2The instrument Synth Brass 2.static intSYNTH_DRUMThe instrument Synth Drum.static intSYNTH_STRINGS_1The instrument Synth Strings 1.static intSYNTH_STRINGS_2The instrument Synth Strings 2.static intSYNTH_VOICEThe instrument Synth Voice.static intTAIKO_DRUMThe instrument Taiko Drum.static intTAMBOURINEThe percussion instrument Tambourine.static intTELEPHONEThe instrument Telephone.static intTENOR_SAXThe instrument Tenor Sax.static doubleTHIRTYSECOND_NOTEThe duration of a thirty-second note (1/8 beat).static doubleTHIRTYSECOND_NOTE_TRIPLETThe duration of a thirty-second note triplet (1/12 beat).static intTIMPANIThe instrument Timpani.static intTINKLE_BELLThe instrument Tinkle Bell.static doubleTNThe duration of a thirty-second note (1/8 beat).static doubleTNTThe duration of a thirty-second note (1/8 beat).static intTREMOLO_STRINGSThe instrument Tremolo Strings.static intTROMBONEThe instrument Trombone.static intTRUMPETThe instrument Trumpet.static intTUBAThe instrument Tuba.static intTUBULAR_BELLSThe instrument Tubular Bells.static intVIBRAPHONEThe instrument Vibraphone.static intVIBRASLAPThe percussion instrument Vibraslap.static intVIOLAThe instrument Viola.static intVIOLINThe instrument Violin.static intVIVACEThe tempo vivace (166 beats per minute).static intVIVACISSIMOThe tempo vivacissimo (174 beats per minute).static intWARM_PADThe instrument Warm Pad.static intWHISTLEThe instrument Whistle.static doubleWHOLE_NOTEThe duration of a whole note (4 beats).static doubleWNThe duration of a whole note (4 beats).static intWOODBLOCKThe instrument Woodblock.static intXYLOPHONEThe instrument Xylophone.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidallNotesOff()Turns all notes off, but allows decaying notes to complete.static voidallSoundOff()Turns all notes off immediately.static intgetInstrument()Returns the MIDI instrument number (between 1 and 128).static voidmain(String[] args)Test client - plays the first few notes from Axel F by Harold Faltermeyer.static voidnoteOff(int note)Turns the specified note off.static voidnoteOn(int note)Turns the specified note on.static voidpause(double beats)Pauses for the specified duration.static voidpercussionOff(int instrument)static voidpercussionOn(int instrument)static voidpercussionOn(int instrument, int velocity)static voidplay(String filename)Plays the specified MIDI file and waits until the audio file finishes playing before continuing.static voidplayInBackground(String filename)Plays the specified MIDI file in a background thread.static voidplayNote(int note, double beats)Plays the specified note for the given duration (measured in beats).static voidplayNotes(int[] notes, double beats)Plays the specified notes for the given duration (measured in beats).static voidplayPercussion(int instrument, double beats)Plays the specified percussion instrument for the given duration (measured in beats).static voidsave(String filename)Saves the sequence of notes to the specified MIDI file.static voidsetInstrument(int instrument)Sets the MIDI instrument to the specified value.static voidsetTempo(int beatsPerMinute)Sets the tempo to the specified number of beats per minute.static voidsetVelocity(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_PIANOandStdMidi.SYNTH_BASS_1.- Parameters:
instrument- the integer corresponding to the MIDI instrument- Throws:
IllegalArgumentException- unlessinstrumentis 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- unlessvelocityis 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- unlessbeatsPerMinuteis 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- unlessnoteis between 0 and 127IllegalArgumentException- unlessbeatsis 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- unlessnoteis 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- unlessnoteis 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- unlessbeatsis 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- unlessnoteis between 0 and 127IllegalArgumentException- unlessbeatsis 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- unlessinstrumentis between 35 and 81IllegalArgumentException- unlessbeatsis 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- iffilenameisnullIllegalArgumentException- iffilenameis not a MIDI fileIllegalArgumentException- iffilenamecannot 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- iffilenameisnullIllegalArgumentException- iffilenameis not a MIDI fileIllegalArgumentException- iffilenamecannot be read
-
save
public static void save(String filename)
Saves the sequence of notes to the specified MIDI file. The file extension must be.midor.midi.- Parameters:
filename- the filename- Throws:
IllegalArgumentException- iffilenameisnullIllegalArgumentException- iffilenameis the empty stringIllegalArgumentException- iffilenamehas wrong extensionIllegalArgumentException- iffilenamecannot 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)
-
-