|
|||||||||
| Home >> All >> jm >> music >> [ data overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
jm.music.data
Class Phrase

java.lang.Objectjm.music.data.Phrase
- All Implemented Interfaces:
- jm.constants.Alignments, java.lang.Cloneable, jm.constants.DrumMap, jm.constants.Durations, jm.constants.Dynamics, jm.constants.Frequencies, jm.JMC, jm.constants.Noises, jm.constants.Panning, jm.constants.Pitches, jm.constants.ProgramChanges, jm.constants.RhythmValues, jm.constants.Scales, java.io.Serializable, jm.constants.Tunings, jm.constants.Volumes, jm.constants.Waveforms
- public class Phrase
- extends java.lang.Object
- implements jm.JMC, java.lang.Cloneable, java.io.Serializable
- extends java.lang.Object
The Phrase class is representative of a single musical phrase. Phrases are held in Parts and can be played at any time based on there start times. They may be played sequentially or in parallel. Phrases can be added to an Part like this...
Part inst = new Part("Flute");
//Phrase for the right hand
Phrase rightHand = new Phrase(0.0) //start this phrase on the first beat
//Phrase for the left hand
Phrase leftHane = new Phrase(4.0) //start this phrase on the fifth beat
inst.addPhrase(rightHand);
inst.addPhrase(leftHand);
- Version:
- 1.0,Sun Feb 25 18:43:32 2001
| Nested Class Summary | |
private class |
Phrase.Position
|
| Field Summary | |
private boolean |
append
Setting the phrase to append when added to a part rather than use its start time. |
static boolean |
DEFAULT_APPEND
|
static int |
DEFAULT_DENOMINATOR
|
static int |
DEFAULT_INSTRUMENT
|
static int |
DEFAULT_NUMERATOR
|
static double |
DEFAULT_PAN
|
static double |
DEFAULT_START_TIME
|
static double |
DEFAULT_TEMPO
|
static java.lang.String |
DEFAULT_TITLE
|
static int |
DEFAULT_VOLUME
|
private int |
denominator
the bottom number of the time signature |
private int |
instrument
instrumet / MIDI program change number for this phrase |
private Phrase |
linkedPhrase
A phrase to have a relative start time with if required. |
static double |
MIN_START_TIME
The smallest start time in beats |
private boolean |
mute
Weather the phrase should play or not |
private Part |
myPart
A reference to this phrases part |
private java.util.Vector |
noteList
An array containing mutiple voices |
private int |
numerator
the top number of the time signature |
private double |
pan
The pan position for notes in this phrase. |
private Phrase.Position |
position
|
private double |
tempo
speed in beats per minute for this phrase |
private java.lang.String |
title
The title/name given to this phrase |
private int |
volume
The loudness for this phrase |
| Fields inherited from interface jm.JMC |
AMPLITUDE, DEBUG, DYNAMIC, EIGHT_BIT, FREQUENCY, KEY_SIG_EVT, MONO, NO_DENOMINATOR, NO_INSTRUMENT, NO_KEY_QUALITY, NO_KEY_SIGNATURE, NO_NUMERATOR, OCTAPHONIC, PAN, PITCH, PROG_EVT, QUADRAPHONIC, RHYTHM, SIXTEEN_BIT, STEREO, TEMP_EVT, THIRTY_TWO_BIT, TIME_SIG_EVT, VERBOSE |
| Fields inherited from interface jm.constants.Durations |
C, CD, CDD, CROTCHET, CROTCHET_TRIPLET, CT, DC, DDC, DDEN, DDHN, DDM, DDQ, DDQN, DEMI_SEMI_QUAVER, DEMI_SEMI_QUAVER_TRIPLET, DEN, DHN, DM, DOTTED_CROTCHET, DOTTED_EIGHTH_NOTE, DOTTED_HALF_NOTE, DOTTED_MINIM, DOTTED_QUARTER_NOTE, DOTTED_QUAVER, DOTTED_SEMI_QUAVER, DOTTED_SIXTEENTH_NOTE, DOUBLE_DOTTED_CROTCHET, DOUBLE_DOTTED_EIGHTH_NOTE, DOUBLE_DOTTED_HALF_NOTE, DOUBLE_DOTTED_MINIM, DOUBLE_DOTTED_QUARTER_NOTE, DOUBLE_DOTTED_QUAVER, DQ, DQN, DSN, DSQ, DSQT, EIGHTH_NOTE, EIGHTH_NOTE_TRIPLET, EN, ENT, HALF_NOTE, HALF_NOTE_TRIPLET, HN, HNT, M, MD, MDD, MINIM, MINIM_TRIPLET, MT, Q, QD, QDD, QN, QNT, QT, QUARTER_NOTE, QUARTER_NOTE_TRIPLET, QUAVER, QUAVER_TRIPLET, SB, SEMI_QUAVER, SEMI_QUAVER_TRIPLET, SEMIBREVE, SIXTEENTH_NOTE, SIXTEENTH_NOTE_TRIPLET, SN, SNT, SQ, SQD, SQT, THIRTYSECOND_NOTE, THIRTYSECOND_NOTE_TRIPLET, TN, TNT, TSN, TSNT, WHOLE_NOTE, WN |
| Fields inherited from interface jm.constants.Frequencies |
FRQ |
| Fields inherited from interface jm.constants.Tunings |
EQUAL, JUST, MEAN, PYTHAGOREAN |
| Fields inherited from interface jm.constants.Volumes |
F, FF, FFF, FORTE, FORTISSIMO, MEZZO_FORTE, MEZZO_PIANO, MF, MP, P, PIANISSIMO, PP, PPP, SILENT |
| Fields inherited from interface jm.constants.Panning |
PAN_CENTER, PAN_CENTRE, PAN_LEFT, PAN_RIGHT |
| Fields inherited from interface jm.constants.DrumMap |
ACOUSTIC_BASS_DRUM, ACOUSTIC_SNARE, BASS_DRUM_1, CABASA, CHINESE_CYMBAL, CLAVES, CLOSED_HI_HAT, COWBELL, CRASH_CYMBAL_1, CRASH_CYMBAL_2, ELECTRIC_SNARE, HAND_CLAP, HI_BONGO, HI_MID_TOM, HI_WOOD_BLOCK, HIGH_AGOGO, HIGH_FLOOR_TOM, HIGH_TIMBALE, HIGH_TOM, LONG_GUIRO, LONG_WHISTLE, LOW_AGOGO, LOW_BONGO, LOW_CONGA, LOW_FLOOR_TOM, LOW_MID_TOM, LOW_TIMBALE, LOW_TOM, LOW_WOOD_BLOCK, MARACAS, MUTE_CUICA, MUTE_HI_CONGA, MUTE_TRIANGLE, OPEN_CUICA, OPEN_HI_CONGA, OPEN_HI_HAT, OPEN_TRIANGLE, PEDAL_HI_HAT, RIDE_BELL, RIDE_CYMBAL_1, RIDE_CYMBAL_2, SHORT_GUIRO, SHORT_WHISTLE, SIDE_STICK, SPLASH_CYMBAL, TAMBOURINE, VIBRASLAP |
| Fields inherited from interface jm.constants.Scales |
AEOLIAN_SCALE, BLUES_SCALE, CHROMATIC_SCALE, DIATONIC_MINOR_SCALE, DORIAN_SCALE, HARMONIC_MINOR_SCALE, INDIAN_SCALE, LYDIAN_SCALE, MAJOR_SCALE, MELODIC_MINOR_SCALE, MINOR_SCALE, MIXOLYDIAN_SCALE, NATURAL_MINOR_SCALE, PENTATONIC_SCALE, TURKISH_SCALE |
| Fields inherited from interface jm.constants.Waveforms |
COSINE_WAVE, PULSE_WAVE, SABERSAW_WAVE, SAWDOWN_WAVE, SAWTOOTH_WAVE, SINE_WAVE, SQUARE_WAVE, TRIANGLE_WAVE |
| Fields inherited from interface jm.constants.Noises |
BROWN_NOISE, FRACTAL_NOISE, SMOOTH_NOISE, STEP_NOISE, WHITE_NOISE |
| Fields inherited from interface jm.constants.Alignments |
AFTER, BEFORE, CENTER_ALIGN, CENTER_ON_END, CENTER_ON_START, CENTRE_ALIGN, CENTRE_ON_END, CENTRE_ON_START, END_ON_CENTER, END_ON_CENTRE, END_TOGETHER, START_ON_CENTER, START_ON_CENTRE, START_TOGETHER |
| Constructor Summary | |
Phrase()
Creates an empty Phrase. |
|
Phrase(double startTime)
Creates an empty Phrase starting at the specified beat. |
|
Phrase(double startTime,
int instrument)
Creates an empty Phrase |
|
Phrase(Note note)
Constructs a new Phrase containing the specified note. |
|
Phrase(Note[] notes)
Constructs a new Phrase containing the specified notes. |
|
Phrase(Note[] notes,
java.lang.String title)
Constructs a new Phrase containing the specified notes with
the specified title. |
|
Phrase(Note note,
double startTime)
Constructs a new Phrase containing the specified note with
the specified title. |
|
Phrase(Note note,
java.lang.String title)
Constructs a new Phrase containing the specified note with
the specified title. |
|
Phrase(java.lang.String title)
Creates an empty Phrase |
|
Phrase(java.lang.String title,
double startTime)
Creates an empty Phrase. |
|
Phrase(java.lang.String title,
double startTime,
int instrument)
Creates an empty Phrase. |
|
Phrase(java.lang.String title,
double startTime,
int instrument,
boolean append)
Creates an empty Phrase. |
|
| Method Summary | |
void |
add(Note note)
Add a note to this Phrase |
void |
addChord(int[] pitches,
double rv)
Adds Multiple notes to the phrase all of which start at the same time and share the same duration. |
void |
addNote(int pitch,
double rv)
Add a note to this Phrase |
void |
addNote(Note note)
Add a note to this Phrase |
void |
addNoteList(double[] pitchAndRhythmArray)
Adds Multiple notes to the phrase from one array of pitch, rhythm pairs |
void |
addNoteList(double[] freqArray,
double rhythmValue)
Adds Multiple notes to the phrase from an array of frequency values |
void |
addNoteList(double[] freqArray,
double[] rhythmArray)
Adds Multiple notes to the phrase from several arrays |
void |
addNoteList(double[] freqArray,
double[] rhythmArray,
int[] dynamic)
Adds Multiple notes to the phrase from several arrays |
void |
addNoteList(double[] freqArray,
double[] rhythmArray,
int[] dynamic,
boolean append)
Adds Multiple notes to the phrase from several arrays A boolean option when true appends the notes to the end of the list if non true the current list is errased and replaced by the new notes |
void |
addNoteList(double frequency,
double[] rhythms)
Adds Multiple notes to the phrase from one pitch and an array of rhythm values |
void |
addNoteList(int[] pitchArray,
double rhythmValue)
Adds Multiple notes to the phrase from several arrays |
void |
addNoteList(int[] pitchArray,
double[] rhythmArray)
Adds Multiple notes to the phrase from several arrays |
void |
addNoteList(int[] pitchArray,
double[] rhythmArray,
int[] dynamic)
Adds Multiple notes to the phrase from several arrays |
void |
addNoteList(int[] pitchArray,
double[] rhythmArray,
int[] dynamic,
boolean append)
Adds Multiple notes to the phrase from several arrays A boolean option when true appends the notes to the end of the list if non true the current list is errased and replaced by the new notes |
void |
addNoteList(int pitch,
double[] rhythms)
Adds Multiple notes to the phrase from one pitch and an array of rhythm values |
void |
addNoteList(Note[] notes)
Appends the specified notes to the end of this Phrase. |
void |
addNoteList(Note[] noteArray,
boolean append)
Adds an array of notes to the phrase A boolean option when true appends the notes to the end of the list |
void |
addNoteList(java.util.Vector noteVector,
boolean append)
Adds a vector of notes to the phrase A boolean option when true appends the notes to the end of the list |
Phrase |
alias()
Returns a carbon copy of a specified Phrase Changes to notes in the original or the alias will be echoed in the other. |
boolean |
attemptAnchoringTo(Phrase anchor,
Alignment alignment,
double offset)
The positions tries the phrase relative to another using the alignment specified. |
Phrase |
copy()
Returns a copy of the entire Phrase |
Phrase |
copy(double startLoc,
double endLoc)
Returns a copy of a specified section of the Phrase, pads beginning and end with shortedend notes and rests if notes or phrase boundaries don't align with locations. |
Phrase |
copy(double startLoc,
double endLoc,
boolean requireNS)
Returns a copy of a specified section of the Phrase, pads beginning and end with shortedend notes and rests if notes or phrase boundaries don't align with locations. |
Phrase |
copy(double startLoc,
double endLoc,
boolean trimmed,
boolean truncated,
boolean startTimeShifts)
Returns a copy of a specified section of the Phrase, pads beginning and end with shortedend notes and rests if notes or phrase boundaries don't align with locations. |
Phrase |
copy(int highestPitch,
int lowestPitch)
Returns a copy of the entire Phrase only ontaining notes between highest and lowset specified pitch. |
private void |
copyAttributes(Phrase phr)
|
Note |
createNote()
Generates and returns a new note with default values and adds it to this phrase. |
void |
empty()
Empty removes all elements in the vector |
Anchoring |
getAnchoring()
Returns details of how this is aligned relative to another phrase. |
boolean |
getAppend()
Return this phrases append status |
double |
getBeatLength()
Return the Duration of the phrase in beats. |
int |
getDenominator()
Returns the denominator of the Phrase's time signature |
double |
getEndTime()
Return the phrases endTime |
int |
getHighestPitch()
Return the pitch value of the highest note in the phrase. |
int |
getInstrument()
Return the program change assigned by this phrase |
Phrase |
getLinkedPhrase()
Return this phrases this phrase is linked to |
double |
getLongestRhythmValue()
Return the value of the longest rhythm value in the phrase. |
int |
getLowestPitch()
Return the pitch value of the lowest note in the phrase. |
boolean |
getMute()
Retrieve the current mute status. |
Part |
getMyPart()
returns a reference to the part that contains this phrase |
Note |
getNote(int number)
Get an individual note object by its number |
Note[] |
getNoteArray()
Returns the all notes in the phrase as a array of notes |
java.util.Vector |
getNoteList()
Returns the entire note list contained in a single voice |
int |
getNumerator()
Returns the numerator of the Phrase's time signature |
double |
getPan()
Return the pan position for this phrase |
double |
getShortestRhythmValue()
Return the value of the shortest rhythm value in the phrase. |
int |
getSize()
Get the number of notes in this phrase |
double |
getStartTime()
Return the phrases startTime |
double |
getTempo()
Return the tempo in beats per minute for this phrase |
java.lang.String |
getTitle()
Return this phrases title |
(package private) double |
getTotalDuration()
Returns the length of the whole phrase in beats. |
int |
getVolume()
Retreive the current volume setting for this phrase. |
int |
length()
Get the number of notes in this phrase |
void |
removeLastNote()
Deletes the last note in the phrase |
void |
removeNote(int noteNumb)
Deletes the specified note in the phrase |
void |
removeNote(Note note)
Deletes the first occurence of the specified note in the phrase |
void |
setAppend(boolean append)
Gives the Phrase a new append status |
void |
setDenominator(int dem)
Specifies the denominator of the Phrase's time signature |
void |
setDuration(double val)
Change the Duration value of each note in the phrase. |
void |
setDynamic(int dyn)
Change the dynamic value of each note in the phrase. |
void |
setInstrument(int value)
Sets the program change value |
void |
setLinkedPhrase(Phrase link)
Make a link from this phrase to another |
void |
setMute(boolean state)
Specify the mute status of this phrase. |
void |
setMyPart(Part part)
Sets a reference to the part containing this phrase |
void |
setNote(Note n,
int index)
|
void |
setNoteList(java.util.Vector newNoteList)
Replaces the entire note list with a new note list vector |
void |
setNumerator(int num)
Specifies the numerator of the Phrase's time signature |
void |
setPan(double pan)
Determine the pan position for all notes in this phrase. |
void |
setPitch(int val)
Change the pitch value of each note in the phrase. |
void |
setRhythmValue(int val)
Change the rhythmValue value of each note in the phrase. |
void |
setStartTime(double startTime)
Sets the phrases startTime |
void |
setTempo(double newTempo)
Determine the tempo in beats per minute for this phrase |
void |
setTitle(java.lang.String title)
Gives the Phrase a new title |
void |
setVolume(int val)
Specify a new volume amount for this phrase. |
int |
size()
Get the number of notes in this phrase |
java.lang.String |
toString()
Prints the tracks attributes to stdout |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
MIN_START_TIME
public static final double MIN_START_TIME
- The smallest start time in beats
- See Also:
- Constant Field Values
DEFAULT_TITLE
public static final java.lang.String DEFAULT_TITLE
- See Also:
- Constant Field Values
DEFAULT_START_TIME
public static final double DEFAULT_START_TIME
- See Also:
- Constant Field Values
DEFAULT_INSTRUMENT
public static final int DEFAULT_INSTRUMENT
- See Also:
- Constant Field Values
DEFAULT_APPEND
public static final boolean DEFAULT_APPEND
- See Also:
- Constant Field Values
DEFAULT_TEMPO
public static final double DEFAULT_TEMPO
- See Also:
- Constant Field Values
DEFAULT_PAN
public static final double DEFAULT_PAN
- See Also:
- Constant Field Values
DEFAULT_NUMERATOR
public static final int DEFAULT_NUMERATOR
- See Also:
- Constant Field Values
DEFAULT_DENOMINATOR
public static final int DEFAULT_DENOMINATOR
- See Also:
- Constant Field Values
DEFAULT_VOLUME
public static final int DEFAULT_VOLUME
- See Also:
- Constant Field Values
noteList
private java.util.Vector noteList
- An array containing mutiple voices
title
private java.lang.String title
- The title/name given to this phrase
position
private Phrase.Position position
instrument
private int instrument
- instrumet / MIDI program change number for this phrase
tempo
private double tempo
- speed in beats per minute for this phrase
append
private boolean append
- Setting the phrase to append when added to a part
rather than use its start time.
linkedPhrase
private Phrase linkedPhrase
- A phrase to have a relative start time with if required.
pan
private double pan
- The pan position for notes in this phrase.
This must be set delibertley to override a note's pan position.
numerator
private int numerator
- the top number of the time signature
denominator
private int denominator
- the bottom number of the time signature
myPart
private Part myPart
- A reference to this phrases part
volume
private int volume
- The loudness for this phrase
mute
private boolean mute
- Weather the phrase should play or not
| Constructor Detail |
Phrase
public Phrase()
- Creates an empty Phrase.
The default start time is a flag which means the phrase will be
appended to the end of any part it is added to.
Phrase
public Phrase(double startTime)
- Creates an empty Phrase starting at the specified beat.
Phrase
public Phrase(double startTime,
int instrument)
- Creates an empty Phrase
Phrase
public Phrase(java.lang.String title)
- Creates an empty Phrase
Phrase
public Phrase(java.lang.String title, double startTime)
- Creates an empty Phrase.
Phrase
public Phrase(java.lang.String title, double startTime, int instrument)
- Creates an empty Phrase.
Phrase
public Phrase(java.lang.String title, double startTime, int instrument, boolean append)
- Creates an empty Phrase.
Phrase
public Phrase(Note note)
- Constructs a new Phrase containing the specified
note.
Phrase
public Phrase(Note[] notes)
- Constructs a new Phrase containing the specified
notes.
Phrase
public Phrase(Note note, java.lang.String title)
- Constructs a new Phrase containing the specified
notewith the specifiedtitle.
Phrase
public Phrase(Note[] notes, java.lang.String title)
- Constructs a new Phrase containing the specified
noteswith the specifiedtitle.
Phrase
public Phrase(Note note, double startTime)
- Constructs a new Phrase containing the specified
notewith the specifiedtitle.
| Method Detail |
getInstrument
public int getInstrument()
- Return the program change assigned by this phrase
setInstrument
public void setInstrument(int value)
- Sets the program change value
addNote
public void addNote(Note note)
- Add a note to this Phrase
addNote
public void addNote(int pitch,
double rv)
- Add a note to this Phrase
add
public void add(Note note)
- Add a note to this Phrase
addNoteList
public void addNoteList(Note[] notes)
- Appends the specified notes to the end of this Phrase.
JAVADOC
jm.music.data.Phrase