dictionary sex

i was a bit concerned about using the above title for this post, because obviously it opens me up as a target for the spam hordes. however, i trust my filters, and the title is just too apt.

i have been working on some python code that makes music using a statistical algorithm called a markov chain . with all the running around i have been doing of late, i have had little time to document the past few days' work.

in addition to the problem of racing against time, i have to contend with the added issue of documenting partially working or completely non working code. this has been an issue with analog projects as well. i think my future strategy will be to document failures as well as successes, so other makers who read my blog (all two of you, one being my mom. hi mom!) have the opportunity to see me fail -- er, learn from my mistakes.

"dictionary sex" is an appropriate title for what i've been trying to achieve with this application. i have not quite gotten there yet, but i've only really been debugging it for the past two days (today will be the third). the idea is simple: analyze a sound file, and generate a data file from it. take two of these data files and make a third by mashing them together. use the third file to generate a new sound file that has equal properties from both parents. cute, huh? now if only i could get this to work and not take a million years, that would be great.

i have been looking at ways in python of saving data into files for later applications to use. the pickle library seemed like a reasonable place to start, and soon i moved to cpickle because it operates so much faster, being implemented in c. however, despite being up to 1000x faster than pickle, it's still a very long process to save such huge amounts of data into a file. depending on the type of analysis, these files can be much larger than the original wav file. this is a problem i'll attend to later.

so i started this post three days ago, and as i finish, it's no longer a sob-story. i have actually achieved dictionary sex. here is an example of what i'm talking about:

in this recording is a ménage à trois of transition spaces, each coming from different sound sources as well as different analysis parameters. from a single dictionary file, i can generate an arbitrarily long sound file. frankly, i don't remember what the different parts were anymore. here's the code: markovSamp_4.py and markovCat.py.

One thought on “dictionary sex

Leave a Reply

Your email address will not be published. Required fields are marked *