|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object MidiPlayer
Class that knows how to play notes using the midi standard Copyright 2004 Georgia Institute of Technology
Field Summary | |
static int |
ALTO_SAX
|
static int |
APPLAUSE
|
static int |
BASS
|
static int |
BIRD
|
static int |
CELLO
|
static int |
CLARINET
|
static int |
FLUTE
|
static int |
FRENCH_HORN
|
static int |
GUITAR
|
static int |
HARMONICA
|
static int |
HARP
|
static int |
HELICOPTER
|
static int |
ICE_CUBE
|
static int |
JAZZ_GUITAR
|
static int |
MUSIC_BOX
|
static int |
OBOE
|
static int |
PIANO
|
static int |
PICCOLO
|
static int |
STEEL_GUITAR
|
static int |
TELEPHONE
|
static int |
TENOR_SAX
|
static int |
TIMPANI
|
static int |
TROMBONE
|
static int |
TRUMPET
|
static int |
TUBA
|
static int |
VIOLIN
|
static int |
WHISTLE
|
static int |
XYLOPHONE
|
Constructor Summary | |
MidiPlayer()
Constructor that takes no arguments |
Method Summary | |
void |
cleanUp()
Method to clean up the midi player |
void |
close()
Method to close the midi player |
void |
getInstrumentNames()
Method to get the map of index number to instrument names |
javax.sound.midi.Synthesizer |
getSynthesizer()
Method to return the synthesizer |
void |
playJingleBells()
Method to play Jingle Bells |
void |
playJingleBells4()
Method to play the first 4 measures of jingle bells with each measure taking 1000 milliseconds (1 second) |
void |
playJingleBellsV1V2()
Method to play the first verse of jingle bells with each measure taking 1000 milliseconds (1 second) It is in 2/4 time |
void |
playNote(int note,
int duration)
Method to play a note |
void |
playNote(int note,
int duration,
int intensity)
Method to play a note |
void |
playNotesOnChannel(int index,
int[] notes,
int[] durations,
int[] intensities)
Method to play an array of notes with the given durations and intensities |
void |
rest(int duration)
Method to rest for a specified number of milliseconds |
void |
setChannel(int index)
Method to change the current channel |
void |
setInstrument(int num)
Method to set the instrument to play |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int PIANO
public static final int HARMONICA
public static final int MUSIC_BOX
public static final int XYLOPHONE
public static final int GUITAR
public static final int STEEL_GUITAR
public static final int JAZZ_GUITAR
public static final int BASS
public static final int VIOLIN
public static final int CELLO
public static final int HARP
public static final int TIMPANI
public static final int TRUMPET
public static final int TROMBONE
public static final int TUBA
public static final int FRENCH_HORN
public static final int ALTO_SAX
public static final int TENOR_SAX
public static final int OBOE
public static final int CLARINET
public static final int PICCOLO
public static final int FLUTE
public static final int WHISTLE
public static final int BIRD
public static final int TELEPHONE
public static final int HELICOPTER
public static final int APPLAUSE
public static final int ICE_CUBE
Constructor Detail |
public MidiPlayer()
Method Detail |
public javax.sound.midi.Synthesizer getSynthesizer()
public void close()
public void cleanUp()
public void playNote(int note, int duration, int intensity)
note
- the note to play (0 to 127, 60 is middle C)duration
- how long to play the note in millisecondsintensity
- how loud to play the note (how hard the key
was struck on a piano)public void rest(int duration)
duration
- the amount to rest in millisecondspublic void setChannel(int index)
index
- the index of the channel to usepublic void setInstrument(int num)
num
- a number from 0 to 127 that represents
the instrumentspublic void getInstrumentNames()
public void playNote(int note, int duration)
note
- the note to playduration
- how long to play the notepublic void playNotesOnChannel(int index, int[] notes, int[] durations, int[] intensities)
index
- the index of the channel to usenotes
- the array of notes to play (0-127)durations
- the array of durations to
use for playing the notes in millisecondsintensities
- the array of intensities (loudness)public void playJingleBellsV1V2()
public void playJingleBells()
public void playJingleBells4()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |