Package jm.music.data

Examples of jm.music.data.Note


                     double  rhythm,
                     double  duration ) {
       
        double restPresent;                               
        restPresent = getFinalRestRhythm(phrase);
        Note restToAdd;
        if ( rhythm - restPresent > 0.001 ) {
            restToAdd = new Note();
            restToAdd.setFrequency(Note.REST);                                               
            restToAdd.setRhythmValue(
                            rhythm - restPresent);                                               
            restToAdd.setDuration(
                        (rhythm - restPresent) *
                        (duration/rhythm)) ;                                               
            phrase.addNote(restToAdd);
        }                                       
    }   
View Full Code Here


        int pitch = note.getPitch();
        if (pitch != Note.REST) {
          // work out the original scale octave, degree and accidental
          int octave = pitch / 12;
          int accidental = 0;
          Note n = note.copy();
          while (!n.isScale(mode)) {
            n.setPitch(n.getPitch() -1);
            accidental++;
           }
           int degree = 0;
           for (int i = 0; i < mode.length; i++) {
              if (pitch%12 - accidental == mode[i]) {
View Full Code Here

                    return;
            }
            double time = 0.0;
            Vector v = phrase.getNoteList();
            for(int i = 0; i < v.size(); i++) {
                    Note n = (Note) v.elementAt(i);
                    if (time >= startTime) {
                            n.setDynamic((int) ((time - startTime) / timeDiff
                                                * dynDiff + startDynamic));
                    }
                    time += n.getRhythmValue();
                    if (time > endTime) {
                            break;
                    }
            }
    }
View Full Code Here

                }catch(NullPointerException e) {e.printStackTrace();}
               
    Vector noteList = phrase.getNoteList();
    Enumeration enum1 = noteList.elements();
    while (enum1.hasMoreElements()){
      Note note = (Note) enum1.nextElement();
      if (note.getPitch() != Note.REST) {
      note.setPitch(note.getPitch() + transposition);
      }
    }
    phrase.setNoteList(noteList);
  }
View Full Code Here

    // make sure the root is in the first octave
    int rootNote = key%12;
    Vector noteList = phrase.getNoteList();
    Enumeration enum1 = noteList.elements();
    while (enum1.hasMoreElements()){
      Note note = (Note) enum1.nextElement();
      Mod.transpose(note, transposition, mode, key);
    }
    phrase.setNoteList(noteList);
  }
View Full Code Here

      // is the next note overlapping the end?
      if(beforeCount+1 < phrase.size()) { // make sure we haven't gone through all notes
          if (beatCounter < endLoc && beatCounter + phrase.getNote(beforeCount + 1).getRhythmValue() > endLoc ) {
              overlappingLast = true;
              // add partial note
              Note partialNote = phrase.getNote(beforeCount).copy();
              partialNote.setDuration(partialNote.getDuration() * endLoc - beatCounter / partialNote.getRhythmValue());
              partialNote.setRhythmValue(endLoc - beatCounter);
              tempPhr.addNote(partialNote);
          }
      }
    
      // do the repeats
View Full Code Here

                try{ if(phr == null) new NullPointerException();
                } catch(NullPointerException e) {e.toString(); return;}

                Enumeration enum1 = phr.getNoteList().elements();
                while(enum1.hasMoreElements()) {
                        Note n = (Note)enum1.nextElement();
                        n.setDynamic(n.getDynamic()+amount);
                }
        }
View Full Code Here

    Enumeration enum1 = phrase.getNoteList().elements();
    while (enum1.hasMoreElements()) {
      if (rhythmValueCounter > fadeLength) {
        break;
      }
      Note nextNote = (Note) enum1.nextElement();
      double fadeFactor = rhythmValueCounter / fadeLength;
      int dynamic = (int) ((double) nextNote.getDynamic() * fadeFactor);
      if (dynamic == 0) {
        //start fade in at dynamic of 1 as 0 is MIDI note off
        dynamic = 1;
      }
      nextNote.setDynamic (dynamic);
      rhythmValueCounter += nextNote.getRhythmValue();
    }
  }
View Full Code Here

    Enumeration enum1 = phrase.getNoteList().elements();
    while (enum1.hasMoreElements()){
      if (rhythmValueCounter >= fadeLength){
        break;
      }
      Note nextNote = (Note) enum1.nextElement();
      double fadeFactor = rhythmValueCounter / fadeLength;
      int dynamic = (int)((double)nextNote.getDynamic() * fadeFactor);
      if (dynamic == 0) {
        //start fade in at dynamic of 1 as 0 is MIDI note off
        dynamic = 1;
      }
      nextNote.setDynamic(dynamic);
      rhythmValueCounter += nextNote.getRhythmValue();
    }
  }
View Full Code Here

            return;
        }
        double rhythmValueCounter = 0.0;
        int phraseLength = phrase.size() - 1;//-1 due to Vector elements starting at 0
        for (int i = 0; i <= phraseLength; i++){
            Note nextNote = (Note) phrase.getNoteList().elementAt(phraseLength - i);
            if (rhythmValueCounter > fadeLength){
                break;
            }
           
            double fadeFactor = rhythmValueCounter / fadeLength;
            int dynamic = (int)((double)nextNote.getDynamic() * fadeFactor);
            if (dynamic == 0) {             //only fade out to dynamic of 1 as 0 is note off
                dynamic = 1;}
            nextNote.setDynamic(dynamic);
            rhythmValueCounter += nextNote.getRhythmValue();
        }
  }
View Full Code Here

TOP

Related Classes of jm.music.data.Note

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.