«  …10 11 12 13 14 15 16 »

under the hood changes 2

2013-05-26 10:00 other

Updating this blog to Drupal 7. It is quite different from version 6 and things will be a bit chaotic for a while. Sorry that some content here will be unavailable for a few days.


Arduino Live Coding

2013-05-17 17:54 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 plays 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() {
void loop() {

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

and a more elaborate program...

byte cnt= 0;
void setup() {
void loop() {
  for(int i= 0; i<100; i++) {
  for(int i= 0; i<200; i++) {
  for(int i= 0; i<100; i++) {
  for(int i= 0; i<100; i++) {
  for(int i= 0; i<100; i++) {
  if(random(2)==0) {

sounds like this...

And of course, the sound of the uploading (verification really) is great in itself. 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 baud rate 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 baud rates 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 a 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 that 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.

arduinoLivecoding schematic

Here are some pictures of the setup. I'm using the Arduino clone Red board from SparkFun.

arduinoLivecoding board photo

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

arduinoLivecoding boards photo

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 20 Apr 2013). Five Arduino boards all with their serial port (TX line) connected to a mixer (with simple protective circuitry in between). So all sounds are generated from what the Arduino boards are programmed to transmit serially. Note that the sound is heavily distorted. Sorry.


2013-01-28 16:45 visuals

Since the category 'visuals' is underrepresented in this blog and I don't like to embed video in my standard [HTML] pages, I thought I'd include this old piece here. This is the shorter abridged version of the full piece. The quality isn't the best - it's pixelated and jerky. One day I should re-render it in 60 FPS at a higher resolution. It looks a lot better when running in realtime from a computer.

Ström by Mattias Petersson (music) and Fredrik Olofsson (video) is, in its full version, a 45-minute minimalistic piece for five loudspeakers, live-electronics and live-video, based on an open-minded, artistic approach towards electricity. The piece is an attempt to transfer electric currents via sound to the audience. The five speakers in the surround system struggle to take over the sonic stream like electro-magnets. Sine waves and noise rotates with breakneck speeds around the listeners, tries to charge them with static electricity and, as an ultimate goal, even make them levitate. The video part is in direct connection with the sound and is generated out of five discrete lines – one for each channel in the surround system. The lines are treated in different ways, and as the high voltage builds up in the music they look more and more like electric wires, inflicting each other with violent discharges and eruptions. This version was made for a promotional DVD release on Swedish sound art.

Also, see /video/#strom

Traer Physics Library for SuperCollider

2012-11-27 23:59 supercollider

A while ago I started porting the Java/Processing library TRAER.PHYSICS 3.0 by Jeffrey Traer Bernstein to SuperCollider. It's a simple and elegant particle system and a physics engine all in one. There are already ports to ActionScript3, JavaScript and C++ (Cinder), but I haven't seen anyone working with it in SuperCollider yet. so I had a go - both to learn more and to have an alternative to my own physics library quark redUniverse.

It is now finished and released as a quark. This is the initial version and there might still be bugs. I _did see SuperCollider crash once in a strange way after spawning lots of particles, so watch out for memory leaks.

To install it run the following code and recompile SuperCollider...

//and then recompile and open the help file TraerPhysicsOverview

I also wrote a few simple examples to go along with the help files. Here's a screenshot of one...

traer screenshot


2012-08-21 16:10 electronics

A tiny circuit I designed and built-in five copies for dancer Raffaella Galdi. With the help of a small magnetic sensor, this circuit makes it possible to start and stop sound coming from an MP3 player. Because the five circuit boards, speakers and MP3 players are mounted inside pointy hats, the electronics had to be light and draw very little current from the battery.

For the sound volume control, I used a vactrol (LDR+led) and the timing and fade in/out logic are encoded in the firmware of a little microcontroller (ATtiny45). To save battery, the ATtiny45 is put to sleep and is only active when the magnetic reed sensor is triggered. I used the great JeeLib.h for controlling the sleep cycles of the microcontroller.

Schematics, firmware and parts list attached below.

hat circuit hat schematics

More SC Twitter

2012-05-14 16:25 supercollider

More audio recordings of my twitter sctweets. See twitter.com/redFrik and the previous post /f0blog/tweets/.

Normally you run these lines of code (140 characters) in SuperCollider and it will play you some kind of generative music or soundscape (also graphics in rare cases). Here I've recorded a few for those who are too lazy to install SuperCollider.



This one is using the built-in .fib (as in fibonacci) method to generate pitches (\degree) for the Pbind. The Pbind in it self is quite boring to listen to, so by playing it out on audio bus 8 and then making a small distortion+echo effect synth reading from bus 8, we get a much more interesting sound.



Again using the built-in fibonacci method to generate patterns. Here every 8th bar the pattern is scrambled (Dshuf), and in every 8th bar period the first 2 bars are transposed by a strange trick running the melody pattern (i.e. the frequencies) through a CombN.



Here is something that sounds a bit like a couple of trombones playing a riff in a reverberant room. The riff just goes on and on and is made from a pair of slowly changing LFPar oscillators, scaled, offset and rounded to the nearest 50 Hz.



Sounds a bit like punk rock in 6/8 time signature. The crispness comes from the > BrownNoise combo and the rhythms from the Pulse. Overall melody is the slowly running LFPar oscillator stored in variable f. Note that this tweet only works in SuperCollider version 3.5 and above.



An ever rising tone cluster with some clicks. This is built using a LocalIn/LocalIut feedback chain. There are plateaus where one thinks the maximum frequency is reached, but those are only temporary and after a while the tone starts to rise again.



Here the cutoff frequency of a BRF (band reject filter) is modulated with a SinOsc. The cutoff varies between 1 and 99 Hz in the left channel, and 1 and 100 Hz in the right channel. The BRF goes wild and outputs totally crazy sounds when modulated in this matter - just like the BPF used to behave in old SuperCollider versions (3.3 and earlier).



A deep fat bass. It sounds as lovely in a big speaker system as it sounds poor in laptop speakers. The patch is mainly doing phase modulation on a SinOsc with tanh distortion.



This tweet sounds much like a field recording. The noise comes from an exploding BRF (band reject filter) that is wrapped in a Limiter so that it keeps in range. Last a GVerb is adding a metallic quality reverb to the overall sound.



This was coded, believe it or not, within a 5min time limit and under water pistol threat (part of sc2012 keynote talk in London). Again it's a BRF misbehaving run through a comb delay with short modulated delaytime (from 0 to 0.1).



A quite poor tweet. The rhythms are not so interesting and it also have the problem of running out and stopping after a few seconds. Anyway, the principle is that a BRF is generating strange sounds that phase modulate a SinOsc, that in turn goes through a ringing filter (Ringz). I only wanted to record it so that when someone fixes the BRF in some upcoming SuperCollider version, I can go back and listen to how it could sound.


Pbind(\freq,Pseq("SUPERCOLLIDER".ascii,inf)*Pstutter(64,Pseq([3,4,5],inf))*[1,2.045],\dur,0.03,\amp,Pseq([0,0.1],inf)).play// #SuperCollider

Super annoying little thing. It is using the values of the ASCII characters in the string "SUPERCOLLIDER" which is [83, 85, 80, 69, 82, 67, 79, 76, 76, 73, 68, 69, 82]. This is played in sequence and transposed and detuned. Maybe a candidate for the official SuperCollider theme song?



Very intense sounding tweet.



An even more intense sounding tweet.



This patch is heavy on the CPU. It consists of a synth with nested GVerbs all with random settings for roomsize and reverberation time. Synths play for 6 seconds and then fades out over 5 seconds as another synth, with different reverb settings start. The result is overlapping sounds and quite dense texture.


a=LFTri;play{CombN.ar(SinOsc.ar(Saw.ar(3,128,128),Saw.ar([3,4],a.ar(a.kr(0.1,0,8,12),0,32,128)).sin)/4,1,1/6,a.kr(1/32)+1)}// #SuperCollider

A rhythmic tweet. Gets a bit annoying after a while but there are some nice details in there.



Phasing melody in left and right channels. Every 7th note has a slightly different timbre (the 0!6++500 part) and every time one starts this tweet the melody changes (the Dshuf((0..7) part). The phasing is done with two Saw oscillators running at 9 and 9.01Hz. They are in turn used as triggers for the timbre and melody sequences (the two Demand UGens).

redShift Excerpt

2012-05-11 09:20 supercollider

A short excerpt from a rehearsal. It is made with the patch I played at the SuperCollider Symposium 2012 club night (Corsica studios, London).

It's controlled with my custom controller redThermoKontroll

One Reason Why I Love SC

2012-05-08 14:37 supercollider

140 characters...


If we run this line in SuperCollider we hear this...

and using Rohan Drape's great sc3-dot quark and swap play{} with draw{} in the line above, this mess gets revealed...

(click image for hi-res version)

So with a single line of code - short enough to fit in a twitter tweet - we've built this amazingly complex sound synthesis patch. I can not imagine a system with greater code-to-noise ratio than SuperCollider.

And this one is pretty fun to .draw as well...


A heavily recursive patch that looks almost fractal. The PDF file generated from this line of code is 300kB! The number 6 in the code means recursion depth and 60 is the base frequency.

To use the sc3-dot quark in SuperCollider on a mac you'll need Graphviz (I use 2.28 on my OSX 10.6.8). You also need to make sure the resulting .dot files open automatically in Graphviz and not Photoshop, Word or something. (Get info on a .dot file in Finder and change all filetypes to open with graphiviz. You'll find the .dot files from sc3-dot in your hidden /tmp directory)


«  …10 11 12 13 14 15 16 »