Author |
Message |
Acoustic Interloper
Joined: Jul 07, 2007 Posts: 2071 Location: Berks County, PA
Audio files: 89
|
Posted: Tue Oct 04, 2011 12:18 pm Post subject:
Algorithmic symphonies from one line of code -- how and why? Subject description: Minimal-length live coding directly to a PCM stream |
|
|
One of my students sent me this link. It's sort of minimalism from a code size point of view, relating to both algorithmic composition and live coding. _________________ When the stream is deep
my wild little dog frolics,
when shallow, she drinks. |
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24170 Location: The Netherlands, Enschede
Audio files: 280
G2 patch files: 320
|
Posted: Tue Oct 04, 2011 12:26 pm Post subject:
|
|
|
Also of interest within this context may be the ChucK one-liners. _________________ Jan
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24170 Location: The Netherlands, Enschede
Audio files: 280
G2 patch files: 320
|
|
Back to top
|
|
|
sonic
Joined: Dec 02, 2010 Posts: 106 Location: Victoria BC
|
Posted: Mon Oct 10, 2011 8:28 pm Post subject:
|
|
|
If anyone is interested I have found a way to direct the output of these little C programs to the sound device under OSX: http://news.ycombinator.com/item?id=3063655
Quote: | 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). |
I have only just started mucking around with this, so I have very little understanding of how the output creates the sound it does. Can anyone shine some light on this? So far I'm just trying random bitwise expressions and seeing what happens. It's a lot of fun, but it would be nice to be able to predict the output to a greater degree! |
|
Back to top
|
|
|
Acoustic Interloper
Joined: Jul 07, 2007 Posts: 2071 Location: Berks County, PA
Audio files: 89
|
Posted: Wed Oct 12, 2011 3:31 pm Post subject:
|
|
|
The first one posted on that original thread just ramped a value from all zeroes to all ones, incrementing by one at a time, and fed that directly to the DAC, so what you get is a sawtooth wave, that drops back from all ones to all zeroes, then repeats.
If you increment by two, you double the slope of the ramp, and therefore the frequency. If you increment by 1 on every other sample, you halve the frequency.
You could have different variables ramped up and down at different rates, sum and scale them, and create a composite waveform.
I suppose calling a sin() function to form a sine wave would be cheating, since trig libraries take some memory space. I wonder whether they count the size of libraries.
It's all integer arithmetic. Exclusive OR is just summing without carry. ANDing bit masks can be used to get base 2 modulo. Shifts are multiplies by powers of two, and you can sum a set of shifts to get other products. Basic signal processing, but done with the cheapest (in time and space) integer operators. _________________ When the stream is deep
my wild little dog frolics,
when shallow, she drinks. |
|
Back to top
|
|
|
oljud
Joined: Feb 21, 2012 Posts: 16 Location: sweden
Audio files: 2
G2 patch files: 1
|
Posted: Tue Feb 21, 2012 2:22 pm Post subject:
|
|
|
http://www.99musik.se/showthread.php?288883-C-snutt-tr%E5den - that's mine
I've asked a couple of times in it if someone knows how to write to a file, no answers. Glad I found this thread! Will definitely have a look at that later, have an ep in code I need to record/bounce.
[first post ] |
|
Back to top
|
|
|
|