import java.util.Vector; import jm.music.data.CPhrase; import jm.music.data.Note; import jm.constants.RhythmValues; /** * ChordProgression represents the sequence of chords that the piano will play. * @author Leslie Chong and Matthew Lipson */ public class ChordProgression extends CPhrase { // The style factory which will coordinate the various stylistic elements private AbstractStyleFactory style = new StandardStyleFactory(); // The voice leading algorithm private VoiceLeading lead = style.createVoiceLeading(); // The chords that make up the progression private Vector chords; /** * ChordProgression will take in a vector of unvoiced chords. It will then set a voicing and offset for each chord. * Ultimately the voicings will be done by voice leading algorithms, and the offsets will be done probablistically. * @param chds The unvoiced chords. Cannot be null. */ public ChordProgression(Vector chds){ super(); assert chds != null; this.chords = chds; Voicings voicingStyle = style.createVoicings(); int[][] voicing; Chord c = null; Vector notes; // Lead the chords chords = lead.lead(chords); // Offset the chords try{ offset(); } catch (ChordNotVoicedException e){ System.out.println("Tried to offset an unvoiced chord"); } for (int x=0; x