Package instantbach.data

Examples of instantbach.data.Motion


        for (int i = 0; i < allChords.length; i++) {

            boolean returner = true;

            Motion bass = new Motion(chord.getVoice(VoiceType.BASS),
                                     allChords[i].getVoice(VoiceType.BASS));
            Motion tenor = new Motion(chord.getVoice(VoiceType.TENOR),
                                      allChords[i].getVoice(VoiceType.TENOR));
            Motion alto = new Motion(chord.getVoice(VoiceType.ALTO),
                                     allChords[i].getVoice(VoiceType.ALTO));
            Motion soprano = new Motion(chord.getVoice(VoiceType.SOPRANO),
                                     allChords[i].getVoice(VoiceType.SOPRANO));

            //check for invlalid parallel motion
            if (bass.compareTo(tenor)) {
                if (tenor.isValidInterval(bass) == false)
                    returner = false;
            }
            if (bass.compareTo(alto)) {
                if (alto.isValidInterval(bass) == false)
                    returner = false;
            }
            if (bass.compareTo(soprano)) {
                if (soprano.isValidInterval(bass) == false)
                    returner = false;
            }

            if (tenor.compareTo(alto)) {
                if (alto.isValidInterval(tenor) == false)
                    returner = false;
            }
            if (tenor.compareTo(soprano)) {
                if (soprano.isValidInterval(tenor) == false)
                    returner = false;
            }

            if (alto.compareTo(soprano)) {
                if (soprano.isValidInterval(alto) == false)
                    returner = false;
            }

            //check for cross voicing
            int allChordBassNote = allChords[i].getNoteNumeric(VoiceType.BASS);
            int allChordTenorNote = allChords[i].getNoteNumeric(VoiceType.TENOR);
            int allChordAltoNote = allChords[i].getNoteNumeric(VoiceType.ALTO);
            int allChordSopranoNote = allChords[i].getNoteNumeric(VoiceType.SOPRANO);

            int bassNote = chord.getNoteNumeric(VoiceType.BASS);
            int tenorNote = chord.getNoteNumeric(VoiceType.TENOR);
            int altoNote = chord.getNoteNumeric(VoiceType.ALTO);
            int sopranoNote = chord.getNoteNumeric(VoiceType.SOPRANO);

            if (allChordBassNote > allChordTenorNote)
                returner = false;
            if (allChordTenorNote > allChordAltoNote)
                returner = false;
            if (allChordAltoNote > allChordSopranoNote)
                returner = false;

            //check for cross voicing in between chords
            if (allChordBassNote > tenorNote)
                returner = false;
            if (allChordTenorNote < bassNote)
                returner = false;
            if (allChordTenorNote > altoNote)
                returner = false;
            if (allChordAltoNote < tenorNote)
                returner = false;
            if (allChordAltoNote > sopranoNote)
                returner = false;
            if (allChordSopranoNote < altoNote)
                returner = false;

            //check for invalid skips
            if (bass.getDistance() > 7)
                returner = false;
            if (tenor.getDistance() > 4)
                returner = false;
            if (alto.getDistance() > 4)
                returner = false;
            if (soprano.getDistance() > 5)
                returner = false;

            //iii
            if (allChords[i].getSymbol().equals("iii")) {
View Full Code Here


        for (int i = 0; i < allChords.length; i++) {

            if (allChords[i].getBassNotePosition() == NotePosition.ROOT) {

                Motion tenor = new Motion(chord.getTenorVoice(), allChords[i].getTenorVoice());
                Motion alto = new Motion(chord.getAltoVoice(), allChords[i].getAltoVoice());
                Motion soprano = new Motion(chord.getSopranoVoice(), allChords[i].getSopranoVoice());

                int totalDistance = tenor.getDistance() + alto.getDistance() +
                                    soprano.getDistance();

                if (totalDistance < minDistance) {
                    chord = allChords[i];
                    minDistance = totalDistance;
                    chordFound = true;

                }
            }

        }

        if (!chordFound) {

            for (int i = 0; i < allChords.length; i++) {

                Motion tenor = new Motion(chord.getTenorVoice(), allChords[i].getTenorVoice());
                Motion alto = new Motion(chord.getAltoVoice(), allChords[i].getAltoVoice());
                Motion soprano = new Motion(chord.getSopranoVoice(), allChords[i].getSopranoVoice());

                int totalDistance = tenor.getDistance() + alto.getDistance() +
                                    soprano.getDistance();

                if (totalDistance < minDistance) {
                    chord = allChords[i];
                    minDistance = totalDistance;
View Full Code Here

TOP

Related Classes of instantbach.data.Motion

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.