« 19 / 30 »

Pfork

2010-11-17 00:21 supercollider

clean-up #2:

Another very old SuperCollider class I never got around to publish. It's called Pfork and makes it possible to blend or fade out patterns in other ways than plain [volume] crossfading. It was originally written for the installation Intelligent Street (in SC2) where it was used as a way of creating new music styles from a mix of multiple other styles.

Here's one example of slowly zeroing out amplitudes in a 16 step pattern. frac is a value slowly changing from 1.0 to 0.0 and indicates how many values to zero out. The fork pattern is [3, 1, 2, 0]. This pattern decides which indices to zero out and in which order. So here index 3 is first in the fork pattern and will thereby be seen as the least important in the original pattern. All indices 3 will be zeroed out first. After that all indices 1 and so on. The last indices zeroed out (i.e. kept until frac is almost 0.0) are the indices 0 - ie the first beat out of 4 in the original amplitude step pattern.

This ASCII printout should help visualise what is happening...

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1  //frac is 1.0
1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1
1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1
1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0
1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 0
1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0  //frac is 0.5
1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0
1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0
1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0
1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0
0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  //frac is 0.0

or the same thing but with the 1s removed - just to show the pattern better.

                                 //frac is 1.0
      0                        
      0       0                
      0       0       0        
      0       0       0       0
  0   0       0       0       0
  0   0   0   0   0   0       0
  0   0   0   0   0   0   0   0  //frac is 0.5
  0 0 0   0   0   0   0   0   0
  0 0 0   0 0 0   0   0   0   0
  0 0 0   0 0 0   0 0 0   0   0
  0 0 0   0 0 0   0 0 0   0 0 0
0 0 0 0   0 0 0   0 0 0   0 0 0
0 0 0 0 0 0 0 0   0 0 0   0 0 0
0 0 0 0 0 0 0 0 0 0 0 0   0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  //frac is 0.0

One can also imagine 1 or 0 to be other things than amplitude and basically any array can fork into any other.

Here's an example going slowly from one melodic pattern into another. (MP3 recording below)

//slowly fork from one pattern to another in the opposite channel
(
a= 0.2.dup(16);  //amplitudes
f= [0, 2, 1, 3];  //forkpattern for left channel
g= [3, 1, 2, 0];  //forkpattern for right channel
Pbind(\pan, -1, \dur, 0.125, \degree, Pseq([5, 6, 7, 8], inf), \amp, Pfork(a, f, Pseries(1, -0.1, 11), 0, 11)).play;
Pbind(\pan, 1, \dur, 0.125, \degree, Pseq([3, 2, 1, 0], inf), \amp, Pfork(a, g, Pseries(0, 0.1, 11), 0, 11)).play;
)

See the help file for more examples.

I plan to (someday) write a Pfunc2 class that works in a similar way but inherits from FilterPattern instead of ListPattern.

Updates:

Attachments:


Bjorklund

2010-11-16 02:05 supercollider

clean-up #1:

Two SuperCollider classes I wrote long ago (Nov. 2008) after a technique described by Godfried Toussaint in his paper 'The Euclidean Algorithm Generates Traditional Musical Rhythms' www-cgrl.cs.mcgill.ca/~godfried/publications/banff.pdf

Also, see ruinwesen.com/blog?id=216 for another implementation with some great demos. And Bjorn Westergard has a SuperCollider demo (archive.org).

Lots of typical patterns in say techno music can be described like this using only two numbers (relation).

Bjorklund is now available as a SuperCollider quark. Install it via the following commands...

Quarks.install("Bjorklund");
//and recompile

Below is some example SuperCollider code with resulting output as MP3. The hihat plays a 9/16 rhythm throughout and the snare plays 3 different ones... 5/8, 15/16 and 3/8.

s.boot
a= Buffer.read(s, "sounds/Free_CR68/CR68_BD_B_03.wav")
b= Buffer.read(s, "sounds/Free_CR68/CR68_SD_B1.wav")
c= Buffer.read(s, "sounds/Free_CR68/CR68_hh_02.wav")

(
SynthDef(\oneshotMono, {|out= 0, amp= 0.1, pan= 0, rate= 1, buffer|
  var src= PlayBuf.ar(1, buffer, rate*BufRateScale.ir(buffer), doneAction:2);
  Out.ar(out, Pan2.ar(src, pan, amp));
}).add;
)

d= TempoClock(120/60)
Pdef(\bd).play(d, quant:4)
Pdef(\hh).play(d, quant:4)
Pdef(\sd).play(d, quant:4)
Pdef(\bd, Pbind(\instrument, \oneshotMono, \buffer, a, \dur, 1.00, \amp, 0.7))
Pdef(\hh, Pbind(\instrument, \oneshotMono, \buffer, c, \dur, 0.25, \amp, Pbjorklund(9, 16, inf)*0.7, \pan, Pbrown(-1, 1, 0.2, inf)))
Pdef(\sd, Pbind(\instrument, \oneshotMono, \buffer, b, \dur, 0.25, \amp, Pbjorklund(5, 8, inf)*0.3))
Pdef(\sd, Pbind(\instrument, \oneshotMono, \buffer, b, \dur, 0.25, \amp, Pbjorklund(15, 16, inf)*0.3))
Pdef(\sd, Pbind(\instrument, \oneshotMono, \buffer, b, \dur, 0.25, \amp, Pbjorklund(3, 8, inf)*0.3))
Pdef(\bd).stop
Pdef(\sd).stop
Pdef(\hh).stop

Updates:


redThermoKontroll

2010-07-21 17:40 electronics

My latest controller. I'll premiere it this Friday (23 July 2010) at the bring-your-own-laptop event at staalplaat. It includes a light sensor, 2 touch sensors, some big switches and lots of knobs for control. It is also wireless and runs off either a 9V battery or a 9-14V wall adapter. The controller data is picked up by redWirelessMaster and is then read by the computer via a serial port.

Firmware, parts list and schematics attached below. A SuperCollider class for interpreting the data is also included.

Flickr photostream from the build process. I took out most of these beautiful old electronics and replaced it with my own circuit board. Only kept the front end interface with the nice knobs.

Updates:


OpenObject Tutorials

2010-03-31 20:48 supercollider

7 short screencasts with code examples showing how to connect SuperCollider with MaxMSP/Pd/Processing (etc) using the OpenObject quark.
Download the example code here... www.subnet.at/content/supercollider-tutorials-0

To run all the examples you will need SuperCollider, Processing (with the oscP5 library), MaxMSPJitter and Pure Data.

Install OpenObject from within SuperCollider with Quarks.install("OpenObject");

These screencasts were made at the 10days of SuperCollider network music workshop at subnet, Salzburg, October 2009.

OpenObject quark by Julian Rohrhuber, tutorials by Fredrik Olofsson, voiceover and support by Max Kickinger.

Thanks to subnet.at

OpenObject overview
OpenObject 00 maxmsp
OpenObject 01 maxmsp
OpenObject 02 maxmsp
OpenObject 03 puredata
OpenObject 04 puredata
OpenObject 05 processing

Updates:

Attachments:


swiki

2010-01-28 23:32 supercollider

Just a listing of some of the SuperCollider code I've published on the swiki. Much is old but still fully functional and hopefully useful.

swiki.hfbk-hamburg.de:8888/MusicTechnology/743 - 3D extensions for the Pen class. Vector and matrix multiplication.

swiki.hfbk-hamburg.de:8888/MusicTechnology/760 - 1D cellular automata pattern.

swiki.hfbk-hamburg.de:8888/MusicTechnology/818 - Live coding practice sessions.

swiki.hfbk-hamburg.de:8888/MusicTechnology/854 - More live coding practice sessions.

swiki.hfbk-hamburg.de:8888/MusicTechnology/763 - Tempo clock synchronisation and beat matching.

swiki.hfbk-hamburg.de:8888/MusicTechnology/833 - Some drawings.

swiki.hfbk-hamburg.de:8888/MusicTechnology/901 - Examples ported from NodeBox.

swiki.hfbk-hamburg.de:8888/MusicTechnology/902 - Examples ported from Processing.

swiki.hfbk-hamburg.de:8888/MusicTechnology/726 - Quicklauncher folder GUI.

swiki.hfbk-hamburg.de:8888/MusicTechnology/810 - Hacked server windows.

swiki.hfbk-hamburg.de:8888/MusicTechnology/870 - A silly drum machine.

swiki.hfbk-hamburg.de:8888/MusicTechnology/869 - Port of particle chamber by Derek Holzer.

swiki.hfbk-hamburg.de:8888/MusicTechnology/906 - Examples ported from form+code.


klipp av Logo

2009-12-28 19:09 supercollider

Some SuperCollider code to generate old school klipp av logos.

Click the window in the SuperCollider code to generate new pictures.


//redFrik
(
  var width= 800, height= 600;
  var win, usr, p0, p1, l= 50, w= 10, h= 15, c= 0.9, o= 0.1;
  win= Window("nystan", Rect(128, 64, width, height), false);
  usr= UserView(win, Rect(0, 0, width, height));
  usr.mouseDownAction= {usr.refresh};
  usr.background= Color.new255(51, 47, 57);
  win.front;
  usr.drawFunc= {
    Pen.translate(width*0.5, height*0.5);
    5.rrand(20).do{
      var p, pp1, len;
      Pen.rotate(pi.linrand);
      p0= Point(0, 0);
      p1= Point(0, h.rand*10.linrand);
      pp1= p1;
      (20.linrand).do{|i|
        len= l+l.rand2;
        Pen.color= Color(c, c, c.rrand(1.0), (1-c).rrand(1.0));
        Pen.moveTo(p0);
        Pen.lineTo(p1);
        if(o.coin, {
          p= 200.rand;
          p0= p0+p;
          p1= p1+p;
        }, {
          p0= p0+Point(len+w.rand2, h.rand);
          p1= p1+Point(len+w.rand2, h.rand);
        });
        Pen.lineTo(p1);
        Pen.lineTo(p0);
        Pen.draw(0);
      };
      Pen.moveTo(p0);
      Pen.lineTo(p1);
      Pen.lineTo(pp1);
      Pen.lineTo(Point(0, 0));
      Pen.draw(5.rand);
    };
  };
  CmdPeriod.doOnce({if(win.isClosed.not, {win.close})});
)

Sunday Drawings

2009-11-27 15:52 supercollider

2006 I fiddled with some simple drawing routines in SuperCollider. (swiki.hfbk-hamburg.de:8888/MusicTechnology/833). Now I've added matching (?) sound synthesis and some slight modifications to the drawing code. There are 7 parameters that are used to both generate the picture and the sound. Normally the parameters are randomised but it is possible to copy&paste a good sounding/looking set of parameters into the code to get the same drawing back.

Below is the new code + embedded vimeos.

sunday drawings2 00
sunday drawings2 01
sunday drawings2 02
sunday drawings2 03
sunday drawings2 04
sunday drawings2 05
sunday drawings2 06
sunday drawings2 07
//redFrik
(
s.latency= 0.05;
s.waitForBoot{
  var width= 640, height= 480, w, u, drawFunc, clearFunc;
  var fadeAtk= 1400, fadeSus= 700, fadeRel= 350;
  var a, b, c, d, e, f, g, i= 0, theta= 0;
  var syn= SynthDef(\sunday, {|amp= 0, a= 1, b= 1, c= 1, d= 1, e= 1, f= 1, g= 1|
    var z0= Mix(BPF.ar(LFSaw.ar([a, b]), a+b, e, amp));
    var z1= SinOsc.ar(a, Ringz.ar(z0, c.abs, f, 2pi), amp);
    var z2= SinOsc.ar(b, Ringz.ar(z0, d.abs, g, 2pi), amp);
    Out.ar(0, Pan2.ar(z0, 0, 0.3)+Pan2.ar(z1, -0.3, 0.3)+Pan2.ar(z2, 0.3, 0.3));
  }).play(s);
  s.sync;
  w= Window("sunday drawings2", Rect(128, 64, width, height), false);
  drawFunc= {
    var x, y;
    if(i==0, {
      "//---------------------".postln;
      [
        \a, a, \b, b, \c, c, \d, d, \e, e, \f, f, \g, g
      ].pairsDo{|m, n| (""++m++"="+n++";").postln};
    });
    if(i<fadeAtk, {
      theta= theta+(d*e*f);
      x= sin(theta*a%a/b*c*2pi);
      y= sin(theta*b%b/a*d*2pi);
      Pen.strokeColor= Color.grey(1, 0.5);
      Pen.translate(width*0.5, height*0.5);
      Pen.scale(f, g);
      Pen.rotate(theta);
      switch(a%3,
        0, {Pen.strokeOval(Rect.aboutPoint(Point(x*100, y*100), a, b))},
        1, {Pen.strokeRect(Rect.aboutPoint(Point(x*100, y*100), a, b))},
        2, {Pen.line(Point(x*100, y*100), Point(a*c*100, b*d*100)); Pen.stroke}
      );
      syn.set(\amp, i/fadeAtk, \a, a, \b, b, \c, c, \d, d, \e, e, \f, f, \g, g);
    });
    if(i>(fadeAtk+fadeSus), {
      clearFunc.value;
      theta= 0;
      Pen.fillColor= Color.grey(0, 5/fadeRel);
      Pen.fillRect(Rect(0, 0, width, height));
      syn.set(\amp, i.linexp(fadeAtk+fadeSus, fadeAtk+fadeSus+fadeRel, 1, 0.0001));
    });
    if(i==(fadeAtk+fadeSus+fadeRel), {
      i= 0;
    }, {
      i= i+1;
    });
  };
  clearFunc= {

    //--replace with preset from here
    a= 200.rand+1;
    b= 200.rand+1;
    c= 3.0.rand2;
    d= 3.0.rand2;
    e= 3.0.rand;
    f= 0.1.rrand(1.5)*#[1, -1].choose;
    g= 0.1.rrand(1.5)*#[1, -1].choose;
    //--to here

  };
  clearFunc.value;
  u= UserView(w, Rect(0, 0, width, height))
    .clearOnRefresh_(false)
    .drawFunc_(drawFunc)
    .background_(Color.black);
  w.front;
  CmdPeriod.doOnce({w.close});
  w.onClose= {syn.free};
  Routine({
    var nextTime;
    while({w.isClosed.not}, {
      nextTime= Main.elapsedTime+(1/60);
      u.refresh;
      (nextTime-Main.elapsedTime).max(0.001).wait;
    });
  }).play(AppClock);
};
)

iPod Touch Microphone

2009-10-23 11:49 electronics

I bought the klinkenstecker 3.5mm 4pol for €2,40 from Segor. The capsule microphone I had laying around. Sorry, no data or idea where I got it. The whole thing is very simple to build and the sound is totally all right. Now I can record into the iPod Touch and run apps like RjDj and SuperCollider with audio input.


« 19 / 30 »