• ### MIDI into [seq] and Markov chains

Hi everyone,
I'm loading some MIDI files (format 0) into [cyclone/seq] and saving them to text, I get a series of lines that are 3 or 4 elements long.
The first element seems to be the time (in ms?) at which to play the line, item 3 is the midi note and item 4 is the velocity. I can't find any reference to what item 2 is. The text goes something like this:
0 192 0;
0 144 36 28;
0 192 0;
0 192 0;
7.12308 176 64 127;
61.055 144 36 0;
61.055 144 48 28;
122.11 144 55 25;
253.06 144 55 0;
253.06 144 60 26;
383.483 144 60 0;
383.483 144 62 24;

etc..

Any help would be greatly appreciated, thanks in advance.

• Posts 64 | Views 6750
• @porres Sure thing, it is public domain.

And yes, this abstraction is basically creating a form of probability matrix out of the source material. If you already have the matrix you don't need most of the steps and can basically directly play the chains...

This abstraction is something like a very basic machine learning approach: Play some notes or read a midi file into it and get new stuff out of it that is computer generated, but based on human creativity.

• @ingox said:

If you already have the matrix you don't need most of the steps and can basically directly play the chains...

the thing is that I was talking about another form of matrix like the one from [prob] which is kinda intuitive, unlike the one we have here

• @porres Maybe you can post some sample data of your matrix?

• just check cyclone/prob please, that's it

• @porres This uses [array random] to move through the chains:

In markov_matrix_demo.pd you can see that the probabilities actually do match up.

The first value of the prob matrix could also be an index of a larger chain, the second value could also be the index of a chord. This could be incorporated or left outside the object. Only the length of the chain cannot be recalculated from within the system.

This does not include any checks for duplicates or consistency, so [markov_matrix] should be reset first and then the matrix data should be correct.

• The basic idea is:

• read all the data into a [text]
• choose a random starting point and take the second value of the prob list as current state
• find all lines with the current state as first value, read the second values into a list and the probabilities into an array
• use [array random] and take the corresponding value from the list as new current state
• repeat from step 3.

(In the implementation another column for counting is added, so first value becomes second and so on.)

This should also work with more probabilities and also if the probabilities don't add up to 100. They don't actually have to be percentages at all (untested).

• @porres I think that [markov] is just more flexible than [anal] + [prob] or [anal] + [markov_matrix] for that matter, so i assume that the whole prob matrix approach is just going nowhere.

• I still have to check. The thing is that I like the approach where you can design your own probability matrix without the "learning" process. There's an advantage if you just sit and write down how many times you want "A" to be followed by "B" and etc...

As for the machine learning approach, your markov design is flawless and extremely versatile and I've put it in my library already

Posts 64 | Views 6750
Internal error.

Oops! Looks like something went wrong!