c11files.calgorythmic.lab
Class Part

java.lang.Object
  extended by c11files.calgorythmic.lab.Part

public class Part
extends java.lang.Object

Part models a single part in a Piece of music. A part has a sequence of Chords and is played using a single instrument.

Version:
27nov2009
Author:
kvlinden

Constructor Summary
Part(int instrument)
          Construct a new Part.
 
Method Summary
 void addChord(Chord chord)
           
 void addChords(java.util.List<Chord> chords)
           
 void addRests(int beats)
          Add empty, non-pitched beats to the chord sequence
 java.util.List<Beat> getBeats()
           
 java.util.List<Chord> getChords()
           
 int getInstrument()
           
 void setInstrument(int instrument)
           
 void transpose(int interval)
          Transpose this part based on the given interval.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Part

public Part(int instrument)
     throws java.lang.Exception
Construct a new Part.

Parameters:
instrument - the instrument used to play the part
Throws:
java.lang.Exception
Method Detail

getInstrument

public int getInstrument()

setInstrument

public void setInstrument(int instrument)
                   throws java.lang.Exception
Throws:
java.lang.Exception

addChord

public void addChord(Chord chord)

addRests

public void addRests(int beats)
              throws java.lang.Exception
Add empty, non-pitched beats to the chord sequence

Parameters:
beats - the number of beats to add
Throws:
java.lang.Exception

getChords

public java.util.List<Chord> getChords()
                                throws java.lang.Exception
Returns:
return a deep copy of this Part's chords
Throws:
java.lang.Exception

addChords

public void addChords(java.util.List<Chord> chords)

getBeats

public java.util.List<Beat> getBeats()
Returns:
a List of beats representing the Midi version of this part, which includes all note-on, note-off and rest beats

transpose

public void transpose(int interval)
               throws java.lang.Exception
Transpose this part based on the given interval.

Parameters:
interval - the change to apply to all chords in this part
Throws:
java.lang.Exception