Package jm.music.data

Examples of jm.music.data.Phrase


                        return;
                }
                boolean left = true;
                Enumeration enum1 = part.getPhraseList().elements();
                while(enum1.hasMoreElements()){
                        Phrase phr = (Phrase) enum1.nextElement();
                        randomize(phr, pitchVariation, rhythmVariation, dynamicVariation);
                }
        }
View Full Code Here


            if (part == null) {
                return;
            }
            Enumeration enum1 = part.getPhraseList().elements();
            while(enum1.hasMoreElements()){
                Phrase phr = (Phrase) enum1.nextElement();
                slurUp(phr, numberOfNotes);
            }
        }
View Full Code Here

            if (part == null) {
                return;
            }
            Enumeration enum1 = part.getPhraseList().elements();
            while(enum1.hasMoreElements()){
                Phrase phr = (Phrase) enum1.nextElement();
                slurDown(phr, numberOfNotes);
            }
        }
View Full Code Here

        * @param double The amount to multiply the duration by.
        */
        public static void increaseDuration(Part part, double multiplyer) {
            Enumeration enum1 = part.getPhraseList().elements();
            while(enum1.hasMoreElements()){
                Phrase phr = (Phrase) enum1.nextElement();
                increaseDuration(phr, multiplyer);
            }
        }
View Full Code Here

     * @param amount  - The number of beats to add  to the duration.
     */
    public static void addToDuration(Part part, double amount) {
        Enumeration enum1 = part.getPhraseList().elements();
        while(enum1.hasMoreElements()){
            Phrase phr = (Phrase) enum1.nextElement();
            addToDuration(phr, amount);
        }
    }
View Full Code Here

     * @param amount -  The number of beats to add.
     */
    public static void addToRhythmValue(Part part, double amount) {
        Enumeration enum1 = part.getPhraseList().elements();
        while(enum1.hasMoreElements()){
            Phrase phr = (Phrase) enum1.nextElement();
            addToRhythmValue(phr, amount);
           
        }
    }
View Full Code Here

     * @param amount - The number of beats to add.
     */
    public static void addToLength(Part part, double amount) {
        Enumeration enum1 = part.getPhraseList().elements();
        while(enum1.hasMoreElements()){
            Phrase phr = (Phrase) enum1.nextElement();
            addToLength(phr, amount);
        }
    }
View Full Code Here

     * @param amount - The scaling multiplyer for the intervals, i.e., 2.0 doubles width.
     */
    public static void expandIntervals(Part part, double amount) {
        Enumeration enum1 = part.getPhraseList().elements();
        while(enum1.hasMoreElements()){
            Phrase phr = (Phrase) enum1.nextElement();
            expandIntervals(phr, amount);
        }
    }
View Full Code Here

     * @param amount - The dynamic change possible either side of the curent dynamic.
     */
    public static void shake(Part part, int amount) {
        Enumeration enum1 = part.getPhraseList().elements();
        while(enum1.hasMoreElements()){
            Phrase phr = (Phrase) enum1.nextElement();
            shake(phr, amount);
        }
    }   
View Full Code Here

        Phrase [] phr = p.getPhraseArray();
        if(phr.length <2)
            return;
// the new phrase has the start time of the earliest one
        Phrase nphr = new Phrase(phr[0].getStartTime());

        Note n;
        boolean finished = false;
        double prevsst = phr[0].getStartTime();
        while(!finished) {
            double sst = Double.POSITIVE_INFINITY; // smallest start time
            // a temporary phrase (pointer to the one in the array
            Phrase tphr = null;

            //find the phrase with the smallest start time
            for(int i=0;i<phr.length; i++) {

                if (phr[i].getSize()>0 && phr[i].getStartTime()<sst){
                    sst = phr[i].getStartTime();
                    tphr = phr[i];
                }
            }
            if(tphr == null) {finished = true;break;}
            //get a note out of that phrase and, if it is not a rest,
            // put it into the new phrase, adjusting the rhythmValue
            // of the previous note accordingly
            n = tphr.getNote(0);

            if(!n.isRest()) {
                if(nphr.getSize()>0){ // if it is not the first note
                    nphr.getNote(nphr.getSize()-1).setRhythmValue(((int)((sst-prevsst)*100000 + 0.5))/100000.0);
                } else {// if it is the first note to go in, set the startime
                    nphr.setStartTime(sst);
                }
                nphr.addNote(n);
            }
// adjust the start time and remove the note
            tphr.setStartTime(((int)((sst+
                                      n.getRhythmValue())*100000 + 0.5))/100000.0);
            tphr.removeNote(0);

            prevsst = sst;
        }
        p.empty();
        p.addPhrase(nphr);
View Full Code Here

TOP

Related Classes of jm.music.data.Phrase

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.