How does sfplay sonify non-audio files?

Jeff Thompson's icon

I've been doing some experiments loading different kinds of non-audio files into sfplay~ with interesting results.

It has made me wonder, however, what I'm hearing exactly? Anyone know more about the mechanism that allows sfplay~ to make sounds from other files? I'm especially curious how it splits to L and R channels - it's very musical, but would be interested to know more about what's happening "under the hood".

By way of FYI, I've found that Excel, AutoCAD, and Photoshop PSD files are especially good (play for a long time and have lots of sonic diversity). I also found that lowering the sample rate to around 1200 gets rid of a lot of the annoying highest pitches and gives a nice rumble.

Thanks!

mudang's icon

By default, the "openraw" message interprets the file's data as 44.1kHz 16-bit integer stereo interleaved.
This means, that the first 16 bits are the first sample of the left channel - the second 16 bits are the first sample of right channel, and so on.
Like L R L R L R ...

Take a look at the reference manual. You can specify how the file is interpreted using the samptype, offset, srate and srchans messages.

Another very cool App for using files as raw audio data is SoundHack.

happy hacking ;)

Jeff Thompson's icon

Thanks mudang. The L/R part is definitely very helpful. I was curious how it would split to a quadraphonic or other multi-channel setup, and this answers that question - theoretically at least!

I've played with the parameters for playback with interesting results. At this point, I'm really curious how each bit is mapped to an audio signal.

Is the 0/1 value of each bit simply mapped to amplitude?