Thursday 12 August 2010

More Music!

http://www.mediafire.com/file/ccwvvai7il2uvzq/out.wav.mp3

http://www.mediafire.com/file/uzwf5kld1d68zss/phase.wav.mp3

Friday 6 August 2010

So, recently I've been trying to make some generic algorithms that make recognisable music, and then feed them information from images. So heres some results. (Some drum and bass, generated from a picture of some ducks, some reggae from an apple, and some new-age-elevator-music piano, from a load of random microscope images). The scripts themselves were in jacks previous post.

Drum and Bass Ducks

Reggae Apple

Elevator Music

The First Binary... kinda

This is a link to the first binary we've created of this program. You need python2.6 to make it run plus numpy, scipy, PythonImageLibrary, and mathplotlib. Like I said, kinda..

The good news is that we've been gracious enough to (besides assuming we can upload the installers, and no-one will mind) actually upload the python installers in one place, the right versions and everything. So no need to go hunting.

Some setup information:

Firstly; The scripts are in the same folder as the executable for a reason, it has something to do with where python looks for it's libraries. There was some testing with a "Scripts" folder, that's why it's there (if you want to recreate our test, put the scripts in the folder, you get an error message)

Secondly; You'll need to set the scripts directory (no this doesn't tell python where it is, we're working on that), it's in File-->Preferences, or Ctrl+P. You can set the midi player and script editor (i.e. notepad) from here too.

Thirdly; It's probably best to use the default install directory for python2.6

Here are the links:
http://www.mediafire.com/file/a4ip8c0z818tmim/Framework.zip
http://www.mediafire.com/file/05wkp9t64xq2sls/python install.zip

And if for some reason you can't open zip files (assume every contingency):
http://www.7-zip.org/
this is free and will unpack just about everything.

Have fun, feedback will be very helpful at this stage. Including new features that ppl would like to see.

Wednesday 4 August 2010

Sonification magicification

My first post on this blog, Simon's been doing most of it up until now. I thought I should contribute in a large, hugely long and (hopefully) fairly-decently written post of my own concoction.

Well, apart from coming up with a worthwhile title the main focus of my attention has been writing scripts. The wonderful joyous creatures that actually do stuff, scampering throughout the turing machine like elves on a bad acid trip. Here I'll outline the uses of each of the scripts so that no-one can get too lost (if your looking for a specific one, best to use Ctrl+F)

I started off with the basics, there is a scanline (a line across the picture you want to make music from) and I need points on it. Thieving a large chunk of Simon's contribution to the initial stages of this project, the birthing of the fantastically named "sample_points" was wrought from the fires of creation. This happy fellow takes points and outputs a spline curve through them, with a _number (parameter to be set) of evenly spaced points along it. These points are turned into notes via the next script.

The next script is called "points_to_notes", another example of inventive procedural naming. This script takes your points (denoted by x-y co-ords) and depending on the intensity (for greyscale pictures) or RGB content (for colour pictures) it creates a list of pitch, volume, and length values.

Next on the tour is a host of output scripts. "notes_to_midi" creates a single instrument line, whilst "counterpoint" takes 2 scanlines and plays them over one another (adjusted slightly so that they're in key with one another). The final pure output is "polyphonic_midi", this takes chords and a melody. All of the output scripts are intended to be used with other scripts so they create something that sounds good.

The next set of scripts concern themselves with massaging the notes into place, and generating accompaniments. "chord_fitter" takes a moving window analyses the notes within the window to find the best fitting chord. When the algorithm chooses another chord (as the notes have changed sufficiently) it writes the chord for that length of time. "interval_music" and "harmony" are others that change the notes or generate accompaniments, the former snaps all notes to an interval of a 3rd, 4th or a 5th. The latter in a similar way as "chord_fitter"chooses a single note to accompany the melody every 4 notes. These algorithms can all be combined together if one so wishes (I'm saying you can, not you should...)

A further subset are scripts that modify notes and output them in one go (easy to change so that they just modify them if need be). This is usually because the script creates it's notes in a strange format (not the Notes, Volume, Length way the usual suspects are optimised for), and I'm a bit lazy. "arpeggio" and "open_fifths" are in this group. The former creates an arpeggio based on each note given in the context of an overall scale (best used with a few of the above scripts). The latter only plays the 1st and 5ths in a scanline (each scanline can have a different key, so we get modulation) with the occasional 3rd or flattened 3rd.

The last group takes us right back to the beginning of the process, up until now the scanlines have been chosen manually. That's all very well, but is there some way of automating it? Well yes, there are 2 scripts to do this. "fft_scanline_creator" as the name suggests uses a fast Fourier transform to find the highly repetitive sections of an image and plonks a guide point on them, it works well for microscope surface-esque images, but not brilliantly for images with large focus points. "watershed_com" is one of Simon's creations, it uses a center of mass algorithm and a watershed algorithm to find the large feature in an image (i.e. a big apple), and generates scanlines through it depending on it's shape.

Well that's it for the tour of scripts, more will be written that do strange and wonderful things (I've heard of on that creates reggae...). I shall upload these that I've mentioned and more later. If something doesn't work, play with it. Work in progress and all that.

http://www.mediafire.com/file/85cs93v6syx65c4/highlevel.zip