electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
go to the radio page Live at electro-music.com radio 1 Please visit the chat
  host / artist show at your time
today> Modulator ESP Adventures In Sound
 Forum index » DIY Hardware and Software » Supercollider
An attempt at using patterns
Post new topic   Reply to topic Moderators: v-un-v
Page 1 of 1 [2 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Ludvig



Joined: Jul 25, 2005
Posts: 26
Location: Stockholm - Sweden

PostPosted: Wed May 14, 2008 1:17 pm    Post subject: An attempt at using patterns Reply with quote  Mark this post and the followings unread

After reading the nice tutorials on scheduling in supercollider referenced to in the topic "SuperCollider Q&A" on this forum ( ttp://electro-music.com/forum/topic-23855.html ) I tried to sequence a synthdef using patterns. It was a lot easier than I thought it would be and in the spirit of sharing, here is the code.

Code:

(
SynthDef(\plong,{|flux=5,freq=200|
   var sum,osc1,osc2,osc3,osc4,osc5,env;
   freq=EnvGen.ar(Env.perc(0,0.0015,freq))+freq+GrayNoise.ar(flux*freq*Rand(0.002,0.01));
   osc1 = SinOsc.ar(freq,0,Rand(0.1,0.5))*SinOsc.ar(Rand(0.01,0.01+(flux*0.5)),0.5pi,1);   
   osc2 = SinOsc.ar(freq*IRand(1,1+flux),0,Rand(0.1,0.5))*SinOsc.ar(Rand(0,flux),0.5pi,1);
   osc3 = SinOsc.ar(freq*IRand(1,2+flux),0,Rand(0.1,0.5))*SinOsc.ar(Rand(0,flux),0.5pi,1);
   osc4 = SinOsc.ar(freq*IRand(1,3+flux),0,Rand(0.1,0.5))*SinOsc.ar(Rand(0,flux),0.5pi,1);
   osc5 = SinOsc.ar(freq*IRand(1,4+flux),0,Rand(0.1,0.5))*SinOsc.ar(Rand(0,flux),0.5pi,1);
   sum = Mix.new([osc1,osc2,osc3,osc4,osc5]);
   env = EnvGen.ar(Env.perc(0.001,3+Rand(0,10),0.3),doneAction:2);
   Out.ar(0,Pan2.ar((sum*env),Rand(-0.6,0.6)));
}).send(s);

SynthDef(\mjau,{|freq=100|
   var sum,osc1,osc2,brus,env;
   brus = BrownNoise.ar(Rand(0,freq*0.2));
   osc1 = SinOsc.ar(freq+brus,0,1);
   osc2 = Mix([SinOsc.ar(freq*2.001,Rand(0,2pi),0.5),SinOsc.ar(freq*1.999,Rand(0,2pi),0.5)]);
   sum = Mix([osc1,osc2,osc1*osc2]);
   env = EnvGen.ar(Env.perc(Rand(0,15),Rand(5,15),0.1),doneAction:2);
   Out.ar(0,Pan2.ar((sum*env),Rand(-0.2,0.2)));
}).send(s);

a = Pbind(\instrument,\plong,
   \midinote,Pseq([24,12,12,12,31],inf),
   \delta,Pseq([1,1,1,0.5],inf),
   \flux,Pseq([50,0,0],inf)
).play;

b = Pbind(\instrument,\plong,
   \freq,Pseq([36,48,60,60,60,48,72,84,79],inf),
   \delta,Pseq([1,1,1,0.5,0.5,0.5,1,7],inf),
   \flux,Prand([1,7,8,9,10,11],inf)
).play;

c = Pbind(\instrument,\plong,
   \midinote,Pseq([67,84,84,79,72],inf),
   \delta,Pexprand(4,20,inf),
   \flux,Pexprand(20,40,inf)
).play;

d = Pbind(\instrument,\mjau,
   \midinote,Pseq([60,72,74,72,67,60,72,73,72,67,48,36,24,29,24,31,24],inf),
   \delta,Pexprand(1,15,inf)
).play;

)


The different ways to read from arrays with patterns is really inspiring to me and I feel that this a really intuitive way to approach algorithmic music making.

Anyone else feel like sharing something cool that is pattern based? Does the code pasted above work for you? It runs on psycollider on my laptop running xp so i guess i should run on SC on linux and macos as well since there isn't any GUI stuff but I am not sure.
Back to top
View user's profile Send private message
dewdrop_world



Joined: Aug 28, 2006
Posts: 858
Location: Guangzhou, China
Audio files: 4

PostPosted: Wed May 14, 2008 7:55 pm    Post subject: Reply with quote  Mark this post and the followings unread

Looks very nice! Glad the tutorials were helpful.
James

_________________
ddw online: http://www.dewdrop-world.net
sc3 online: http://supercollider.sourceforge.net
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic Moderators: v-un-v
Page 1 of 1 [2 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Supercollider
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use