Defining arrays
a = [1,3,5,7,9];
#[1,3,5,7,9] → fixed array;
a= Array.fill(5, {arg i; i*2+1});
a= Array.with(1,3,5,7,9);
a= Array.series(5,1,2);
x= Array.geom(10,1,2) → [1,2,4,8,16,32,64,128,256,512];
r= Array.rand(10,0,9) → Ten random numbers from 0 - 9;
Modifying/accessing arrays
a = a.add(11); → [1,3,5,7,9,11];
a.put(2,55); → [1,3,55,7,9];
a[2] → 55;
a.scramble → [ 1, 3, 5, 7, 9 ]
a; → [false,false,true,true,true];
a.reverse → [9,7,5,3,1];
Example code
({var stars, stars2, stars3, sky, waves, spacetime, heat, shine, shine2, shine3, sparkle;
in this patch i used arrays to assign frequency and volume levels. the different 'stars' variables store different chords that can be changed manually, hopefully ill work out how to do that automatically. i have been experimenting with different code layouts to find a style that is comfortable for me, and also with naming variables. naming variables adds a whole new dimension to it all. i like the idea of making SC poetry...supercollider forces you to have a totally different perspective on how music and sound is created, and its really inspiring. it turns all of the emotional impact of music into numbers, which are infinite....so theres endless creative possibilities to be explored!
the swingOSC GUI stuff looks a bit lame but there seems to be a few people using it with processing, and the flosc project attempts to integrate supercollider with flash. but first i am going to start on my coursework...
Cool Stuff
http://peabody.sapp.org/class/st2/lab/notehz/ - frequency/pitch chart
http://www.benchun.net/flosc/
a = [1,3,5,7,9];
#[1,3,5,7,9] → fixed array;
a= Array.fill(5, {arg i; i*2+1});
a= Array.with(1,3,5,7,9);
a= Array.series(5,1,2);
x= Array.geom(10,1,2) → [1,2,4,8,16,32,64,128,256,512];
r= Array.rand(10,0,9) → Ten random numbers from 0 - 9;
Modifying/accessing arrays
a = a.add(11); → [1,3,5,7,9,11];
a.put(2,55); → [1,3,55,7,9];
a[2] → 55;
a.scramble → [ 1, 3, 5, 7, 9 ]
[ 5, 9, 1, 3, 7 ]
[ 7, 3, 9, 5, 1 ]
[ 7, 3, 9, 5, 1 ]
a.rotate(2); → [7,9,1,3,5] (rotates array around the given index);(var scr;
a= Array.fill(5, {arg i; i*2+1});
scr = {arg b; b.scramble};
b = scr.value(a);
c = scr.value(b);
a.postln;b.postln;c.postln;)
a; → [false,false,true,true,true];
a.reverse → [9,7,5,3,1];
Example code
({var stars, stars2, stars3, sky, waves, spacetime, heat, shine, shine2, shine3, sparkle;
x= SinOsc.ar(freq:3,mul:0.5);
waves= (Pan2.ar
(in: Resonz.ar
(in: WhiteNoise.ar(0.5), freq: SinOsc.ar(freq:0.5,mul:59,add: 200)),
pos: SinOsc.ar(freq:0.4, mul: 0.3)));
waves= (Pan2.ar
(in: Resonz.ar
(in: WhiteNoise.ar(0.5), freq: SinOsc.ar(freq:0.5,mul:59,add: 200)),
pos: SinOsc.ar(freq:0.4, mul: 0.3)));
shine= (Pan2.ar
(in: SinOsc.ar(freq: EnvGen.ar(Env.new(
[262,262,131,131,311,311,208,208,
349,349,622,622,523,523,415,415,
1865,1865,1047,1047,622,622,523,
523,262,262,131,131,208,208,131,
131,196,196,208,208,196,196,208,
208,147,65],[0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1,0.1,0.1,0.1,0.1,0.1,0.1,
0.1,0.1,0.1,0.1,0.1,0.3],'step')),
mul: 0.3),
pos:x));
shine2= (Pan2.ar
(in: Saw.ar(freq: EnvGen.ar(Env.new(
[1865,1865,1047,1047,622,622,523,
523,262,262,131,131,208,208,131,
622,622,699,699,587,587,622,622,
523,523,587,587,466,466,392,392,
131,196,196,208,208,196,196,208,
208,147,65],[0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1,0.1,0.1,0.1,0.1,0.1,0.1,
0.1,0.1,0.1,0.1,0.1,0.3],'step')),
mul: 0.3),
pos:x));
(in: SinOsc.ar(freq: EnvGen.ar(Env.new(
[262,262,131,131,311,311,208,208,
349,349,622,622,523,523,415,415,
1865,1865,1047,1047,622,622,523,
523,262,262,131,131,208,208,131,
131,196,196,208,208,196,196,208,
208,147,65],[0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1,0.1,0.1,0.1,0.1,0.1,0.1,
0.1,0.1,0.1,0.1,0.1,0.3],'step')),
mul: 0.3),
pos:x));
shine2= (Pan2.ar
(in: Saw.ar(freq: EnvGen.ar(Env.new(
[1865,1865,1047,1047,622,622,523,
523,262,262,131,131,208,208,131,
622,622,699,699,587,587,622,622,
523,523,587,587,466,466,392,392,
131,196,196,208,208,196,196,208,
208,147,65],[0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1,0.1,0.1,0.1,0.1,0.1,0.1,
0.1,0.1,0.1,0.1,0.1,0.3],'step')),
mul: 0.3),
pos:x));
shine3= (Pan2.ar
(in: Pulse.ar(freq: EnvGen.ar(Env.new(
[49,49,52,52,49,49,52,52,49,49,52,52,
49,49,52,52,49,49,52,52,49,49,52,52,
49,49,52,52,49,49,52,52],[0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1])),
mul: 0.7),
pos:x));
stars= [523, 622, 1047, 1175];
stars2= [587, 466, 784, 8800];
stars3= [699, 294, 1568, 523];
heat= [x,x*0.7,x*2,x];
spacetime= Pulse.ar(freq:Line.kr(880,220,4,doneAction:2),mul:0.3);
sky= Array.fill(4,{arg i;
SinOsc.ar(freq: stars.at(i),
mul: heat.at(i),
add: 0)});
sparkle= HPF.ar(in: shine, freq: Line.kr(10,1000,4));
waves+Mix(sky)+spacetime+sparkle+shine2;}.play)
(in: Pulse.ar(freq: EnvGen.ar(Env.new(
[49,49,52,52,49,49,52,52,49,49,52,52,
49,49,52,52,49,49,52,52,49,49,52,52,
49,49,52,52,49,49,52,52],[0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1])),
mul: 0.7),
pos:x));
stars= [523, 622, 1047, 1175];
stars2= [587, 466, 784, 8800];
stars3= [699, 294, 1568, 523];
heat= [x,x*0.7,x*2,x];
spacetime= Pulse.ar(freq:Line.kr(880,220,4,doneAction:2),mul:0.3);
sky= Array.fill(4,{arg i;
SinOsc.ar(freq: stars.at(i),
mul: heat.at(i),
add: 0)});
sparkle= HPF.ar(in: shine, freq: Line.kr(10,1000,4));
waves+Mix(sky)+spacetime+sparkle+shine2;}.play)
in this patch i used arrays to assign frequency and volume levels. the different 'stars' variables store different chords that can be changed manually, hopefully ill work out how to do that automatically. i have been experimenting with different code layouts to find a style that is comfortable for me, and also with naming variables. naming variables adds a whole new dimension to it all. i like the idea of making SC poetry...supercollider forces you to have a totally different perspective on how music and sound is created, and its really inspiring. it turns all of the emotional impact of music into numbers, which are infinite....so theres endless creative possibilities to be explored!
the swingOSC GUI stuff looks a bit lame but there seems to be a few people using it with processing, and the flosc project attempts to integrate supercollider with flash. but first i am going to start on my coursework...
Cool Stuff
http://peabody.sapp.org/class/st2/lab/notehz/ - frequency/pitch chart
http://www.benchun.net/flosc/
0 comments:
Post a Comment