Esempio n. 1
0
 // How many measures in a Phrase ?
 private double countMeasures(Phrase p) {
   double answer = 0.0;
   for (int i = 0; i < p.size(); ++i) {
     answer = answer + p.getNote(i).getRhythmValue();
   }
   return answer / p.getNumerator();
 }
Esempio n. 2
0
  // Recombine before, Phrase and after into longer Phrase
  public static void zoomOut(Phrase before, Phrase thePhrase, Phrase after) {
    for (int i = 0; i < thePhrase.size(); ++i) {
      before.addNote(thePhrase.getNote(i));
    }

    for (int i = 0; i < after.size(); ++i) {
      before.addNote(after.getNote(i));
    }

    thePhrase.empty();
    for (int i = 0; i < before.size(); ++i) {
      thePhrase.addNote(before.getNote(i));
    }

    before.empty();
    after.empty();
  }
Esempio n. 3
0
 // Move all notes from one Phrase to another
 private void moveAll(Phrase fromPhrase, Phrase toPhrase) {
   Note theNote;
   while ((fromPhrase.size() > 0)) {
     theNote = fromPhrase.getNote(0);
     toPhrase.addNote(theNote);
     fromPhrase.removeNote(0);
   }
 }
Esempio n. 4
0
 // Move measures from the start of one Phrase to another
 private void moveMeasures(Phrase fromPhrase, Phrase toPhrase, double nMeasures) {
   double beatCount = nMeasures * fromPhrase.getNumerator();
   double beatValue;
   Note theNote;
   while ((beatCount > 0.005) && (fromPhrase.size() > 0)) {
     theNote = fromPhrase.getNote(0);
     beatValue = theNote.getRhythmValue();
     toPhrase.addNote(theNote);
     fromPhrase.removeNote(0);
     beatCount -= beatValue;
   }
 }