S C O T T E R I C P E T E R S E N

Composer, electronic musician, improviser

(tiny) Nifty Codez

I realize from looking through this site that I need to start posting more code (and resulting recordings.) Part of my motivation is that SC3 (now 3.4!) never ceases to amaze me with its possibilities. One can, with a very small amount of code, achieve some incredibly intricate, beautiful sounds. The below is one example.


{var func, ampFunc; func=LFNoise1.kr(LFNoise1.kr(1!2,0.005,0.02)!3,1000!3,1500!3);
ampFunc=LFNoise1.kr(LFNoise1.kr(1!2,0.4,0.5)!3,0.4!3,0.5!3);
FreeVerb.ar(SinOsc.ar(func,func%pi,ampFunc%1), 0.75,0.75);}.play;

The code all fits in one function ( {} ) and involves 6 UGens and a couple of variables. Basically, the LFNoise1 UGens are random line generators. I’ve nested them inside each other to add even more variability in how the randomness occurs, how often and how much the line moves within the given range. This are then duplicated several times for each parameter (using the ! operator) and applied to the sine-tone oscillator’s frequency, phase, and amplitude parameters. All is wrapped in a warm reverberant blanket of FreeVerb for that roomy effect. Note that the way I’m using the ! operator is sort of a hack and creates many redundant versions of the same integers. This can result in channel number mismatches and amplitudes of over 1. To solve this, the code can be simply modified with a Mix UGen that mixes the array of channels down to (in this case) 2 channels, and adding a multiplier of 0.5 ( ) * 0.5}… ) to keep the amplitudes below 1.


{var func, ampFunc; func=LFNoise1.kr(LFNoise1.kr(1!2,0.005,0.02)!3,1000!3,1500!3);
ampFunc=LFNoise1.kr(LFNoise1.kr(1!2,0.4,0.5)!3,0.4!3,0.5!3);
Mix(FreeVerb.ar(SinOsc.ar(func,func%pi,ampFunc%1), 0.75,0.75);)*0.5}.drawAndPlay;

Note the above uses an added method called drawAndPlay which graphs out the above code in GraphViz so one can visually see exactly what’s going on. The below png file (click it) shows what happens behind the scenes.

Here is a recording of the above code. Note: each time the code is run, the results are different, sometimes subtly, sometimes more noticeably.

The beauty of SC3 is that it is extremely customizable/flexible in terms of coding styles. The above code could be condensed even further, and made to fit in a tweet, for example, but for visual and pedagogical purposes I made it more visually self-explanitory.

I will hopefully post more small examples as the summer weeks pass by. Stay tuned, and stay cool.

\sP

Advertisements

Filed under: Code, Phase 1, SC3 - Code - Music - More, , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

My Other Awesome Sites [•_•]

Assault! 375 Aural Assaults!
About me! About me!
MySpace! MySpace!
Google+! Google+!
My (soon-to-be) Company! My (soon-to-be) Company!

Enter your email address to subscribe to this awesome blog and receive notifications of new posts by email!

Join 78 other followers

-

P O S T E R S !

Artspace

-

Artspace

-

Artspace

Featured

INI new haven

Handmade instruments by Scott Petersen and Brian Kane at Artspace New Haven

%d bloggers like this: