musiccreator
Class Song

java.lang.Object
  extended by musiccreator.Song
All Implemented Interfaces:
MidiOutputable, MusicXmlOutputable

public class Song
extends java.lang.Object
implements MusicXmlOutputable, MidiOutputable

Implements the Song class, which is the main product of the MusicCreator program. A Song object should not be produced directly, but by a SongFactory object. A song contains a Key, a TimeSignature, and a BeatArray.


Method Summary
static Song createSong(TimeSignature ts, int n, DefinitionArray da)
          Generates the song using a ChordArrayFactory
 Key getKey()
           
 int getTempo()
          Get the tempo of the song in beats per minute
 void outputToConsole()
          Outputs the song beat array to the console.
 void outputToMidi(javax.sound.midi.Track track)
          Outputs the song to the specified MIDI track
 void outputToMusicXml(java.io.PrintWriter out)
          Outputs the song beat array to MusicXML.
static void setKey(Key k)
           
 void setKey(java.lang.String keyname)
          Sets the key of the song
 void setTempo(int tempo)
          Sets the tempo of the song, automatically correcting for time-signature.
static void setTimeSignature(TimeSignature ts)
          Set the time signature of the song as specified by ts
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setKey

public void setKey(java.lang.String keyname)
Sets the key of the song

Parameters:
keyname - getName of key to put the song in

setKey

public static void setKey(Key k)

getKey

public Key getKey()
Returns:
Key the song is in

outputToConsole

public void outputToConsole()
Outputs the song beat array to the console.


outputToMusicXml

public void outputToMusicXml(java.io.PrintWriter out)
Outputs the song beat array to MusicXML.

Specified by:
outputToMusicXml in interface MusicXmlOutputable
Parameters:
out - The file stream to write to

createSong

public static Song createSong(TimeSignature ts,
                              int n,
                              DefinitionArray da)
Generates the song using a ChordArrayFactory

Parameters:
ts - Time-signature to use.
n - Number of measures in the song.
Returns:
The generated song.

setTimeSignature

public static void setTimeSignature(TimeSignature ts)
Set the time signature of the song as specified by ts

Parameters:
ts -

getTempo

public int getTempo()
Get the tempo of the song in beats per minute

Returns:
Tempo in beats per minute

setTempo

public void setTempo(int tempo)
Sets the tempo of the song, automatically correcting for time-signature.

Parameters:
tempo - Tempo in beats per minute.

outputToMidi

public void outputToMidi(javax.sound.midi.Track track)
Outputs the song to the specified MIDI track

Specified by:
outputToMidi in interface MidiOutputable
Parameters:
track -