|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object world.sound.tunes.Note
public class Note
Represents a single note which includes a pitch and duration. Notes may be created/converted to and from a String representation that includes the name, octave, modifier, and duration, where:
As an example, "C6n4" represents a C natural, in the 6th octave (Note 72), that will play for 4 beats
Based in part on a class originally designed by Viera K. Proulx.
Constructor Summary | |
---|---|
Note(int pitch)
Create a Note with the given MIDI pitch, with a default duration of 1 and a default velocity. |
|
Note(int pitch,
int duration)
Create a Note with the given MIDI pitch and duration, and the default velocity. |
|
Note(int pitch,
int duration,
int velocity)
Create a Note with the given MIDI pitch, duration, and velocity. |
|
Note(java.lang.String snote)
Create a Note from the description given as a String, and the default velocity. |
|
Note(java.lang.String snote,
int velocity)
Create a Note from the description given as a String. |
Method Summary | |
---|---|
static int |
computePitch(char noteName,
int octave,
char modifier)
Compute the MIDI pitch of the given note name, octave, and modifier. |
Note |
copy()
Make a copy of this Note. |
int |
getDuration()
Get the Duration of this Note. |
int |
getPitch()
Get the Pitch of this Note. |
int |
getVelocity()
Get the Velocity of this Note. |
boolean |
isSilent()
Has this note completed its duration? |
void |
nextBeat()
Decrement the duration of this Note. |
boolean |
sameNote(Note that)
Does the given Note represent the same Note as this one? |
void |
skipBeat()
Increment the duration of this Note. |
java.lang.String |
toString()
Produce a Human readable String representation of this Note. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Note(int pitch)
public Note(int pitch, int duration)
public Note(int pitch, int duration, int velocity)
public Note(java.lang.String snote)
public Note(java.lang.String snote, int velocity)
As an example, "C6n4" represents a C natural, in the 6th octave (Note 72), that will play for 4 beats
Method Detail |
---|
public Note copy()
public int getPitch()
public int getDuration()
public int getVelocity()
public boolean sameNote(Note that)
public boolean isSilent()
public void nextBeat()
public void skipBeat()
public java.lang.String toString()
toString
in class java.lang.Object
public static int computePitch(char noteName, int octave, char modifier)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |