jazz.core
Class Song

java.lang.Object
  |
  +--jazz.core.Song
All Implemented Interfaces:
java.io.Serializable

public class Song
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
protected  java.util.Vector changes
           
protected  java.lang.String name
           
protected  int numMeasures
           
 
Constructor Summary
Song()
           
Song(java.lang.String name)
           
Song(java.lang.String name, int numMeasures)
           
 
Method Summary
 void addChordChange(ChordChange change)
          Adds a chord change into the right place chronologically
 int beatsUntilNextChange(int measure, int beat)
          Return the number of beats before the next change
 void caclulateChordFunctions()
          Calculate chord functions for all chords in a song
 ChordChange chordAtBeat(int measure, int beat)
          Return the actual chord at a given measure and beat
 java.lang.Object clone()
           
 int distanceBetweenChords(int i1, int i2)
          Return the number of beats between chord changes delta_m is the difference in measures delta_b is the difference in beats
 ChordChange getChordChange(int i)
          Get the chord change at a given index.
 ChordChange getCyclicalChordChange(int i)
          Return the chord change for a given index.
 java.lang.String getName()
           
 int getNumMeasures()
           
 int indexAtBeat(int measure, int beat)
          Return the index of the chord change at a given beat
 int intervalBetweenChords(int i1, int i2)
          Return the interval between the first and second chords.
protected  boolean is_ii_in_iiVI(int i, boolean setFunction)
          Determine whether a chord is a ii in a ii-V-I
protected  boolean isStrictlyDominant(int i, boolean setFunction)
          Return whether or not a chord is strictly dominant
protected  boolean isStrictlyDominant(int i, Pitch tonic, boolean setFunction)
          Return whether or not a chord is strictly dominant relative to a tonic
protected  boolean isTonic(int i, boolean setFunction)
          Determine if a given chord is a tonic.
 void removeChordChange(ChordChange c)
          Remove a given chord change.
 void removeChordChangeAt(int index)
          Remove the chord change at a given index.
 void setNumMeasures(int numMeasures)
           
 int size()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

changes

protected java.util.Vector changes

name

protected java.lang.String name

numMeasures

protected int numMeasures
Constructor Detail

Song

public Song()

Song

public Song(java.lang.String name)

Song

public Song(java.lang.String name,
            int numMeasures)
Method Detail

getName

public java.lang.String getName()

setNumMeasures

public void setNumMeasures(int numMeasures)

getNumMeasures

public int getNumMeasures()

size

public int size()

addChordChange

public void addChordChange(ChordChange change)
Adds a chord change into the right place chronologically

getChordChange

public ChordChange getChordChange(int i)
Get the chord change at a given index. An exception is raised if the index is out of bounds

getCyclicalChordChange

public ChordChange getCyclicalChordChange(int i)
Return the chord change for a given index. Note that this is cyclical, i.e. index < 0 and index > size are valid.

intervalBetweenChords

public int intervalBetweenChords(int i1,
                                 int i2)
Return the interval between the first and second chords. Note that the value returned is always in [0, 12)

indexAtBeat

public int indexAtBeat(int measure,
                       int beat)
Return the index of the chord change at a given beat

chordAtBeat

public ChordChange chordAtBeat(int measure,
                               int beat)
Return the actual chord at a given measure and beat

removeChordChangeAt

public void removeChordChangeAt(int index)
Remove the chord change at a given index. Raise an error if the index is out of range.

removeChordChange

public void removeChordChange(ChordChange c)
Remove a given chord change. Raise an error if the change is not in the song.

beatsUntilNextChange

public int beatsUntilNextChange(int measure,
                                int beat)
Return the number of beats before the next change

distanceBetweenChords

public int distanceBetweenChords(int i1,
                                 int i2)
Return the number of beats between chord changes delta_m is the difference in measures delta_b is the difference in beats

isStrictlyDominant

protected boolean isStrictlyDominant(int i,
                                     boolean setFunction)
Return whether or not a chord is strictly dominant

isStrictlyDominant

protected boolean isStrictlyDominant(int i,
                                     Pitch tonic,
                                     boolean setFunction)
Return whether or not a chord is strictly dominant relative to a tonic

isTonic

protected boolean isTonic(int i,
                          boolean setFunction)
Determine if a given chord is a tonic. Note that this will fail if the chord is dominant, thus isDominant must be called first to determine if chord is dominant.

is_ii_in_iiVI

protected boolean is_ii_in_iiVI(int i,
                                boolean setFunction)
Determine whether a chord is a ii in a ii-V-I

caclulateChordFunctions

public void caclulateChordFunctions()
Calculate chord functions for all chords in a song

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object