Package instantbach.data

Examples of instantbach.data.SymbolList


     */
    public ProgressionPanel(MainFrame parent, SymbolList availableSymbols) {
        this.parent = parent;
        this.buttonList = new ArrayList<SymbolButton>();

        this.progression = new SymbolList();

        this.musicPanel = new MusicPanel(this);

        this.setLayout(new BorderLayout());

View Full Code Here


        //create a graph of rules for chord progressions
        LoadProgressionGraph loader = new LoadProgressionGraph(this);
        graph = loader.createProgressionGraph(graphLocation);

        //create a list of available chords
        availableSymbols = new SymbolList();

        availableSymbols.add("ii","ii");
        availableSymbols.add("iii","iii");
        availableSymbols.add("IV","IV");
        availableSymbols.add("V","V");
View Full Code Here

    /**
     * Generates a random progression and attempts to voice it
     */
    public synchronized void generateAndVoiceProgression() {

        SymbolList progression = new SymbolList();

        ArrayList<String> identifiers = new ArrayList<String>();

        //add the root as the last chord
        identifiers.add("I");

        //add the dominant as the second to last
        identifiers.add("7V");

        //get the current vertex (for the cadence)
        Vertex currentVertex = graph.getVertex("7V");

        for (int i = 0; i < 9; i++) {

            //get the adjacent edges to the current vertex
            LinkedList<Edge> currentEdges = currentVertex.getAdjacent();
            int numToChoose = currentEdges.size();

            int randomNumber = (int) (Math.random() * numToChoose + 0);

            //get a random edge
            Edge randomEdge = currentEdges.get(randomNumber);

            //get the destination of the random edge
            currentVertex = randomEdge.getDestination();

            String identifier = currentVertex.getName();
            identifiers.add(identifier);
            //returnVector.add(current.name);
        }

        //create a progression using the given identifiers
        for (int i = identifiers.size() - 1; i >= 0; i--) {
            //get the symbol for the current identifier
            String id = identifiers.get(i);
            Symbol symbol = availableSymbols.getSymbolByIdentifier(id);

            //add this symbol to the current progression
            progression.add(symbol);
        }

        //pass this progression to be voiced
        this.voiceProgression(progression);

View Full Code Here

TOP

Related Classes of instantbach.data.SymbolList

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.