electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » Discussion » Composition
Algorithmic symphonies from one line of code -- how and why?
Post new topic   Reply to topic Moderators: elektro80
Page 1 of 1 [6 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Acoustic Interloper



Joined: Jul 07, 2007
Posts: 1639
Location: Berks County, PA
Audio files: 35

PostPosted: 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
Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20521
Location: The Netherlands, Enschede
Audio files: 147
G2 patch files: 318

PostPosted: Tue Oct 04, 2011 12:26 pm    Post subject: Reply with quote  Mark this post and the followings unread

Also of interest within this context may be the ChucK one-liners.
_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20521
Location: The Netherlands, Enschede
Audio files: 147
G2 patch files: 318

PostPosted: Wed Oct 05, 2011 7:51 am    Post subject: Reply with quote  Mark this post and the followings unread

And also .. http://www.99musik.se/showthread.php?288883-C-snutt-tr%E5den (or http://electro-music.com/forum/post-341589.html#341589 ).
_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
Sonic



Joined: Dec 02, 2010
Posts: 84
Location: Toronto

PostPosted: Mon Oct 10, 2011 8:28 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Acoustic Interloper



Joined: Jul 07, 2007
Posts: 1639
Location: Berks County, PA
Audio files: 35

PostPosted: Wed Oct 12, 2011 3:31 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
oljud



Joined: Feb 21, 2012
Posts: 6
Location: UK

PostPosted: Tue Feb 21, 2012 2:22 pm    Post subject: Reply with quote  Mark this post and the followings unread

http://www.99musik.se/showthread.php?288883-C-snutt-tr%E5den - that's mine Smile

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 Smile]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: elektro80
Page 1 of 1 [6 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » Discussion » Composition
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use