Live data from Hacker News

Algorithmic symphonies from one line of code

countercomplex.blogspot.com

11–20 of 38 posts

Re: Algorithmic symphonies from one line of code

#11
post #9

If you're using Pulseaudio, replace $ ./a.out > /dev/dsp with $ ./a.out | pacat --rate=8192

That doesn't work for their example:

main(t){for(t=0;;t++)putchar(t*(((t>>12)|(t>>8))&(63&(t>>4))));}

use this in stead:

./a.out | pacat --rate=8000 --channels=1 --format=u8

Note that the rate only changes the speed, just like the RPM of a record would.

Re: Algorithmic symphonies from one line of code

#15
post #4

Where is /dev/audio on OS X?

I don't know if there's a way to play it real-time. I was trying to install sox from homebrew, but it can't grab its libogg dependency, downloads.xiph.org isn't working right now, seemingly.

However, you can do this:

  $ ./soundprog > temp.au
  
hit CTRL-C (Hit it fast! You don't need it to run very long, and it will write to the resulting file very very quickly! Consider modifying the code to have a limit on the for loop.)

Then open the resulting .au file in Audacity (http://audacity.sourceforge.net/). It'll play fine.

Not as simple just writing to a sound device, but it works.

Re: Algorithmic symphonies from one line of code

#16
post #10

Firstly, this sounds quite a bit like the Symphony For Dot Matrix Printers. If you haven't heard it, I urge you to find a copy. I've linked to some video below, but it is significantly better as an album. It has all the compositional richness of a classical symphony, performed in realtime by an orchestra of printers. I dare say, it is my single favourite musical work. Secondly, I'm reminded of the cassette tapes that…

Those are indeed fascinating. I do find this a bit of a stretch: "Leaving the constituent elements untouched, the process imposes a new order upon them, reorganizing the sounds along a musical structure." There are parts in there that are almost certainly slowed after recording. The deep thud of the carriage changing direction (starting at 1:47 in video #1) is one such sound that I believe has been slowed. I could ce…

What you're hearing is almost certainly the Proximity Effect: http://en.wikipedia.org/wiki/Proximity_effect_(audio)

I used to record music for a living. I was really big on using natural sounds in unexpected ways. There are a lot of things you can do with creative use of microphones.

Re: Algorithmic symphonies from one line of code

#17
post #15
post #4

Where is /dev/audio on OS X?

I don't know if there's a way to play it real-time. I was trying to install sox from homebrew, but it can't grab its libogg dependency, downloads.xiph.org isn't working right now, seemingly. However, you can do this: $ ./soundprog > temp.au hit CTRL-C (Hit it fast! You don't need it to run very long, and it will write to the resulting file very very quickly! Consider modifying the code to have a limit on the for loop…

Ok, looks like xiph.org was just having a hiccup. You can do it real time with sox.

First, Get sox. I prefer homebrew for Unix type stuff (http://mxcl.github.com/homebrew/), but it's likely MacPorts, Fink, and other sources have sox available too. If using Homebrew, just:

  $ brew install sox
Compile your program. Run it like this:

  $ ./soundprog | sox -r 8000 -t u8 - -d
Voila, just like having a sound device. You can play with the 8000 to make it faster or slower (modifying the pitch as well).
Post reply on HN