Friday, May 11, 2012

Sonification - sound of sand - 4

Chain coding - What does the SHAPE software do with a shape? It is interesting to get a clear understanding of what's happening. The transformation of a shape into a fourier spectrum goes in two steps. The first one is chain coding. The software determines the pixellated outline of a shape and transforms it into a chain-coded string of numbers. Each step along the contour is translated into a number in this way:
 For example the leftmost edge of the pixellated shape above is translated into this number string:

...... 4 4 4 4 4 4   5 5 5 5 5 5 5   6 6 6 6 6 6 6 6 6 6 6 6 6 6 6   0 0 0 0 0 0 0 0 .......

We can use this a the starting point for a very direct, very primitive kind of sonification. Any shape can be decomposed into pixel-sized increments in the X and Y directions. Using ChcViewer.exe it is possible to visualize the X and Y components of a 2-D figure. For example if you start going counterclockwise from the position of the arrow:


Then you get this plot of the X-values of the shape as you go anticlockwise around its contour:


And this plot of the Y-values of the shape as you go around its contour:


You can see immediately that these shapes can be transformed into soundwaves easily. And we have a lot of degrees of freedom while combining the X and Y waveforms: we can add them together in different ratios and we can time-shift them with respect to each other.

Next time we'll see if we can get some sounds using python and nsound.

Note
You can make an X-plot by substituting these values in the chain code:
1,0,7 => 1
2,6   => 0
3,4,5 => 7

And an Y-plot by substituting these values:
1,2,3 => 1
4,0   => 0
5,6,7 => 7

References
Shape software - http://lbm.ab.a.u-tokyo.ac.jp/~iwata/shape/index.html
Python XY - http://code.google.com/p/pythonxy/
Nsound (included in Python XY) - http://nsound.sourceforge.net/users_guide/index.html

1 comment:

  1. I look forward to seeing hearing of your sonic songlines. You sparked my interest in the concept... (I found this website while googling. I think you will enjoy it. http://www.drsrl.com/
    enjoy playing in your sand:)fun!ctions

    ReplyDelete