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

No comments:

Post a Comment