Package instantbach.data

Examples of instantbach.data.Chord


        //represents all possible chords
        ChordTemplate fullSpectrum[] = new ChordTemplate[progression.size()];

        //represent the current chords
        Chord chordArray[] = new Chord[progression.size()];

        //allows the program to step back as many times as possible to revoice a progression
        ArrayList<Chord> backupVector[] = new ArrayList[progression.size()];

        //times that a current chord has been checked and has 0 voicings
        int times[] = new int[progression.size()];

        //initialize all times to zero
        for (int i = 0; i < times.length; i++)
            times[i] = 0;

        //For the entire progression....
        for (int i = progression.size() - 1; i > -1; i--) {

            parent.appendInfo("i = " + i + ", ");

            String currentSymbolID = progression.getIdentifier(i);
            String nextSymbolID = progression.getIdentifier(i+1);

            if (i != progression.size() - 1) {
                parent.appendInfo(nextSymbolID + " to " + currentSymbolID + " = ");
            } else {
                parent.appendInfo(currentSymbolID + " = ");
            }

            backupVector[i] = new ArrayList<Chord>();

            //get the starting note
            startingNote = getStartingNote(currentSymbolID);

            //get all the possible notes for that chord
            fullSpectrum[i] = new ChordTemplate();
            fullSpectrum[i] = createChord(currentSymbolID,
                                          startingNote,
                                          fullSpectrum[i]);

            //get all possible combinations of that chord (and doublings)
            Chord allChords[] = createAllChords(fullSpectrum[i],
                                                currentSymbolID);

            parent.appendInfo(allChords.length + " number of doublings, ");

            if (i != progression.size() - 1) {

                allChords = checkMotion(allChords, chordArray[i + 1]);
                parent.appendInfo(allChords.length + " correct motions");
                parent.appendInfo("\r\n");

            }

            if (allChords.length != 0) {

                //if the very last chord...
                if (i != progression.size() - 1) {
                    chordArray[i] = compareChords(allChords, chordArray[i + 1]);
                } else {

                    //create prefered last chord (For cadence)
                    Voice bassVoice = new Voice(NotePosition.ROOT, new Note("C2"));
                    Voice tenorVoice = new Voice(NotePosition.FIFTH, new Note("G2"));
                    Voice altoVoice = new Voice(NotePosition.THIRD, new Note("E3"));
                    Voice sopranoVoice = new Voice(NotePosition.ROOT, new Note("C4"));

                    //if the last chord is I....
                    if (progression.getIdentifier(i).equals("I")) {
                        chordArray[i] = new Chord("I", bassVoice, tenorVoice, altoVoice, sopranoVoice);
                        parent.appendInfo("\r\n");
                    } else {
                        chordArray[i] = compareChords(allChords,new Chord("I", bassVoice, tenorVoice, altoVoice, sopranoVoice));
                        parent.appendInfo("\r\n");
                    }
                }

                for (int j = 0; j < allChords.length; j++)
View Full Code Here


                if (alpha.charAt(j) == s)
                    sloc = j;
            }

            //build a chord with the converted number and location in the original voice Vector
            Chord tempC = new Chord(symbol,
                                    bassVector.get(bloc),
                                    tenorVector.get(tloc),
                                    altoVector.get(aloc),
                                    sopranoVector.get(sloc));
            //check doubling
            //if true add it to collection
            if (checkDouble(tempC))
                returnVector.add(tempC);

        }

        Chord returnArray[] = new Chord[returnVector.size()];
        for (int i = 0; i < returnVector.size(); i++) {
            returnArray[i] =  returnVector.get(i);
        }

        return returnArray;
View Full Code Here

            if (returner == true)
                loc.add(new Integer(i));

        } //end huge loop

        Chord newChord[] = new Chord[loc.size()];

        for (int i = 0; i < loc.size(); i++) {
            newChord[i] = allChords[loc.get(i)];
        }
View Full Code Here

TOP

Related Classes of instantbach.data.Chord

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.