Skip to content

Commit ce15769

Browse files
committed
Add preamble comment to explain what the example does
1 parent 4962f4a commit ce15769

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

examples/markov_music/sketch.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/**
2+
* Example: Markov music
3+
* Demonstrates the use of Markov chains to model musical sequences.
4+
*
5+
* The user adds notes to the Markov chain by playing notes ASDFGHJKL
6+
* on the keyboard. Every note event (note on and note off) is registered
7+
* as a new node in the graph, and the graph records all transitions
8+
* between note events as edges along the graph.
9+
*
10+
* During playback mode, the algorithm simply traverses the graph randomly,
11+
* playing notes based on the nodes upon which it traverses.
12+
*
13+
* The Markov chain (graph) is visualized as a standard network of nodes,
14+
* with transitions represented by edges between nodes. The current/latest
15+
* node as well as the edges of its previously recorded transitions are
16+
* highlighted.
17+
*/
18+
119
// Music
220
var synth;
321
var velocity = 0.7; // From 0-1

0 commit comments

Comments
 (0)