March « 2013 « Coding, Sounds and Colors | A blog about algorithmic experiments in music and visual art. Sort of.

Glitch Aesthetics and digital music

posted by on 2013.03.29, under Supercollider
29:

Here’s a little Supercollider code which tries to emulate the sonorities of artists like Alva Noto, Ryoji Ikeda, etc., with their blend of broken sine waves and percussive tones.

s.boot;

(
SynthDef(\main,{arg out=0, f=50,t_trig=0,p=0,i=0,d=10,l=0.1,a=0.5,n=1;
  var fmod=SinOsc.ar(f/60,0,f/60);
  var sig=[SinOsc.ar([f,f+600]+fmod,0,[d,0.005]).mean.tanh,HPF.ar(WhiteNoise.ar(1),8000),SinOsc.ar(30,0,1),VarSaw.ar(f/40,mul:d*10000)];
  var env=EnvGen.ar(Env([0.0,1.0,0.0],[0.0,l]),gate:t_trig);
  Out.ar(out,Pan2.ar(((Select.ar(i,sig)*env).fold(-1,1)*0.7+SinOsc.ar(40,0,0.3))*(1+HPF.ar(WhiteNoise.ar(0.02*n),8000)),p)*a);
}).add;
SynthDef(\hat,{arg out=0, f=50,t_trig=0,p=0,a=1;
  var sig=HPF.ar(WhiteNoise.ar(1),6000);
  var env=EnvGen.ar(Env([0.0,1.0,0.0],[0.0,0.01]),gate:t_trig);
  Out.ar(out,Pan2.ar((sig*env*a),p));
}).add;

y=Pmono(\main,\dur,Pxrand((1/8!8)++(1/4!8)++Pseq([1/16,1/16],Prand([1,2],1)),inf),\trig,1,\p,{rrand(-1,1)},\i,Pwrand([0,1,3,4],[0.946,0.03,0.02,0.004],inf),\d,Pwrand([1,30],[0.98,0.02],inf),\f,Pwrand([35,40,6000,20000],[0.30,0.65,0.03,0.02],inf),\l,{rrand(0.1,0.5)},\n,{[1,2,3,30].wchoose([0.8,0.1,0.05,0.05])});
z=Pmono(\hat,\dur,Pxrand((1/8!8)++(1/4!8)++Pseq([1/32,1/32,1/32,1/32],Prand([1,2],1)),inf),\trig,1,\p,{rrand(-1,1)},\a,0.1);

w=Ppar([y,z],inf).play;

)

s.quit;

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

The main idea is to produce the percussive elements by a discontinuous volume envelope, so the “clicks” you hear are just the sine waves having a discontinuity. For this reason also I’ve preferred to use a Pmono, rather than a Pbind as the main rythmical sequencer. Also, via the Select UGen, one can obtain abrupt changes in the sound wave, producing again clicks and quirky noises.
The idea of the rythmic part comes from some post on the Supercollider Mailing List (can’t recall which one right now) using duty UGens, though.
Of course, to get what Noto and Ikeda do, it takes a long route: it’s when techniques end, and art begins. :)
I highly suggest these, if you are curious about this type of stuff


Periodicity

posted by on 2013.03.01, under Processing
01:

Here’s a little code in Processing exploring periodic motion. The single balls have been assigned an angular velocity consisting of “even harmonics”, while the amplitude of the single oscillation is constant up to some tiny random factor, to make the whole animation look more “natural”.

int p=50;
float[] y= new float[p];
float[] r= new float[p+1];
float[] omega= new float[p+1];
float[] amp= new float[p+1];
float t=0;
float s=0;
float b=0;

void setup() {
  for (int i=0;i<y.length;i++){
    y[i]=i;
  };
  omega[0]=0;
  for (int i=1;i<omega.length;i++){
    omega[i]=i*2;
    amp[i]=20+random(-1.0,1.0);
  };
size(400, 400);
 background(255);
}

void draw() {
  background(255);

for (int i=0;i<r.length;i++){
  r[i]=amp[i]*sin(omega[i]*t/2);
};
  for (int i=0;i<y.length;i++){
    stroke(50);
    strokeWeight(3);
  line(width/2+r[i],y[i]*600/p,width/2+r[i+1],y[i]*600/p+600/p);
  fill(int(abs(map(sin(i*t/2),-1,1,-255,255))));
  strokeWeight(1);
  ellipse(width/2+r[i],y[i]*600/p,10,10);
} ;
t +=0.008;
b++;
};

Click below to start/stop the animation.

pagetop