File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -27,16 +27,21 @@ func midiLoad(f string) []int {
2727 return notes
2828}
2929
30+ // Transitions will store for a state (note identifier in midi) the
31+ // number of transitions to each other note, as observed in the midi file
3032type Transitions map [int ]map [int ]uint32
33+ // A Markov chain is represented as a hash map with assigns state i -> [probability]
34+ // where the probability contains the state we can transition to as Key and an integer Value.
35+ // The array of probabilities is ordered increasingly by Value, where each value
36+ // represents an interval ]Value for prev state, Value] where the length of that
37+ // interval is proportional to the probability of going from i to Key
3138type Markov map [int ][]probability
3239
3340// Returns a Markov chain
3441func NewMarkov (f string ) Markov {
3542 notes := midiLoad (f )
3643 chain := make (Transitions )
3744
38- // Parse the transitions, i.e. store for a state (note identifier in midi)
39- // the number of transitions to each other note, as observed in the midi file
4045 previous := - 1
4146 for _ , n := range notes {
4247 if previous != - 1 {
You can’t perform that action at this time.
0 commit comments