livecoding

arduino livecoding

so here's some more in depth info on my performance at the live.code.festival / algorave in karlsruhe.

being fascinated since long by the sound of serial transmission, i got into trying to make music out of it in some way. by trial-and-error i figured out that if i connect a small speaker to the tx line of an arduino, i could upload programs that send serial data and listen to the sound of it.
it is all very basic: if i make the arduino program send data with delays in between, it play click rhythms. and programs with faster streams of data play tones. more elaborate combinations of delays and patterns of data produce chords, melodies and a variety of noises. so it works like some sort of one-bit music system that is nice and challenging to play with.

the programs i [live]code can look like this...

byte cnt= 0;
void setup() {
  Serial.begin(9600);
}
void loop() {
  Serial.write(cnt);
  delay(5);
  cnt++;
}

and the resulting sound is this... (raw and unfiltered)


and a more elaborate program...

byte cnt= 0;
void setup() {
  Serial.begin(9600);
}
void loop() {
  for(int i= 0; i<100; i++) {
    Serial.write(cnt++%5+10);
    delay(random(4));
  }
  for(int i= 0; i<200; i++) {
    Serial.write(cnt++%5+10);
    delay(2);
  }
  for(int i= 0; i<100; i++) {
    Serial.write(cnt++%5+10);
    delay(random(4));
  }
  for(int i= 0; i<100; i++) {
    Serial.write(cnt++%5+10);
    delay(3);
  }
  for(int i= 0; i<100; i++) {
    Serial.write(cnt++%5+10);
    delay(4);
  }
  if(random(2)==0) {
    Serial.begin(random(10000));
  }
}

sounds like this...

and of course the sound of the uploading (verification really) is great in it self. it typically sounds like this... (raw and unfiltered)

i think the uploading sound changes subtly depending on program length and i also guess it will change with different arduino bootloaders and whatever baudrate they are using.

and you also have a bit of control over the timbre of the sounds. certain 8bit numbers are more square-wave like than others e.g. 170 (0b10101010), and 85 (0b01010101) sound more 'clean' and 15 (0b00001111) and 240 (0b11110000) also have a more distinct pitch.
different baudrates have a huge effect on the sound - mainly working as frequency transposition.

but the real fun starts when one connects five arduinos to a mixer and start playing with volumes, panning and filters. by having five arduinos connected to an usb hub while running five copies of the arduino ide software, i can write little programs on the fly that will address the different boards and play different sounds on the tx lines. (listening to the rx line also works but then the upload process fails. it'll require extra circuitry to tap into this data without disrupting the uploading).

the reason i used five arduinos is because that's all i could connect to my laptop (2x usb) with my 4-port usb hub. that in combination with the limitation of computer screen space. it is hard to have more than five arduino ide programs open and visible at the same time.

anyway, as the voltage of the standard arduino is 5v and really a bit too much for audio equipment, i bring this down a bit with a simple voltage divider. i'm using a 10k and a 1k resistor.

here are some pictures of the setup. i'm using the arduino clone red board from sparkfun.

the complete setup (without mixer and laptop)...

one issue with the setup is that one can't trust the arduino ide to remember which serial port it was connected to. so every time i start the program i need to double check that the five arduino ide programs are set to the right arduino board. and as i like to know which board is connected to which mixer channel, i also need to check that and possibly reconnect the sound cables.

live at the live.code.festival in karlsruhe (algorave night 20apr, 2013). five arduino boards all with their serial port (tx line) connected to a mixer (with simple protective circuitry in between). so all sound are generated from what the arduino boards are programmed to transmit serially. note that the sound is heavily distorted. sorry.

RedPDU

livecoding via sms anyone? an expensive and annoyingly hard hobby for sure.
but the RedPDU supercollider class makes this possible in any case. it can decode mobile phone text messages in the pdu format. and with a serial connection to your phone (bluetooth or cable), it is easy to directly download incoming sms from your phone into supercollider and interpret them. no additional hardware required.
the class is available here. (there is also a mxj java version for max/msp called f0.pdu here)

and here's a short demo video where i send a short message to myself...

RedPDU from redFrik on Vimeo.

the code i texted in this video was...

Pbind('degree', Pn(Pseries(0, 2, 5), 4), 'dur', 0.1, 'amp', 0.5).play

and the sc receiver function is in the helpfile. but note: on many phones it is impossible to type characters like {} [] \ | etc. you might want to add some find&replace functionality and use <> meaning curly brackets etc.

pact - april

april 2009, 30 days, 1hour/day. do something and show the result to your contracting party. similar to our previous live-coding practising sessions (aug2006 and jun2007). this time i battle marcus fjellström. follow his daily work here.

my rules are: on the last day of march, code a single synthdef in supercollider that i'll force myself to make music with all throughout the month. i'm not allowed to use any other synthdefs! if i need to change the synth definition during the 30 days, all the music written up to that point will be affected. these constraints are both quite strict and quite silly i know, but i imagine it'll help me focus my 1hour work on controlling the synth instead of rewriting the synthesis part all the time (bad habit). of course it is not the optimal way to make music in sc. normally one would opt for smaller synthdefs that do less and are interconnect via busses. see that as a warning and don't copy my synthdef below. it's a big ugly beast.

so here's first the synthdef. coded on march 31st...

//this is the synthdef that i must use for all 30 days
SynthDef(\redMond, {
        arg     out= 0, pan= 0, det= 0,
                atk= 0.01, rel= 0.1, cur= -4, gate= 1,
                amp= 1, freq= 440, sel= 0, selFreq= 40,
                amp2= 0, freq2= 40, sel2= 0, selFreq2= 40,
                amp3= 0, freq3= 40, sel3= 0, selFreq3= 40,
                ringMix= -1, ringFreq= 440, ringGain= 0, ringRate= 1,
                distMix= -1, distFreq= 0.4, distDeep= 1,
                combMix= -1, combFreq= 40, combDecy= 1,
                moogMix= -1, moogFreq= 440, moogGain= 1,
                verbMix= -1, verbRoom= 0.4, verbDamp= 0.4;
        var     iii, aaa, bbb, ccc, zzz,
                ii, aa, bb, cc, zz,
                i, a, b, c, z,
                e;
        det= det+1;
        iii= SelectX.ar(sel3, [
                DC.ar(0),
                DC.ar(1),
                DC.ar(2),
                SinOsc.ar(selFreq3, 0, 1.5, 1.5),
                LFSaw.ar(selFreq3, 0, 1.5, 1.5),
                LFPulse.ar(selFreq3, 0, 0.3, 1.5, 1.5)
        ]);
        aaa= SinOsc.ar(freq3, 0, amp3);
        bbb= LFSaw.ar(freq3*det, 0, amp3);
        ccc= LFPulse.ar(freq3*det*det, 0, 0.3, amp3);
        zzz= Select.ar(iii, [aaa, bbb, ccc]);
        ii= SelectX.ar(sel2, [
                DC.ar(0),
                DC.ar(1),
                DC.ar(2),
                SinOsc.ar(selFreq2, 0, 1.5, 1.5),
                LFSaw.ar(selFreq2, 0, 1.5, 1.5),
                LFPulse.ar(selFreq2, 0, 0.4, 1.5, 1.5)
        ]);
        aa= SinOsc.ar(freq2+zzz, 0, amp2);
        bb= LFSaw.ar(freq2+zzz*det, 0, amp2);
        cc= LFPulse.ar(freq2+zzz*det*det, 0, 0.4, amp2);
        zz= Select.ar(ii, [aa, bb, cc]);
        i= SelectX.ar(sel, [
                DC.ar(0),
                DC.ar(1),
                DC.ar(2),
                SinOsc.ar(selFreq, 0, 1.5, 1.5),
                LFSaw.ar(selFreq, 0, 1.5, 1.5),
                LFPulse.ar(selFreq, 0, 0.5, 1.5, 1.5)
        ]);
        a= SinOsc.ar(freq+zz);
        b= Saw.ar(freq+zz);
        c= Pulse.ar(freq+zz);
        z= Select.ar(i, [a, b, c]);
        z= XFade2.ar(z, SinOsc.ar(ringFreq+SinOsc.ar(ringRate, 0, ringGain), 0, z), ringMix);
        z= XFade2.ar(z, SinOsc.ar(distFreq, z*(1+(distDeep*(8pi-1))))*0.5, distMix);
        z= XFade2.ar(z, CombN.ar(z, 1, combFreq.reciprocal, combDecy), combMix);
        z= XFade2.ar(z, MoogFF.ar(z, moogFreq, moogGain), moogMix);
        z= FreeVerb.ar(z, verbMix*0.5+0.5, verbRoom, verbDamp);
        e= EnvGen.ar(Env.asr(atk, 1, rel, cur), gate, doneAction:2);
        Out.ar(out, Pan2.ar(z, pan, e*amp));
}).memStore;

and here follows short mp3 excerpts. note: all the 30 files + synthdef can also be found the 'pact-apr09.zip' attached below.































AttachmentSize
Package icon pact-apr09.zip44.32 KB

june practice sessions -again

finally rendered mp3 excerpts of my 31 one hour practice sessions from last year. music quality varies... but the code and history files are still available here.
































loss livecode history from the pub

here i've attached the supercollider history file from my performance at the headphones concert at the livecoding festival in sheffield... livecode.access-space.org
it's a bit embarrassing if you study it more carefully. the use of ~pub near the end is a big mistake for instance. i meant ~out and i don't know what i was thinking there...
you can also look at the file '2007-20-20pub.rtf' for the actual document i used. some comments in there didn't make it to the history file as i forgot to evaluate them.

here are also the notes and statistics from my presentation "Live coding practice" in which i talked about my month worth of practising.

june practice sessions

in preparation for the loss livecode festival in sheffield, i'm doing another month of practice. 1 hour/day, start with an empty document, no third-party classes or ugens and then upload the result here.

this time my sparring partner is photographer and artist www.fotokatie.com/katier. she's doing a very nice series of 'star shots'.

in addition to getting my livecoding chops in shape (hopefully), i got commissioned to analyse and present the outcome at the festival. this is a great thing. so the bet with katier provides the pressure, the scheduled talk the deadline for analysis, the upcoming gig the motivation and last the commission pays for one strong coffee at my favourite café each day of the period. what could go wrong?
well, it's summer and i've been working too much as is...

Pages

Subscribe to RSS - livecoding