Note that there are some explanatory texts on larger screens.

plurals
  1. POData structure for storing chord progression rules?
    text
    copied!<p>What would be the most appropriate (naturally suited) way to represent the various chord progression (musical) rules in a data-structure such that each chord had a weighted set of options that it could progress to?</p> <p>This data structure would be implemented in a procedural music generation program in a way that you could code: <em>(language-agnostic pseudo-code)</em></p> <pre><code>Chord[7] songArray; Chord first = new Chord(I); //set the first chord's value songArray[0] = first; for (i=0; i&lt;7; i++){ Chord temp = songArray[i].next(); //select the following chord songArray[i+1] = temp; } </code></pre> <p><em>Note: In classical-type music, each chord in a given key can naturally progress to another chord following these rules:</em></p> <pre><code> ---------------------- | Chord | Leads to | |======================= | I | any | | ii | V, vii | | iii | IV, vi | | IV | ii, V, vii | | V | vi | | vi | ii, ii, IV, V| | vii | I | ---------------------- </code></pre> <p>The data structure would store the various progressions as weighted options. As an example, consider the IV chord in any given major key: IV can naturally progress to ii, V, or vii, but could also break the rules in progressing to any other chord. Breaking the rules would happen infrequently.</p> <p><img src="https://i.stack.imgur.com/iyVD2.png" alt="enter image description here"></p> <p>I have considered some sort of linked list/tree data structure, but it would hardly resemble any type of tree or list I've ever used -- additionally, I can't work out how to implement the weighting:</p> <p><img src="https://i.stack.imgur.com/QmAzX.png" alt="enter image description here"></p> <p>Another thought was to use JSON or something similar, but it seems to get redundant very quickly:</p> <pre><code>{ "I":{ "100%":{ "I", "ii", "iii", "IV", "V", "vi", "vii" } }, "ii":{ "80%":{ "V", "vii" }, "20%":{ "i", "ii", "iii", "IV", "vi" } }, // ... } </code></pre> <p>Note: I am comfortable implementing this in a handful of languages, and at this point am NOT concerned with a specific language implementation, but a language-agnostic data-structure architecture.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload