|
|
60 |
62 |
64 |
67 |
64,62 |
0.6 |
0.4 |
0.0 |
0.0 |
62,60 |
0.0 |
1.0 |
0.0 |
0.0 |
60,62 |
0.0 |
0.0 |
1.0 |
0.0 |
62,64 |
0.0 |
0.25 |
0.50 |
0.25 |
64,64 |
0.0 |
0.4 |
0.6 |
0.0 |
62,62 |
0.0 |
0.3333333 |
0.6666666 |
0.0 |
67,67 |
0.0 |
0.0 |
1.0 |
0.0 |
64,67 |
0.0 |
0.0 |
0.0 |
1.0 |
67,64 |
0.0 |
1.0 |
0.0 |
0.0 |
The obvious change is that the far left hand column now contains 2 numbers (prior states) as the seed rather than 1. Two more obvious changes have occurred. There are more rows than there were previously and there are more 1.0 (100%) weighings than there were before. These last two points seem obvious, but they point to the most important feature of Markov chains; the ability to maintain local context and provide for more discriminatory, therefore musically coherent, output. The output of the matrix maintains the 'character' of the data used to construct it. Musically we might say it stores a sense of 'style'.
A Markov chain can be of any depth (any seed length) but there are a number of important considerations when regarding depth. As the depth of the Markov chain approaches the length of the phrase (data) the novelty (randomness) of the output decreases. Take the above matrix as an example. When we calculated the matrix for a Markov chain of depth 1, then 25% of the rows had a 100% (no randomness) chance of selecting a particular note. Now in our matrix of depth 2 more than 50% of rows have a 100% chance of selecting a particular note. This is the tradeoff with Markov chains. The guarantee of a particular sequence introduces stability and thematic coherence but also introduces the chance of a very similar and even identical arrangement. The resulting melody might be too close to the original.
To test this matrix we are not going to write another engine but instead make use of another of jMusic's in built classes. This class is called PhraseMatrix and it will calculate a matrix and generate a phrase of any length based on the calculated matrix. It will also do this for you for any depth level and calculates matrices for pitch, rhythm and volume (yes, of course you can create matrices for characteristics other than pitch, for example rhythms value, dynamic, or position in the bar). Here is an example class which uses the PhraseMatrix.
Click here to view/download the source.
1: import jm.JMC; 2: import jm.music.data.*; 3: import jm.music.tools.*; 4: import jm.util.*; 6: public class MarkovTest implements JMC{ |
|
|
|
|
|
|