<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2838171651796012966</id><updated>2012-02-16T03:14:11.976-08:00</updated><category term='install'/><category term='drum machine.'/><category term='optimisation'/><category term='tartini'/><category term='comb filter'/><category term='patterns random'/><category term='303'/><category term='Pmono'/><category term='hadron'/><category term='os x'/><category term='midi'/><category term='distortion'/><category term='Pfx'/><category term='phase modulation'/><category term='moog'/><category term='Envelopes'/><category term='reverb'/><category term='plugin'/><category term='theremin'/><category term='Gui'/><category term='bbcut2'/><category term='shazam'/><category term='wah'/><category term='pulse modulation'/><category term='flange'/><category term='chiptune'/><category term='birthday'/><category term='patterns'/><category term='guitar effects'/><category term='effect'/><category term='heterodyne'/><category term='phaser'/><category term='modulation'/><category term='tartini.'/><category term='bitcrusher'/><category term='LPF'/><category term='fuzz'/><category term='lie'/><category term='Synthdef'/><category term='drums'/><category term='one liner'/><category term='Filter'/><category term='MCLD'/><category term='rave hoover'/><category term='portamento'/><category term='routines'/><category term='bbcut'/><category term='drum machine'/><category term='fm7'/><category term='lfo'/><category term='harmoniser'/><category term='phase modulation.'/><category term='SuperColliderAU'/><title type='text'>superdupercollider</title><subtitle type='html'>A blog about Supercollider</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>50</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-6225273544486228266</id><published>2011-07-20T15:39:00.000-07:00</published><updated>2011-07-20T16:04:06.151-07:00</updated><title type='text'>Detuning oscillators.</title><content type='html'>&lt;p&gt;I'm still not entirely sure how PmonoArtic works, perhaps it will forever remain a mystery, but I do know how the important part of this synth def I came up with works. Well more or less anyway.  &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;(&lt;br /&gt;SynthDef("aSynth",{&lt;br /&gt;&lt;br /&gt; arg lagLev = 0.2, freq= 440, cutoff = 500, gate = 0.5;&lt;br /&gt; var osc1 = Mix.fill(8, { SinOsc.ar(freq + 10.0.rand, 0, 0.05) });     var filterEnv = EnvGen.ar(Env.adsr(0.02, 0.1, 0.05, 1), gate, doneAction:2);&lt;br /&gt; var filterOutput = MoogFF.ar(osc1, cutoff * filterEnv, 3.3);    Out.ar(0, filterOutput); &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}).store&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;PmonoArtic("aSynth",&lt;br /&gt; \freq, Pseq([440,330,440,330,550,770,880], inf),&lt;br /&gt; \legato, Pwrand(#[0.5, 1.0], #[0.1, 0.9], inf),&lt;br /&gt; \dur, 0.3,&lt;br /&gt; \cutoff, Pwhite(5000, 10000, inf)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;).play&lt;br /&gt;)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is inspired by something I read  on the SC Users list and it's an attempt at a synth that's more analoguesque. It didn't work quite as well as I had anticipated, so I think I'll have to try some more advanced techniques, but I suppose it's a start. &lt;/p&gt;&lt;p&gt;The significant bit is this line:&lt;/p&gt;&lt;p&gt;var osc1 = Mix.fill(8, { SinOsc.ar(freq + 10.0.rand, 0, 0.05) }); &lt;/p&gt;&lt;p&gt;Here I'm using the Mix command along with fill to create an array of eight different oscillators all tuned slightly differently, randomly assigned plus or minus 10hz from the frequency passed to the sythdef. It's supposed to give it a vaguely chorus like effect by layering detuned oscillators, which it does a bit, but the effect isn't quite as noticeable as I thought.  Increasing the number of oscillators doesn't help much and increasing the frequency that they can change by sounds pretty horrible. &lt;/p&gt;&lt;p&gt;The mix and fill commands are pretty simple to use, by the way. &lt;/p&gt;&lt;p&gt;On it's own you can use Mix.new(array) to mix an array of channels together, or you can use Mix.fill(n, function) to create a whole new array of channels with the function you specify. &lt;/p&gt;&lt;p&gt;I could be wrong, but I think that when you use Mix.fill in a synth def it will only evaluate the function when the synth is loaded, so if you're using random varaibles like I am above, they'll only be random once when it's run. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-6225273544486228266?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/6225273544486228266/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2011/07/im-still-not-entirely-sure-how.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/6225273544486228266'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/6225273544486228266'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2011/07/im-still-not-entirely-sure-how.html' title='Detuning oscillators.'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-1862162713459779951</id><published>2011-07-05T14:36:00.000-07:00</published><updated>2011-07-05T14:45:48.579-07:00</updated><title type='text'>I've forgotten everything I ever learned about SuperCollider.</title><content type='html'>It's been so long I'm not even sure how to spell SuperCollider anymore, I think it's two lls, but that looks wrong.&lt;br /&gt;&lt;br /&gt;Several versions of SC have come out since I last used it and of course lots of the quarks and plugins I had from previous versions now no longer work, so I've had to start from scratch with a fresh install. This is probably no bad thing as it means I need to work from the ground up and remind myself how it all works.&lt;br /&gt;&lt;br /&gt;I've done this before I think, but now it's time to do again, a SuperCollider Theramin, this time with a phase effect. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;{SinOsc.ar(MouseY.kr(1,880),SinOsc.kr(MouseX.kr(0,100)))}.play&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-1862162713459779951?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/1862162713459779951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2011/07/ive-forgotten-everything-i-ever-learned.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/1862162713459779951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/1862162713459779951'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2011/07/ive-forgotten-everything-i-ever-learned.html' title='I&apos;ve forgotten everything I ever learned about SuperCollider.'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-3261169183134031376</id><published>2011-04-20T13:08:00.000-07:00</published><updated>2011-04-20T13:12:56.096-07:00</updated><title type='text'>I'm still alive.</title><content type='html'>I know it's been a very long time since I've updated this blog, but I'm still here and I think it's about time I started looking at Supercollider again. Watch this space.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-3261169183134031376?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/3261169183134031376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2011/04/im-still-alive.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3261169183134031376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3261169183134031376'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2011/04/im-still-alive.html' title='I&apos;m still alive.'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-6890452737036266864</id><published>2009-11-30T16:28:00.000-08:00</published><updated>2009-11-30T16:42:35.934-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harmoniser'/><category scheme='http://www.blogger.com/atom/ns#' term='tartini'/><category scheme='http://www.blogger.com/atom/ns#' term='guitar effects'/><title type='text'>'Harmoniser' with Tartini</title><content type='html'>A little patch I made today following on from the auto chip tune stuff from before. This time a 'harmoniser' type effect made with the same Tartini type resynthesising, using a live input. I've got 'harmoniser' in inverted commas because frankly it isn't very harmonic, but it's a start I suppose. Here's the code. &lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;(&lt;br /&gt;SynthDef(&amp;quot;Harm&amp;quot;, {&amp;#124;offSet1, offSet2, output, osc1, osc2, mix, pitch1, pitch2, fader&amp;#124;&lt;br /&gt;&lt;br /&gt;    var sound = SoundIn.ar;&lt;br /&gt;    var pitch = Tartini.kr(sound)[0];&lt;br /&gt;    var amp = Amplitude.ar(sound);&lt;br /&gt;    pitch = Median.kr(5, pitch); // smooth&lt;br /&gt;    pitch = pitch.min(10000).max(10); // limit&lt;br /&gt;    pitch1 = pitch.cpsmidi.round + 40;&lt;br /&gt;    pitch2 = pitch.cpsmidi.round + 60;&lt;br /&gt;        &lt;br /&gt;        pitch1 = pitch1.midicps;&lt;br /&gt;    pitch2 = pitch2.midicps;        &lt;br /&gt;    &lt;br /&gt;    osc1 = Saw.ar(pitch1, amp * 2); // resynthesise&lt;br /&gt;    osc2 = Pulse.ar(pitch2, 0.2, amp * 2);&lt;br /&gt;    mix = Mix.ar([osc1, osc2]);&lt;br /&gt;    fader = XFade2.ar(sound, mix, -0.5);&lt;br /&gt;    output = FreeVerb.ar(fader, 0.3, 0.1, 0.9); // bit of reverb just to taste&lt;br /&gt;    Out.ar(0, output);&lt;br /&gt;    &lt;br /&gt;    }).memStore;&lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;x = Synth(&amp;quot;Harm&amp;quot;);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here Im using Tartini to determine the pitch of the input, then using fairly roundabout method  converting it to two lots of midi notes, adding to it to increase the pitch then sending it to some oscillators and finally mixing it back with the original input. If you change the numbers that I've added to the pitches here,&lt;br /&gt;&lt;br /&gt;    pitch1 = pitch.cpsmidi.round + 40;&lt;br /&gt;    pitch2 = pitch.cpsmidi.round + 60;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;you should be able to change the 'harmony'. &lt;br /&gt;&lt;br /&gt;There may be a better method to shift the synthesised pitches, I'm not sure but this does seem to work. &lt;br /&gt;It sort of sound okay with some guitar or vocal input, but really bad with anything more complex.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-6890452737036266864?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/6890452737036266864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/11/harmoniser-with-tartini.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/6890452737036266864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/6890452737036266864'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/11/harmoniser-with-tartini.html' title='&apos;Harmoniser&apos; with Tartini'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-7325093692134006864</id><published>2009-10-30T15:59:00.000-07:00</published><updated>2009-10-30T16:31:33.824-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='install'/><category scheme='http://www.blogger.com/atom/ns#' term='bbcut2'/><category scheme='http://www.blogger.com/atom/ns#' term='os x'/><category scheme='http://www.blogger.com/atom/ns#' term='bbcut'/><title type='text'>Installing bbcut2 in OS X</title><content type='html'>I've just upgraded to OS X Snow Leopard and apart from it giving me the ability to take up serpents, drink any deadly thing and not be hurt etc, I also found myself reinstalling SuperCollider from scratch, including all the extensions, quarks and what have you that I had in my previous install. &lt;br /&gt;Everything went smoothly with the exception of bbcut, which took a bit of work. I had the same problem when I installed it the first time round, but I ended up taking such as circuitous route to getting it working that I couldn't remember what I'd done by the time I'd finished. This time I took a more systematic approach and I've isolated the problem. &lt;br /&gt;The latest version of the extension pack provided with the standard SC install includes some, but not all of the Ugens and classes that come with bbcut. If you follow the install instructions that come with bbcut you'll end up with conflicts and the class library won't compile. &lt;br /&gt;To get it to work you'll need to leave out the three ugens in the bbcut2 ugens folder and the machinelistening classes from the bbcut2 classes folder when moving the bbcut folders to your SC directory. These seem to be the source of the conflicts and if you copy over the rest of the files as described in the bbcut2 help file it should all be okay. &lt;br /&gt;If you've already copied these into your SC folder you'll need to make sure you delete the version of the files that come with bbcut and replace the them with the versions that come with the standard SC download, they are different and only the ones from the standard SC download will work. And that's jazz. &lt;br /&gt;&lt;br /&gt;I've no idea how this goes on other platforms but I imagine there might be similar problems. &lt;br /&gt;&lt;br /&gt;à bientôt.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-7325093692134006864?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/7325093692134006864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/10/installing-bbcut2-in-os-x.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/7325093692134006864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/7325093692134006864'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/10/installing-bbcut2-in-os-x.html' title='Installing bbcut2 in OS X'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-8277085790600498938</id><published>2009-10-18T16:34:00.001-07:00</published><updated>2009-10-18T17:06:33.459-07:00</updated><title type='text'>Wicki - not wiki</title><content type='html'>Another soupçon of useful code from the SC-Users list, a Wicki keybord, as used by the Wicki system. &lt;br /&gt;What's the Wicki system? I'm not entirely sure, but it seems to be a way of learning to play music with a type writer style keyboard. There's some background info available &lt;a href="http://www.wicki.org.uk/?page_id=23"&gt;here&lt;/a&gt; and &lt;a href="http://www.concertina.com/gaskins/wicki/"&gt;here&lt;/a&gt;. &lt;br /&gt;This bit of code is a class that creates a Wicki keyboard, it is a bit long so I won't reproduce it on this blog, but you can download it &lt;a href="http://sites.google.com/site/supercolliderfiles/Home/MiniWicki.zip?attredirects=0"&gt;here, along with a bit of test code&lt;/a&gt;. You can use the keyboard to record and playback sequences of notes, which are stored in an array, probably easier than typing frequencies or midi values directly into patterns and do things like transpose the entire sequence. &lt;br /&gt;As with all SC classes you'll need to put it in the extensions folder and recompile the language before it'll work. The wickiTest file in the zip shows of some of the class methods, but it doesn't mention the startRecording and stopRecording methods. If you want to record an a array of notes you'll need to set it up by doing something like&lt;br /&gt;m.startRecording &lt;br /&gt;and then &lt;br /&gt;m.stopRecording&lt;br /&gt;when you're done.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-8277085790600498938?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/8277085790600498938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/10/wicki-not-wiki.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8277085790600498938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8277085790600498938'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/10/wicki-not-wiki.html' title='Wicki - not wiki'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-2198367656543394316</id><published>2009-10-03T16:59:00.000-07:00</published><updated>2009-10-03T17:06:21.962-07:00</updated><title type='text'>From Den Haag</title><content type='html'>Some great code from &lt;a href="http://www.iamas.ac.jp/~tn800/"&gt;tn8&lt;/a&gt;, via the SC-Users list, the source code from a piece that she performed at the SC symposium. &lt;a href="http://www.tn8.jp/inHaag/"&gt;You can download it here&lt;/a&gt;. &lt;br /&gt;It's a fantastic track and it's pretty rare to see the complete source for a song written entirely in SC, so it's worth a look.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-2198367656543394316?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/2198367656543394316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/10/from-den-haag.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/2198367656543394316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/2198367656543394316'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/10/from-den-haag.html' title='From Den Haag'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-9195841927405463524</id><published>2009-09-17T17:50:00.000-07:00</published><updated>2009-09-17T17:56:58.698-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='comb filter'/><category scheme='http://www.blogger.com/atom/ns#' term='Gui'/><category scheme='http://www.blogger.com/atom/ns#' term='effect'/><title type='text'>Comb Filter Effect</title><content type='html'>Another handy snippet of code pulled from the SC-Users list once again. Credit for this goes to Kernal, kernel@audiospillage.com. &lt;br /&gt;The gui should be mostly self explanatory I think, but if you want to use this with other inputs besides the test sound you'll need to set the input bus and send your sound through that. &lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;// parrallel comb filters implemented as effect return&lt;br /&gt;&lt;br /&gt;// send the synth defs(&lt;br /&gt;(&lt;br /&gt;SynthDef(&amp;quot;ImpulseTest&amp;quot;, {&amp;#124;bus = 3&amp;#124;&lt;br /&gt;       &lt;br /&gt;       Out.ar(bus, [Impulse.ar(SinOsc.kr(0.23).range(0.5,23), 0.5)]);&lt;br /&gt;       &lt;br /&gt;}).send(s);&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;SynthDef(&amp;quot;CombUnit&amp;quot;,{&amp;#124;  d1 = 0.001, d2 = 0.001, d3 = 0.001, d4 = 0.001, d5 = 0.001,&lt;br /&gt;                                       t1 = 1, t2 = 1, t3 = 1, t4 = 1, t5 = 1,&lt;br /&gt;                                       f1 = 20000, f2 = 20000, f3 = 20000, f4 = 20000, f5 = 20000,&lt;br /&gt;                                       vol = 1, inBus = 3, outBus = 0&amp;#124;&lt;br /&gt;                                       &lt;br /&gt;       var in, out, c1, c2, c3, c4, c5;&lt;br /&gt;&lt;br /&gt;       in = In.ar(inBus, 1);&lt;br /&gt;&lt;br /&gt;       c1 = LPF.ar(CombC.ar(in, 1, d1, t1), f1);&lt;br /&gt;       c2 = LPF.ar(CombC.ar(in, 1, d2, t2), f2);&lt;br /&gt;       c3 = LPF.ar(CombC.ar(in, 1, d3, t3), f3);&lt;br /&gt;       c4 = LPF.ar(CombC.ar(in, 1, d4, t4), f4);&lt;br /&gt;       c5 = LPF.ar(CombC.ar(in, 1, d5, t5), f5);&lt;br /&gt;       &lt;br /&gt;       out = (c1 + c2 + c3 + c4 + c5) * 0.2;&lt;br /&gt;       &lt;br /&gt;       Out.ar([outBus, outBus + 1], out * vol);&lt;br /&gt;&lt;br /&gt;}).send(s);&lt;br /&gt;);&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// create the synth&lt;br /&gt;(&lt;br /&gt;       var grp, node, testNode, wComb, testRunning = 0, inputBus = 3;&lt;br /&gt;       &lt;br /&gt;       s.sendMsg(&amp;quot;s_new&amp;quot;, &amp;quot;CombUnit&amp;quot;, node = s.nextNodeID, 1, 1);&lt;br /&gt;       // s.sendMsg(&amp;quot;g_new&amp;quot;,grp = s.nextNodeID,1,1); // create group @ tail of default node&lt;br /&gt;       &lt;br /&gt;       wComb = SCWindow(&amp;quot;C O M A&amp;quot;, Rect(100, 300, 720, 220))&lt;br /&gt;               .onClose_({&lt;br /&gt;                       if(testRunning == 1, s.sendMsg(&amp;quot;n_free&amp;quot;, testNode));&lt;br /&gt;                       s.sendMsg(&amp;quot;n_free&amp;quot;, node);&lt;br /&gt;               })&lt;br /&gt;               .front;&lt;br /&gt;       &lt;br /&gt;       // input bus&lt;br /&gt;       SCNumberBox(wComb, Rect(10, 10, 30, 20))&lt;br /&gt;               .value_(3)&lt;br /&gt;               .action_({&amp;#124;v&amp;#124;&lt;br /&gt;                       inputBus = v.value;&lt;br /&gt;                       s.sendMsg(&amp;quot;n_set&amp;quot;, node, &amp;quot;inBus&amp;quot;, inputBus);&lt;br /&gt;                       if(testRunning == 0, s.sendMsg(&amp;quot;n_set&amp;quot;, testNode, &amp;quot;bus&amp;quot;, inputBus));&lt;br /&gt;               });&lt;br /&gt;       &lt;br /&gt;       SCStaticText(wComb, Rect(45, 10, 100, 20))&lt;br /&gt;               .string_(&amp;quot;Input Bus&amp;quot;);&lt;br /&gt;       &lt;br /&gt;       // output bus&lt;br /&gt;       SCNumberBox(wComb, Rect(150, 10, 30, 20))&lt;br /&gt;               .value_(0)&lt;br /&gt;               .action_({&amp;#124;v&amp;#124; s.sendMsg(&amp;quot;n_set&amp;quot;, node, &amp;quot;outBus&amp;quot;, v.value)});&lt;br /&gt;       &lt;br /&gt;       SCStaticText(wComb, Rect(185, 10, 100, 20))&lt;br /&gt;               .string_(&amp;quot;Output Bus&amp;quot;);&lt;br /&gt;       &lt;br /&gt;       // audio test&lt;br /&gt;       SCButton(wComb, Rect(300, 10, 100, 20))&lt;br /&gt;               .states_([&lt;br /&gt;                       [&amp;quot;Start Test&amp;quot;, Color.green, Color.black],&lt;br /&gt;                       [&amp;quot;Stop Test&amp;quot;, Color.red, Color.black]&lt;br /&gt;               ])&lt;br /&gt;               .action_({&lt;br /&gt;                       if(testRunning == 0, {&lt;br /&gt;                               s.sendMsg(&amp;quot;s_new&amp;quot;, &amp;quot;ImpulseTest&amp;quot;, testNode = s.nextNodeID, 0, 1, &amp;quot;bus&amp;quot;, inputBus);&lt;br /&gt;                               testRunning = 1;&lt;br /&gt;                       },{&lt;br /&gt;                               s.sendMsg(&amp;quot;n_free&amp;quot;, testNode);&lt;br /&gt;                               testRunning = 0;&lt;br /&gt;                       });&lt;br /&gt;               });&lt;br /&gt;       &lt;br /&gt;       // comb frequencies&lt;br /&gt;       SCStaticText(wComb, Rect(10, 40, 100, 20)).string_(&amp;quot;Comb Frequencies&amp;quot;);&lt;br /&gt;       5.do{&amp;#124;i&amp;#124;&lt;br /&gt;               var box;&lt;br /&gt;               &lt;br /&gt;               box = SCNumberBox(wComb, Rect(10, 60 + (i * 25), 40, 20))&lt;br /&gt;                       .value_(950);&lt;br /&gt;                       &lt;br /&gt;               SCStaticText(wComb, Rect(55, 60 + (i * 25), 15, 20)).string_(&amp;quot;Hz&amp;quot;);&lt;br /&gt;               &lt;br /&gt;               SCSlider(wComb, Rect(80, 60 +  (i * 25), 130, 20))&lt;br /&gt;                       .value_(0.5)&lt;br /&gt;                       .action_({&amp;#124;v&amp;#124; var time, freq;&lt;br /&gt;                               freq = [1, 20000, 6].asSpec.map(v.value);&lt;br /&gt;                               time = 1.0 / freq;&lt;br /&gt;                               s.sendMsg(&amp;quot;n_set&amp;quot;, node, i, time);&lt;br /&gt;                               box.value_(freq.asInteger);&lt;br /&gt;                       })&lt;br /&gt;       };&lt;br /&gt;       &lt;br /&gt;       // resonances&lt;br /&gt;       SCStaticText(wComb, Rect(250, 40, 100, 20)).string_(&amp;quot;Resonances&amp;quot;);&lt;br /&gt;       5.do{&amp;#124;i&amp;#124;&lt;br /&gt;               var box;&lt;br /&gt;               &lt;br /&gt;               box = SCNumberBox(wComb, Rect(250, 60 + (i * 25), 30, 20))&lt;br /&gt;                       .value_(50);&lt;br /&gt;                       &lt;br /&gt;               SCStaticText(wComb, Rect(285, 60 + (i * 25), 15, 20)).string_(&amp;quot;%&amp;quot;);&lt;br /&gt;               &lt;br /&gt;               SCSlider(wComb, Rect(300, 60 + (i * 25), 150, 20))&lt;br /&gt;                       .value_(0.5)&lt;br /&gt;                       .action_({&amp;#124;v&amp;#124;&lt;br /&gt;                               s.sendMsg(&amp;quot;n_set&amp;quot;, node, i+5, [0, 9, 4].asSpec.map(v.value));&lt;br /&gt;                               box.value_(v.value * 100);&lt;br /&gt;                       });&lt;br /&gt;       };&lt;br /&gt;       &lt;br /&gt;       // low pass frequencies&lt;br /&gt;       SCStaticText(wComb, Rect(555, 40, 100, 20)).string_(&amp;quot;Low Pass Frequencies&amp;quot;);&lt;br /&gt;       5.do{&amp;#124;i&amp;#124;&lt;br /&gt;               var box;&lt;br /&gt;               &lt;br /&gt;               box = SCNumberBox(wComb, Rect(490, 60 + (i * 25), 40, 20)).value_(20000);&lt;br /&gt;               SCStaticText(wComb, Rect(535, 60 + (i * 25), 15, 20)).string_(&amp;quot;Hz&amp;quot;);&lt;br /&gt;               &lt;br /&gt;               SCSlider(wComb, Rect(555, 60 + (i * 25), 150, 20))&lt;br /&gt;                       .value_(1)&lt;br /&gt;                       .action_({ &amp;#124;v&amp;#124; var freq;&lt;br /&gt;                               freq = [20, 20000, \exp].asSpec.map(v.value);&lt;br /&gt;                               s.sendMsg(&amp;quot;n_set&amp;quot;, node, i+10, freq);&lt;br /&gt;                               box.value_(freq);&lt;br /&gt;                       });&lt;br /&gt;       };&lt;br /&gt;       &lt;br /&gt;       // volume control&lt;br /&gt;       SCStaticText(wComb, Rect(10, 190, 70, 20)).string_(&amp;quot;Volume&amp;quot;);&lt;br /&gt;       SCSlider(wComb, Rect(80, 190, 625, 20))&lt;br /&gt;               .value_(1)&lt;br /&gt;               .action_({&amp;#124;v&amp;#124; s.sendMsg(&amp;quot;n_set&amp;quot;, node, &amp;quot;vol&amp;quot;, [0, 1, 4].asSpec.map(v.value))});&lt;br /&gt;)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-9195841927405463524?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/9195841927405463524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/09/comb-filter-effect.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/9195841927405463524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/9195841927405463524'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/09/comb-filter-effect.html' title='Comb Filter Effect'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-5371415854419207180</id><published>2009-08-21T14:58:00.000-07:00</published><updated>2009-08-21T15:20:49.924-07:00</updated><title type='text'>More 140 character SuperCollider Tweets</title><content type='html'>Even SuperCollidists aren't immune to the memetic allure of Twitter, there's been a whole load of 140 character SuperCollider programmes appearing both on Twitter and on the SC Users list. Thankfully someone has been kind enough to collect them all up and put them on &lt;a href="http://swiki.hfbk-hamburg.de:8888/MusicTechnology/899"&gt;this page here&lt;/a&gt;, at the SC Wiki. Smashing. &lt;br /&gt;&lt;br /&gt;Here's a couple of my favorites, &lt;br /&gt;&lt;br /&gt;from Fredrik Olofsson&lt;br /&gt;&lt;br /&gt;{RHPF.ar(GbmanN.ar([2300,1150]),LFSaw.ar(Pulse.ar(4,[1,2]/8,1,LFPulse.ar(1/8)/5+1))+2)}.play&lt;br /&gt;&lt;br /&gt;And from the Venerable Dan&lt;br /&gt;&lt;br /&gt;{LocalOut.ar(a=DynKlank.ar(`[LocalIn.ar.clip2(LFPulse.kr([1,2,1/8]).sum/2)**100*100],Impulse.ar(10)));HPF.ar(a).clip2!2}.play//#supercollider&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-5371415854419207180?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/5371415854419207180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/08/more-140-character-supercollider-tweets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/5371415854419207180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/5371415854419207180'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/08/more-140-character-supercollider-tweets.html' title='More 140 character SuperCollider Tweets'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-5559494263864229639</id><published>2009-08-09T14:45:00.000-07:00</published><updated>2009-08-09T14:56:46.659-07:00</updated><title type='text'>Recreating the THX sound</title><content type='html'>In a similar vein to the &lt;a href="http://superdupercollider.blogspot.com/2009/06/deconstructing-dominator.html"&gt;recreation of the rave hoover&lt;/a&gt; here's another reverse engineer and recreation of a famous sound, the tooth shattering &lt;a href="http://en.wikipedia.org/wiki/Deep_Note"&gt;TXH Deep Note&lt;/a&gt;. You can read the &lt;a href="http://www.batuhanbozkurt.com/instruction/recreating-the-thx-deep-note"&gt;full story on EarSlap&lt;/a&gt;, but here's the final code. &lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;//inverting init sort, louder bass, final volume envelope, some little tweaks&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;var numVoices = 30;&lt;br /&gt;&lt;br /&gt;var fundamentals = ({rrand(200.0, 400.0)}!numVoices).sort.reverse;&lt;br /&gt;&lt;br /&gt;var finalPitches = (numVoices.collect({&amp;#124;nv&amp;#124; (nv/(numVoices/6)).round * 12; }) + 14.5).midicps;&lt;br /&gt;&lt;br /&gt;var outerEnv = EnvGen.kr(Env([0, 0.1, 1], [8, 4], [2, 4]));&lt;br /&gt;&lt;br /&gt;var ampEnvelope = EnvGen.kr(Env([0, 1, 1, 0], [3, 21, 3], [2, 0, -4]), doneAction: 2);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;var snd = Mix&lt;br /&gt;&lt;br /&gt;({&amp;#124;numTone&amp;#124;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    var initRandomFreq = fundamentals[numTone] + LFNoise2.kr(0.5, 6 * (numVoices - (numTone + 1)));&lt;br /&gt;&lt;br /&gt;    var destinationFreq = finalPitches[numTone] + LFNoise2.kr(0.1, (numTone / 3));&lt;br /&gt;&lt;br /&gt;    var sweepEnv =&lt;br /&gt;&lt;br /&gt;        EnvGen.kr(&lt;br /&gt;&lt;br /&gt;            Env([0, rrand(0.1, 0.2), 1], [rrand(5.5, 6), rrand(8.5, 9)],&lt;br /&gt;&lt;br /&gt;                [rrand(2.0, 3.0), rrand(4.0, 5.0)]));&lt;br /&gt;&lt;br /&gt;    var freq = ((1 - sweepEnv) * initRandomFreq) + (sweepEnv * destinationFreq);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    Pan2.ar&lt;br /&gt;&lt;br /&gt;    (&lt;br /&gt;&lt;br /&gt;        BLowPass.ar(Saw.ar(freq), freq * 6, 0.6),&lt;br /&gt;&lt;br /&gt;        rrand(-0.5, 0.5),&lt;br /&gt;&lt;br /&gt;        (1 - (1/(numTone + 1))) * 1.5&lt;br /&gt;&lt;br /&gt;    ) / numVoices&lt;br /&gt;&lt;br /&gt;}!numVoices);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Limiter.ar(BLowPass.ar(snd, 2000 + (outerEnv * 18000), 0.5, (2 + outerEnv) * ampEnvelope));&lt;br /&gt;&lt;br /&gt;}.play;&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Apparently the original took 20,000 lines of C code! This is a tad more efficient and sounds very close to the original.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-5559494263864229639?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/5559494263864229639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/08/recreating-thx-sound.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/5559494263864229639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/5559494263864229639'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/08/recreating-thx-sound.html' title='Recreating the THX sound'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-8582009794190205861</id><published>2009-07-25T17:45:00.000-07:00</published><updated>2009-07-25T17:51:18.175-07:00</updated><title type='text'>Auto chiptunes with Moog</title><content type='html'>Wow, it's been a while since I've posted, but It's been a busy month. &lt;br /&gt;Here's an update to Dan's auto chiptune thing that I modified in my last post. This time I decided to mate it with my Moog synthdef in an attempt to create a pitch tracking interface for my synth. Surprisingly it works pretty well. &lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;(&lt;br /&gt;SynthDef(&amp;quot;chiptune&amp;quot;, { &amp;#124;oscType =0, oscType2 = 1, pan = 0, level = 0.5, cutoff = 500, gain = 3.3, attack = 0.1, decay = 0.1, sust = 0.7, rel = 0.2, attackf = 0.1, decayf = 0.1, sustf = 0.9, relf = 0.2, gate = 1, freq =440, lagLev = 0.2&amp;#124;&lt;br /&gt;    var son, pitch, amp, wibble, oscArray, oscArray2, ampEnv, filterEnv, osc1, osc2, fade, filter;&lt;br /&gt;    son = SoundIn.ar;&lt;br /&gt;    pitch = Tartini.kr(son)[0];&lt;br /&gt;    amp = Amplitude.ar(son);&lt;br /&gt;    pitch = Median.kr(5, pitch); // smooth&lt;br /&gt;    pitch = pitch.min(10000).max(10); // limit&lt;br /&gt;    pitch = pitch.cpsmidi.round.midicps; // coerce&lt;br /&gt;    &lt;br /&gt;    oscArray = [Saw.ar(Lag.kr(pitch, lagLev)), SinOsc.ar(Lag.kr(pitch, lagLev)), Pulse.ar(Lag.kr(pitch, lagLev))];&lt;br /&gt;    oscArray2 = [Saw.ar(Lag.kr(pitch, lagLev)), SinOsc.ar(Lag.kr(pitch, lagLev)), Pulse.ar(Lag.kr(pitch, lagLev))];&lt;br /&gt;    ampEnv = EnvGen.ar(Env.adsr(attack, decay, sust, rel), gate, doneAction:2);&lt;br /&gt;    filterEnv = EnvGen.ar(Env.adsr(attackf, decayf, sustf, relf), gate, doneAction:2);&lt;br /&gt;     osc1 = Select.ar(oscType, oscArray);&lt;br /&gt;     osc2 = Select.ar(oscType2, oscArray2);&lt;br /&gt;    fade = Pan2.ar(XFade2.ar(osc1, osc2, pan , level * ampEnv, 0));&lt;br /&gt;    filter = MoogFF.ar(fade, cutoff * filterEnv, gain);   &lt;br /&gt;     wibble = FreeVerb.ar(filter, 0.3, 0.1, 0.9); // bit of reverb just to taste&lt;br /&gt;    Out.ar(0, wibble.dup);&lt;br /&gt;}).memStore;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-8582009794190205861?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/8582009794190205861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/07/auto-chiptunes-with-moog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8582009794190205861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8582009794190205861'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/07/auto-chiptunes-with-moog.html' title='Auto chiptunes with Moog'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-581700941072734758</id><published>2009-07-05T16:39:00.000-07:00</published><updated>2009-07-05T17:05:30.934-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chiptune'/><category scheme='http://www.blogger.com/atom/ns#' term='tartini.'/><category scheme='http://www.blogger.com/atom/ns#' term='guitar effects'/><title type='text'>Auto Chiptune</title><content type='html'>A while ago now Dan posted some auto chip tune generating code on his blog, I've been meaning to write about this for ages, but I've only just got round to it. It takes any MP3 file and converts it to chiptune like sounds by using Tartini to follow the pitch and then re synthesising with a pulse wave. Here's the original code as taken from his &lt;a href="http://www.mcld.co.uk/blog/blog.php?235"&gt;blog&lt;/a&gt;. &lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;s.boot;&lt;br /&gt;(&lt;br /&gt;SynthDef(&amp;quot;help_mp3_01&amp;quot;, { &amp;#124;bufnum = 0&amp;#124;&lt;br /&gt;    var son, pitch, amp, wibble;&lt;br /&gt;    son = DiskIn.ar(2, bufnum).mean;&lt;br /&gt;    pitch = Tartini.kr(son)[0];&lt;br /&gt;    amp = Amplitude.ar(son);&lt;br /&gt;    pitch = Median.kr(5, pitch); // smooth&lt;br /&gt;    pitch = pitch.min(10000).max(10); // limit&lt;br /&gt;    pitch = pitch.cpsmidi.round.midicps; // coerce&lt;br /&gt;    wibble = Pulse.ar(pitch, 0.2, amp * 2); // resynthesise&lt;br /&gt;    wibble = FreeVerb.ar(wibble, 0.3, 0.1, 0.9); // bit of reverb just to taste&lt;br /&gt;    Out.ar(0, wibble.dup);&lt;br /&gt;}).memStore;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;// Now let's create the MP3 object and cue it into a Buffer.&lt;br /&gt;m = MP3(&amp;quot;../mp3s/Gimme A Pig Foot And A Bottle Of Beer.mp3&amp;quot;);   &lt;br /&gt;m.start;&lt;br /&gt;b = Buffer.cueSoundFile(s, m.fifo, 0, 2);&lt;br /&gt;// Off we go:&lt;br /&gt;x = Synth(&amp;quot;help_mp3_01&amp;quot;, [\bufnum, b.bufnum], addAction:\addToTail);&lt;br /&gt;&lt;br /&gt;// Please remember to tidy up after yourself:&lt;br /&gt;x.free;&lt;br /&gt;b.close; b.free;&lt;br /&gt;m.finish;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Just for the hell of it I decided to adapt it to use live audio input and give it three different oscillators to choose from. Here's my version, you can change the oscillator with the \oscType parameter.&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;(&lt;br /&gt;SynthDef(&amp;quot;chiptune&amp;quot;, { &amp;#124;oscType = 0&amp;#124;&lt;br /&gt;    var son, pitch, amp, wibble, oscArray;&lt;br /&gt;    son = SoundIn.ar;&lt;br /&gt;    pitch = Tartini.kr(son)[0];&lt;br /&gt;    amp = Amplitude.ar(son);&lt;br /&gt;    pitch = Median.kr(5, pitch); // smooth&lt;br /&gt;    pitch = pitch.min(10000).max(10); // limit&lt;br /&gt;    pitch = pitch.cpsmidi.round.midicps; // coerce&lt;br /&gt;    oscArray = [Pulse.ar(pitch, 0.2, amp * 2), SinOsc.ar(pitch, 0, amp * 2), Saw.ar(pitch, amp * 2)];&lt;br /&gt;    wibble = Select.ar(oscType, oscArray); // resynthesise&lt;br /&gt;    wibble = FreeVerb.ar(wibble, 0.3, 0.1, 0.9); // bit of reverb just to taste&lt;br /&gt;    Out.ar(0, wibble.dup);&lt;br /&gt;}).memStore;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// Off we go:&lt;br /&gt;x = Synth(&amp;quot;chiptune&amp;quot;, [\oscType, 1], addAction:\addToTail);&lt;br /&gt;&lt;br /&gt;// Please remember to tidy up after yourself:&lt;br /&gt;x.free;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;sounds pretty good with guitar.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-581700941072734758?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/581700941072734758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/07/auto-chiptune.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/581700941072734758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/581700941072734758'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/07/auto-chiptune.html' title='Auto Chiptune'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-4907061169671213130</id><published>2009-06-25T17:03:00.001-07:00</published><updated>2009-06-25T17:11:47.945-07:00</updated><title type='text'>SuperCollider 3.3.1 is out - Safari 4 fix.</title><content type='html'>&lt;a href="http://sourceforge.net/project/showfiles.php?group_id=54622"&gt;SuperCollider 3.3.1&lt;/a&gt; is out now and it works with Safari 4! I don't know about you but that's a weight off my mind.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-4907061169671213130?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/4907061169671213130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/06/supercollider-331-is-out-safari-4-fix.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/4907061169671213130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/4907061169671213130'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/06/supercollider-331-is-out-safari-4-fix.html' title='SuperCollider 3.3.1 is out - Safari 4 fix.'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-5609561518899357281</id><published>2009-06-18T15:16:00.000-07:00</published><updated>2009-06-18T16:18:12.501-07:00</updated><title type='text'>A Generative Looper.</title><content type='html'>What's a generative looper? It's a type of cartilaginous fish, but it's also a interesting new project from Arthur Carabot, via the SC Users list. &lt;a href="http://github.com/acarabott/GenLoop/tree/master"&gt;Here's the source&lt;/a&gt; and &lt;a href="http://vimeo.com/5220526"&gt;here's an intructional video&lt;/a&gt;.&lt;br /&gt;I can't get it to work at the moment but maybe it's just me.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-5609561518899357281?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/5609561518899357281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/06/generative-looper.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/5609561518899357281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/5609561518899357281'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/06/generative-looper.html' title='A Generative Looper.'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-3207541186107125284</id><published>2009-06-16T16:25:00.000-07:00</published><updated>2009-06-16T17:09:14.479-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rave hoover'/><category scheme='http://www.blogger.com/atom/ns#' term='pulse modulation'/><title type='text'>More Dominator Deconstruction.</title><content type='html'>Another attempt at the rave hoover sound, this time from Wouter Snoei on the &lt;a href="http://www.listarc.bham.ac.uk/lists/sc-users/msg53728.html"&gt;SC-Users list&lt;/a&gt;, probably the best so far and based on further research into the Alpha Juno 2. Here's the code, &lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;(&lt;br /&gt;SynthDef( &amp;quot;hoover&amp;quot;, { &amp;#124;freq = 220, amp = 0.1, lgu = 0.1, lgd = 1, gate = 1&amp;#124;&lt;br /&gt;var pwm, mix, env;&lt;br /&gt;&lt;br /&gt;freq = freq.cpsmidi.lag(lgu,lgd).midicps;&lt;br /&gt;freq = SinOsc.kr( { 2.9 rrand: 3.1 }!3, {2pi.rand}!3 ).exprange( 0.995, 1.005 ) * freq;&lt;br /&gt;pwm = SinOsc.kr( {2.0 rrand: 4.0}!3 ).range(0.125,0.875);&lt;br /&gt;&lt;br /&gt;// the saw/pulses&lt;br /&gt;mix = (LFSaw.ar( freq * [0.25,0.5,1], 1 ).range(0,1)&lt;br /&gt;               * (1 - LFPulse.ar(freq * [0.5,1,2], 0, pwm))).sum * 0.1;&lt;br /&gt;&lt;br /&gt;// the bass&lt;br /&gt;mix = mix + LFPar.ar( freq * 0.25, 0, 0.1 );&lt;br /&gt;&lt;br /&gt;// eq for extra sharpness&lt;br /&gt;mix = BPeakEQ.ar( mix, 6000, 1, 3 );&lt;br /&gt;mix = BPeakEQ.ar( mix, 3500, 1, 6 );&lt;br /&gt;&lt;br /&gt;// kind of chorus&lt;br /&gt;mix = mix + CombC.ar( mix.dup, 1/200,&lt;br /&gt;                       SinOsc.kr( 3, [0.5pi, 1.5pi] ).range(1/300,1/200),&lt;br /&gt;               0.0 ) * 0.5;&lt;br /&gt;&lt;br /&gt;env = EnvGen.kr( Env.asr, gate );&lt;br /&gt;&lt;br /&gt;Out.ar( 0, mix * env * amp );&lt;br /&gt;}).store;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;p = Pmono(\hoover,&lt;br /&gt;               \dur, Pseq([0.25,0.5,7, 0.25]* 0.24, inf),&lt;br /&gt;               \lgu, 0.15,&lt;br /&gt;               \lgd, Pseq([ 0.1, 0.1, 1.5, 0.25], inf ),&lt;br /&gt;               \midinote, Pseq([20, 67, 62, 20] , inf)).play;&lt;br /&gt;)&lt;br /&gt;p.stop;&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;p = Pmono(\hoover, \dur, 0.24,&lt;br /&gt;       \lgu, 0.2,&lt;br /&gt;       \lgd, Pseq([1,1,2,0.5,2,2,2,2], inf ),&lt;br /&gt;        \midinote, Pseq([55, 40, 67, 55, 40, 55, 53, 52], inf)).play;&lt;br /&gt;)&lt;br /&gt;p.stop;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt; &lt;br /&gt;&lt;br /&gt;Wouter's come up with a more accurate version of the pulse width modulation, certainly more accurate than my complete guess work and it sounds great. &lt;br /&gt;&lt;br /&gt;Here's a little line of code taken from Wouter's post that may offer a bit of an explaination of what's going on with the modulation. &lt;br /&gt;&lt;br /&gt;{ LFSaw.ar( 200, 1 ).range(0,1) * (1-LFPulse.ar( 400, 0, 2/3 )) }.plot;&lt;br /&gt;&lt;br /&gt;If you run it you should get this plot, &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_6VFosdOGMs4/Sjgt3sduiTI/AAAAAAAAABo/g5PUbx8jfGc/s1600-h/Picture+5.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 195px;" src="http://3.bp.blogspot.com/_6VFosdOGMs4/Sjgt3sduiTI/AAAAAAAAABo/g5PUbx8jfGc/s320/Picture+5.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5348074992354363698" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can see the waveform is a sort of flattened saw wave, this might explain why Dan had trouble identifying what it was.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-3207541186107125284?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/3207541186107125284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/06/more-dominator-deconstruction.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3207541186107125284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3207541186107125284'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/06/more-dominator-deconstruction.html' title='More Dominator Deconstruction.'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_6VFosdOGMs4/Sjgt3sduiTI/AAAAAAAAABo/g5PUbx8jfGc/s72-c/Picture+5.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-3853075559374803741</id><published>2009-06-14T16:30:00.001-07:00</published><updated>2009-06-16T17:08:56.333-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rave hoover'/><category scheme='http://www.blogger.com/atom/ns#' term='pulse modulation'/><title type='text'>Deconstructing the Dominator</title><content type='html'>Dan's got a post over on his blog about &lt;a href="http://www.mcld.co.uk/blog/blog.php?254"&gt;reverse engineering the "hoover sound'&lt;/a&gt; found in the old school rave classic Dominator by Human Resource. He took a pretty technical approach and did various forms of analysis to come up with something that sound pretty good. &lt;br /&gt;I thought I'd have a go myself, but I decided to take a more direct approach and look it up. I found &lt;a href="http://en.wikipedia.org/wiki/Hoover_sound"&gt;this wikipedia article&lt;/a&gt; about it, it turns out that Human Resource were using a Roland Alpha Juno 2 to create that sound, a mid 80's digital/analogue hybrid synth. There's a good explanation of it's features &lt;a href="http://homepage.mac.com/synth_seal/html/ajuno1a.html"&gt;here&lt;/a&gt;, importantly though, it does have a chorus unit built in, which Dan did identify as being the key feature of the sound. &lt;br /&gt;&lt;br /&gt;Here's my re-construction attempt, I did start out to try and recreate the functions of an Alpha Juno 2, but in the end I mostly just improvised. &lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;(&lt;br /&gt;SynthDef(\aj2, {&lt;br /&gt;arg freq = 440, gate = 1, lagLev = 0.01, predelay=0.01, speed=0.05, depth=0.01, ph_diff=0.5;&lt;br /&gt; var width1, width2, width3, osc1, osc2, osc3, filterOut, mix, sig, modulators, numDelays = 8, lfo; &lt;br /&gt; width1 = SinOsc.ar(4, 0, 0.8, 0.2).abs;&lt;br /&gt; width2 = SinOsc.ar(6, 0, 0.8, 0.2).abs;&lt;br /&gt; width3 = SinOsc.ar(2, 0, 0.8, 0.2).abs;&lt;br /&gt; lfo = SinOsc.kr(5, 0, 5);&lt;br /&gt; osc1 = Pulse.ar(Lag.kr(freq + lfo), width1);&lt;br /&gt; osc2 = Pulse.ar(Lag.kr((freq/2) + lfo), 0.5);&lt;br /&gt; osc3 = Pulse.ar(Lag.kr((freq*2) + lfo), width3);&lt;br /&gt; mix = Mix.new([osc1, osc2, osc3]);&lt;br /&gt; modulators = Array.fill(numDelays, {arg i;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;    SinOsc.kr(speed * rrand(0.94, 1.06), ph_diff * i, depth, predelay);});&amp;#160;&lt;br /&gt;    sig = DelayC.ar(mix, 0.5, modulators);&amp;#160;&amp;#160;&lt;br /&gt;    sig = sig.sum; &lt;br /&gt;    Out.ar(0, sig.dup)&lt;br /&gt;}).store&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;p = Pmono(\aj2, \dur, 0.24, \midinote, Pseq([40, 67, 64, 62, 62, 62, 62, 62], inf)).play;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I've got three pulse width modulated square wave oscillators here, modulated with low frequency SinOscs and some vibrato added with another low frequency SinOsc. These are put through a chorus efect taken from the &lt;a href="http://www.ixi-audio.net/content/backyard.html"&gt;ixi-audio.com&lt;/a&gt; tutorial, featured here before. &lt;br /&gt;&lt;br /&gt;My patch is mostly based on random guesswork and a little bit of research, but it sounds okay, though probably not as good as Dan's scientific attempt.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-3853075559374803741?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/3853075559374803741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/06/deconstructing-dominator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3853075559374803741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3853075559374803741'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/06/deconstructing-dominator.html' title='Deconstructing the Dominator'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-6780904836413878112</id><published>2009-06-08T13:35:00.000-07:00</published><updated>2009-06-08T13:44:29.903-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SuperColliderAU'/><category scheme='http://www.blogger.com/atom/ns#' term='bitcrusher'/><category scheme='http://www.blogger.com/atom/ns#' term='effect'/><title type='text'>2 channel bitcrusher</title><content type='html'>A small update to my bitcrusher plugin, duplicating the bitchrushed output for 'stereo'. The old version had only 1 channel output, which was to be expected as the input was only 1 channel, but this meant that in Garageband at least the signal was just one channel of a 2 channel track. In effect that the signal was panned all the way to the left with no way of centering it, duplicating the output works round this. &lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;( var name, func, specs, componentType, componentSubtype, builder;&lt;br /&gt;&lt;br /&gt;name = &amp;quot;Decimator&amp;quot;; // name of your plugin&lt;br /&gt;func =  {&lt;br /&gt;     &amp;#124; sampleRate,  bitRate&amp;#124;&lt;br /&gt;     &lt;br /&gt;     var decOut, in;&lt;br /&gt;    &lt;br /&gt;    in = AudioIn.ar([1]);  //Input from AU  host&lt;br /&gt;    &lt;br /&gt;    decOut = Decimator.ar(in, sampleRate , bitRate).dup;&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;    Out.ar([0,1], decOut);//Output to AU host&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;specs =  #[ &lt;br /&gt;    [0, 20000 , \Linear, 10000,\Hertz ] ,&lt;br /&gt;    [0, 16 , \Linear, 8,\Indexed ] &lt;br /&gt;];    &lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;componentType = \aufx;&lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;componentSubtype = \DECI; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;builder = AudioUnitBuilder.new(name, componentSubtype,func, specs, componentType);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;builder.makeInstall; &lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-6780904836413878112?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/6780904836413878112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/06/2-channel-bitcrusher.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/6780904836413878112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/6780904836413878112'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/06/2-channel-bitcrusher.html' title='2 channel bitcrusher'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-3780299632907404950</id><published>2009-05-31T17:20:00.000-07:00</published><updated>2009-05-31T17:26:56.261-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hadron'/><title type='text'>Hadron</title><content type='html'>Anonther intersting new quark,&lt;a href="http://www.batuhanbozkurt.com/projectslab/supercollider/hadron"&gt;Hadron &lt;/a&gt;is a graphical patching environment for use in SC. Looks a bit like it may cover some of the same ground as &lt;a href="http://www.sampleandhold.org/projects/2009/04/11/teatracks-rc1/"&gt;TeaTracks&lt;/a&gt;, featured here previously, but I haven't used it yet. There is a very handy instructional video, which is allways nice.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-3780299632907404950?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/3780299632907404950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/05/hadron.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3780299632907404950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3780299632907404950'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/05/hadron.html' title='Hadron'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-6066124683037422204</id><published>2009-05-19T16:45:00.000-07:00</published><updated>2009-05-19T17:04:18.043-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='phaser'/><category scheme='http://www.blogger.com/atom/ns#' term='guitar effects'/><category scheme='http://www.blogger.com/atom/ns#' term='effect'/><title type='text'>Simple Phaser effect.</title><content type='html'>Another guitar effect, but also suitable for other things, a simple phaser. This example was adapted from the truly fantastic &lt;a href="http://www.ixi-audio.net/content/backyard.html"&gt;ixi-audio SuperCollider tutorial&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;(&lt;br /&gt;SynthDef(\phaser, { arg out=0, in=0; &lt;br /&gt;&lt;br /&gt;    var input,dsig, mixed;&lt;br /&gt;    input = SoundIn.ar(in, 1);&lt;br /&gt;    &lt;br /&gt;    dsig = AllpassL.ar(input, 4, SinOsc.ar(2, 0, 0.005, 0.005), 0);&lt;br /&gt;    mixed = input + dsig;&lt;br /&gt;    Out.ar([out, out+1], mixed);&lt;br /&gt;}).load(s);&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;a = Synth(\phaser, addAction:\addToTail)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Very similar to flange, but with a shorter delay time and no feedback, it's got a more otherworldly sound.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-6066124683037422204?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/6066124683037422204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/05/simple-phaser-effect.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/6066124683037422204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/6066124683037422204'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/05/simple-phaser-effect.html' title='Simple Phaser effect.'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-8044109048114230244</id><published>2009-05-12T15:56:00.000-07:00</published><updated>2009-07-08T09:47:53.415-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='SuperColliderAU'/><category scheme='http://www.blogger.com/atom/ns#' term='bitcrusher'/><category scheme='http://www.blogger.com/atom/ns#' term='effect'/><title type='text'>Creating plugins with SuperCollider AU</title><content type='html'>&lt;a href="http://supercolliderau.sourceforge.net/"&gt;SuperColliderAU&lt;/a&gt; is an AudioUnit wrapper that allows you to embed a SuperCollider server in a AU host and either control it through SClang or package it up as a stand alone plugin. &lt;br /&gt;It is of course OS X only being based around Apples AU API and there are some limitations to what you can do with it. According to the &lt;a href="http://sourceforge.net/projects/supercolliderau/"&gt;SourceForge page&lt;/a&gt; activity on this project seems to have stalled a bit, but it's pretty usuable in it's current state. It is possible to create effects units, but instruments with midi support don't seem to work very well. I've strugled to get anything to happen with Garage Band as a host at least, but that could just be me. &lt;br /&gt;To install it you'll need to follow the instructions provided on the readme, it's very simple, just adding the main class and the server to the relevant directories, then recompile the lang and you're ready to go. &lt;br /&gt;I decided to use it to create a bitcrushing plugin, making use of the Decimator Ugen, featured here &lt;a href="http://superdupercollider.blogspot.com/2009/05/crushing-bits-for-fun-and-profit.html"&gt;before&lt;/a&gt;. The code is really simple, here it is. &lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;( var name, func, specs, componentType, componentSubtype, builder;&lt;br /&gt;&lt;br /&gt;name = &amp;quot;Decimator&amp;quot;; // name of your plugin&lt;br /&gt;func =  {&lt;br /&gt;     &amp;#124; sampleRate,  bitRate&amp;#124;&lt;br /&gt;     &lt;br /&gt;     var decOut, in;&lt;br /&gt;    &lt;br /&gt;    in = AudioIn.ar([1]);  //Input from AU  host&lt;br /&gt;    &lt;br /&gt;    decOut = Decimator.ar(in, sampleRate , bitRate);&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;    Out.ar(0, decOut);//Output to AU host&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;specs =  #[ &lt;br /&gt;    [0, 20000 , \Linear, 10000,\Hertz ] ,&lt;br /&gt;    [0, 16 , \Linear, 8,\Indexed ] &lt;br /&gt;];    &lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;componentType = \aufx;&lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;componentSubtype = \DECI; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;builder = AudioUnitBuilder.new(name, componentSubtype,func, specs, componentType);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;builder.makeInstall; &lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There's a function, this is the code that the server will execute when it's embeded in the AU host, there's an array of specs that described the units, range and presets for the GUI control and a builder command that takes the relevant arguments and packages up the plugin. &lt;br /&gt;The function is a very simple effect patch that takes the audio in from the AU host, decimates it and sends it to the output. The help file is a bit vague about this, but I assume that the relevant audio bus used for input from the AU host is 1, and that it needs to be sent out through 0, this is what seems to work anyway. &lt;br /&gt;After that there's the control spec array, this is slightly different from the standard SC spec, but it is explained in the help file fairly well. It contains the range of values, the type and the default setting. In this case I've st up two suitable sliders to control the bit rate and sample rate, I selected index as the type for the bit rate as this gives an integer. &lt;br /&gt;The builder command takes the name of the plugin, a component subtype, basically a unique identifier for the plugin, the function to be used, the spec and the component type, in this case an audio effect unit. &lt;br /&gt;All being well, when this could runs it should create a plugin in the SuperCollider_f/scaudk folder, which can then be loaded into your AU host.&lt;br /&gt; &lt;br /&gt;&lt;a href="http://sites.google.com/site/supercolliderfiles/Home/Decimator.zip?attredirects=0"&gt;Here's&lt;/a&gt; the final product ready rolled. &lt;br /&gt;It you want to gove it a try it should be fairly self explanatory, but I can't guarantee compatabilty with all AU hosts.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-8044109048114230244?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/8044109048114230244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/05/creating-plugins-with-supercollider-au.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8044109048114230244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8044109048114230244'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/05/creating-plugins-with-supercollider-au.html' title='Creating plugins with SuperCollider AU'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-830355556544802581</id><published>2009-05-09T15:37:00.000-07:00</published><updated>2009-05-09T16:54:47.634-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='distortion'/><category scheme='http://www.blogger.com/atom/ns#' term='fuzz'/><category scheme='http://www.blogger.com/atom/ns#' term='guitar effects'/><category scheme='http://www.blogger.com/atom/ns#' term='flange'/><title type='text'>Guitar effects</title><content type='html'>I've concentrated mostly on synthesis so far with my SuperCollider experiments, but today for a change I've been trying out some audio prosessing with a live input, my guitar. &lt;br&gt;&lt;br /&gt;To get a Mic or line input in SC you have several options, but using a SoundIn Ugen seems to be the easiest. SoundIn is a wrapper for the standard In Ugen, but it makes thigs easier by offsetting the bus index so that the first audio input is always 0. Setting up audio in in SuperCollider can be a bit of a chore, so check the help file if you can't fathom how input works.  &lt;br /&gt;&lt;br /&gt;Let's start with distortion, there's loads of ways of doing this, &lt;br&gt;&lt;br /&gt;&lt;br /&gt;{SoundIn.ar(0).fold2(0.3)}.play&lt;br /&gt;&lt;br /&gt;using fold2 works well, as does clip&lt;br /&gt;&lt;br /&gt;{SoundIn.ar(0).clip2(0.3)}.play&lt;br /&gt;&lt;br /&gt;and there's also the obviously titled distort&lt;br /&gt;&lt;br /&gt;{SoundIn.ar(0).distort}.play&lt;br /&gt;&lt;br /&gt;The effect of this sems to be fairly subtle though. Making better use of it is this SynthDef, which comes from the Pfx help file, last used with my drum machine. &lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;SynthDef(\distort, { arg out=0, pregain=40, amp=0.2, gate=1;&lt;br /&gt;&lt;br /&gt;var env;&lt;br /&gt;&lt;br /&gt;env = Linen.kr(gate, 0.05, 1, 0.1, 2);&lt;br /&gt;&lt;br /&gt;XOut.ar(out, env, (SoundIn.ar(out, 2) * pregain).distort * amp);&lt;br /&gt;&lt;br /&gt;}, [\ir, 0.1, 0.1, 0]).store;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You'll need to use a line like this to set the synth up. &lt;br /&gt;&lt;br /&gt;a = Synth(\distort, addAction:\addToTail)&lt;br /&gt;&lt;br /&gt;and if you're feeling like Alec Empire you can't beat a bit of bitcrushing for uttlerly insane fuzz. &lt;br /&gt;&lt;br /&gt;{Decimator.ar(SoundIn.ar(0), 10000, 1)}.play&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;FreeVerb is an excellent choice for reverb,&lt;br /&gt;&lt;br /&gt;{FreeVerb.ar(SoundIn.ar(0).distort)}.play&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;but something like flange is more difficult. This example is taken from the ixi-audio tutorial from &lt;a href="http://www.ixi-audio.net/content/backyard.html"&gt;ixi-audio.com&lt;/a&gt;, very slightly adapted to fit my audio input busses. &lt;br /&gt;&lt;br /&gt;A flange effect adds a continually varying delayed signal to the original creating a phasing effect. The AllpassL in this case is the delay, with the LFpar UGen controlling the delay time, which is then mixed with the original input. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;SynthDef(\flanger, { arg out=0, in=0, delay=0.1, depth=0.08, rate=0.06, fdbk=0.0, decay=0.0; &lt;br /&gt;&lt;br /&gt;    var input, maxdelay, maxrate, dsig, mixed, local;&lt;br /&gt;    maxdelay = 0.013;&lt;br /&gt;    maxrate = 10.0;&lt;br /&gt;    input = SoundIn.ar(in, 1);&lt;br /&gt;    local = LocalIn.ar(1);&lt;br /&gt;    dsig = AllpassL.ar( // the delay (you could use AllpassC (put 0 in decay))&lt;br /&gt;        input + (local * fdbk),&lt;br /&gt;        maxdelay * 2,&lt;br /&gt;        LFPar.kr( // very similar to SinOsc (try to replace it) - Even use LFTri&lt;br /&gt;            rate * maxrate,&lt;br /&gt;            0,&lt;br /&gt;            depth * maxdelay,&lt;br /&gt;            delay * maxdelay),&lt;br /&gt;        decay);&lt;br /&gt;    mixed = input + dsig;&lt;br /&gt;    LocalOut.ar(mixed);&lt;br /&gt;    Out.ar([out, out+1], mixed);&lt;br /&gt;}).load(s);&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After evaluating that SynthDef you'll need to set up an instance of the synth and set the audio in like this, &lt;br /&gt;&lt;br /&gt;a = Synth(\flanger, [\in, 0], addAction:\addToTail)&lt;br /&gt;&lt;br /&gt;you can then set the various parameters of the effect like this. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;a.set(\delay, 0.04)&lt;br /&gt;a.set(\depth, 0.04)&lt;br /&gt;a.set(\rate, 0.01)&lt;br /&gt;a.set(\fdbk, 0.08)&lt;br /&gt;a.set(\decay, 0.01)&lt;br /&gt;&lt;br /&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-830355556544802581?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/830355556544802581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/05/guitar-effects.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/830355556544802581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/830355556544802581'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/05/guitar-effects.html' title='Guitar effects'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-5640772325372718248</id><published>2009-05-02T17:25:00.000-07:00</published><updated>2009-05-03T17:16:05.218-07:00</updated><title type='text'>Crushing the Bits for Fun and Profit</title><content type='html'>&lt;a href="http://en.wikipedia.org/wiki/Bitcrusher"&gt;Bitcrushing&lt;/a&gt;, reducing the sample and bit rate of audio for effect was invented by audio pioneer Bit Crusher in the early 80's and is pretty easy to implement in SuperCollider. &lt;br /&gt;There are a few ways of doing it, but probably the easiest is to use the ladspa plugins that are part of the Standard SC plugin pack. &lt;br /&gt;There don't seem to be any help docs with these plugins, but they aren't too hard to work out. &lt;br /&gt;For now I'm using Decimator, which looks a bit like this,  &lt;br /&gt;&lt;br /&gt;Decimator.ar(in, rate, bits, mul, add )&lt;br /&gt;&lt;br /&gt;It takes audio in, and the new sample rate and bit depths you want to use, as well as the standard mul and add args. &lt;br&gt; &lt;br /&gt;Here's my faithful drum machine yet again, this time with some bitcrushing.&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;(&lt;br /&gt;SynthDef(\drums, {&amp;#124;out = 0, bassLevel = 0 , snareLevel = 0, hatLevel = 0, tomLevel = 0, pan1 = -1, pan2 = -1, pan3 = 1, pan4 = 1&amp;#124;&lt;br /&gt;&lt;br /&gt;    var  env1, env2, env3, env4, bass, snare, hat, tom, bassOut, snareOut, hatOut, tomOut, mixer; &lt;br /&gt;    env1 = EnvGen.kr(Env.perc(0.001, 0.2, 1, -4), 1, doneAction:2);&lt;br /&gt;    env2 = EnvGen.kr(Env.perc(0.001, 0.5, 1, -1), 1, doneAction:2);&lt;br /&gt;    env3 = EnvGen.kr(Env.perc(0.002, 0.3, 1, -2), 1, doneAction:2);&lt;br /&gt;    env4 = EnvGen.kr(Env.perc(0.001, 0.1, 1, -5), 1, doneAction:2);    &lt;br /&gt;    bass = SinOsc.ar(80) + Crackle.ar(1, 0.5);&lt;br /&gt;    bassOut = Pan2.ar(bass*env1, pan1, bassLevel);&lt;br /&gt;    &lt;br /&gt;    snare = SinOsc.ar(120) - WhiteNoise.ar(0.5, 0.5);&lt;br /&gt;    snareOut = Pan2.ar(snare*env4, pan2, snareLevel);    &lt;br /&gt;    &lt;br /&gt;    hat = Klank.ar(`[ [ 6563, 9875 ],&lt;br /&gt;               [ 0.6, 0.5 ],&lt;br /&gt;               [ 0.002, 0.003] ], PinkNoise.ar(1));    &lt;br /&gt;    hatOut = Pan2.ar(hat*env3, pan2, hatLevel);    &lt;br /&gt;    &lt;br /&gt;    tom =  SinOsc.ar(440); &lt;br /&gt;    tomOut = Pan2.ar(tom*env4, pan4, tomLevel);    &lt;br /&gt;    &lt;br /&gt;    mixer = Mix.new([bassOut, snareOut, hatOut, tomOut]); &lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;    Out.ar(out, mixer);&lt;br /&gt;    &lt;br /&gt;    }).store&lt;br /&gt;    &lt;br /&gt;    )&lt;br /&gt;           &lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;    (&lt;br /&gt;        SynthDef(&amp;quot;bitcrush&amp;quot;, { arg out;      &lt;br /&gt;    var audio, efx, f;&lt;br /&gt;        &lt;br /&gt;    audio = In.ar(20,2);&lt;br /&gt;    efx=  Decimator.ar(audio, SinOsc.ar(0.05, 0, 9000, 1000).abs, 1);    &lt;br /&gt;    Out.ar(out, efx);&lt;br /&gt;}).memStore;               &lt;br /&gt;          )&lt;br /&gt;      &lt;br /&gt;     (          &lt;br /&gt;     a = Synth.after(1, &amp;quot;bitcrush&amp;quot;);     &lt;br /&gt;      )    &lt;br /&gt;          &lt;br /&gt;          &lt;br /&gt;          (&lt;br /&gt;               &lt;br /&gt;               &lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;    a = Pseq  ([1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]);&lt;br /&gt;    b = Pseq  ([0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0]);&lt;br /&gt;    c = Pseq  ([0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0]);&lt;br /&gt;    d = Pseq  ([0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1]);    &lt;br /&gt;    e = Pwhite (0.14, 0.16, inf);&lt;br /&gt;    &lt;br /&gt;    p = Pbind(&lt;br /&gt;       \instrument, \drums,&lt;br /&gt;       \out, [20],&lt;br /&gt;      \dur, e,&lt;br /&gt;       \bassLevel,  Pseq ([a], inf), &lt;br /&gt;       \snareLevel, Pseq ([b], inf),&lt;br /&gt;       \hatLevel,   Pseq ([c], inf),       &lt;br /&gt;       \tomLevel,   Pseq ([d], inf)&lt;br /&gt;                             &lt;br /&gt;                       ).play;&lt;br /&gt;                       &lt;br /&gt;     &lt;br /&gt;            )   &lt;br /&gt;                    &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This uses the same method that I used previously to add an effect to a pattern, sending the output of the pattern to the bitcrusher through a bus, and making sure the order of execution is correct the with Synth.after method. &lt;br /&gt;I'm using a sin oscillator to modulate the sample rate, varying it between 1000 and 10000 and using a .abs method to make sure it doesn't go negative, because negative sample rates don't work. &lt;br /&gt;At lower bit rates and depths it's got a very 8-bit sound not unlike the ZX Spectrum beeper. &lt;br /&gt;Buzzy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-5640772325372718248?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/5640772325372718248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/05/crushing-bits-for-fun-and-profit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/5640772325372718248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/5640772325372718248'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/05/crushing-bits-for-fun-and-profit.html' title='Crushing the Bits for Fun and Profit'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-4644871592206011405</id><published>2009-04-30T14:42:00.000-07:00</published><updated>2009-04-30T14:55:10.373-07:00</updated><title type='text'>Daily Coding</title><content type='html'>In interesting experiment from &lt;a href="http://www.fredrikolofsson.com/f0blog/?q=node/357"&gt;Fredrik Olofsson&lt;/a&gt;, a daily coding challenge. He's been creating new SuperCollider code every day in April, all based around the same synthdef, battling Marcus Fjellström who has been doing the same thing on his &lt;a href="http://www.kafkagarden.com/april09/spiel.html"&gt;blog here&lt;/a&gt;. &lt;br&gt;&lt;br /&gt;&lt;br /&gt;Dedication.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-4644871592206011405?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/4644871592206011405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/04/daily-coding.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/4644871592206011405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/4644871592206011405'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/04/daily-coding.html' title='Daily Coding'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-7864570277287886672</id><published>2009-04-29T10:38:00.000-07:00</published><updated>2009-04-29T10:47:35.690-07:00</updated><title type='text'>Tea Tracks</title><content type='html'>&lt;a href="http://www.sampleandhold.org/projects/2009/04/11/teatracks-rc1/"&gt;TeaTracks&lt;/a&gt; is a multitrack sequencer for Supercollider designed by &lt;a href="http://www.sampleandhold.org/"&gt;Jan Trutzschler&lt;/a&gt;. If like me you're wondering how a sequencer actually slots into SuperCollider, fear not, because Dan has displayed the will of the warrior and created &lt;a href="http://www.archive.org/details/SupercolliderTeatracksFirstGo"&gt;this intro video hosted here on archive.org&lt;/a&gt; .&lt;br /&gt;Smashing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-7864570277287886672?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/7864570277287886672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/04/tea-tracks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/7864570277287886672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/7864570277287886672'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/04/tea-tracks.html' title='Tea Tracks'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-6472927718089217121</id><published>2009-04-24T08:58:00.000-07:00</published><updated>2009-04-24T09:15:12.598-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='phase modulation'/><category scheme='http://www.blogger.com/atom/ns#' term='optimisation'/><category scheme='http://www.blogger.com/atom/ns#' term='fm7'/><title type='text'>DX-7 and Optimisation</title><content type='html'>A couple of things - &lt;br /&gt;&lt;br /&gt;Discovered via &lt;a href="http://www.fredrikolofsson.com/pages/code-sc.html"&gt;Fredrik Olofsson's blog&lt;/a&gt;, &lt;a href="http://space.k-hornz.de/pub/skUG/"&gt;stefan kersten's FM7 plugin&lt;/a&gt;. Presumably inspired by the DX-7, it's a Ugen with a bank of 6 phase modulated oscillators. Looks like fun, and if I can fathom the help file I think I'm going to do someting with it. &lt;br /&gt;&lt;br /&gt;Also, discovered via SC Users,  this &lt;a href="http://swiki.hfbk-hamburg.de/MusicTechnology/867"&gt;handy page about optimisation&lt;/a&gt;. &lt;br /&gt;Speedy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-6472927718089217121?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/6472927718089217121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/04/dx-7-and-optimisation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/6472927718089217121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/6472927718089217121'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/04/dx-7-and-optimisation.html' title='DX-7 and Optimisation'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-4145026617560710242</id><published>2009-04-16T15:31:00.000-07:00</published><updated>2009-04-16T16:12:25.028-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='reverb'/><category scheme='http://www.blogger.com/atom/ns#' term='distortion'/><category scheme='http://www.blogger.com/atom/ns#' term='Pfx'/><category scheme='http://www.blogger.com/atom/ns#' term='drum machine'/><category scheme='http://www.blogger.com/atom/ns#' term='wah'/><title type='text'>Pattern FX with Pfx</title><content type='html'>It's time to bring out my drum machine again. I've done effects with it before, but this is a new method, slightly more intuitive as you don't need to mess about with busses, it's all handled by the patterns. &lt;br&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;(&lt;br /&gt;SynthDef(\drums, {&amp;#124;out = 0, bassLevel = 0 , snareLevel = 0, hatLevel = 0, tomLevel = 0, pan1 = -1, pan2 = -1, pan3 = 1, pan4 = 1&amp;#124;&lt;br /&gt;&lt;br /&gt;    var  env1, env2, env3, env4, bass, snare, hat, tom, bassOut, snareOut, hatOut, tomOut, mixer; &lt;br /&gt;    env1 = EnvGen.kr(Env.perc(0.001, 0.2, 1, -4), 1, doneAction:2);&lt;br /&gt;    env2 = EnvGen.kr(Env.perc(0.001, 0.5, 1, -1), 1, doneAction:2);&lt;br /&gt;    env3 = EnvGen.kr(Env.perc(0.002, 0.3, 1, -2), 1, doneAction:2);&lt;br /&gt;    env4 = EnvGen.kr(Env.perc(0.001, 0.1, 1, -5), 1, doneAction:2);    &lt;br /&gt;    bass = SinOsc.ar(80) + Crackle.ar(1, 0.5);&lt;br /&gt;    bassOut = Pan2.ar(bass*env1, pan1, bassLevel);&lt;br /&gt;    &lt;br /&gt;    snare = SinOsc.ar(120) - WhiteNoise.ar(0.5, 0.5);&lt;br /&gt;    snareOut = Pan2.ar(snare*env4, pan2, snareLevel);    &lt;br /&gt;    &lt;br /&gt;    hat = Klank.ar(`[ [ 6563, 9875 ],&lt;br /&gt;               [ 0.6, 0.5 ],&lt;br /&gt;               [ 0.002, 0.003] ], PinkNoise.ar(1));    &lt;br /&gt;    hatOut = Pan2.ar(hat*env3, pan2, hatLevel);    &lt;br /&gt;    &lt;br /&gt;    tom =  SinOsc.ar(440); &lt;br /&gt;    tomOut = Pan2.ar(tom*env4, pan4, tomLevel);    &lt;br /&gt;    &lt;br /&gt;    mixer = Mix.new([bassOut, snareOut, hatOut, tomOut]); &lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;    Out.ar(out, mixer);&lt;br /&gt;    &lt;br /&gt;    }).store&lt;br /&gt;    &lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Pfx, or at least it's near relation Pfxb, is currently &lt;a href="http://www.nabble.com/Pfxb-broken--ts23008080.html"&gt;being debated on the SC Users list&lt;/a&gt; so some people might be having problems with it. It seems to work fine for me with OS X, but I think it's a pretty new feature so you might need the latest &lt;a href="http://sourceforge.net/project/showfiles.php?group_id=54622"&gt;SuperCollider release candidate&lt;/a&gt; if you want to give it a try.  &lt;br /&gt;&lt;br /&gt;This code is very closely adapted from the Pfx help file, all I've really done is bodge my drum machine sythdef onto it, but it works very well.  &lt;br&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;(&lt;br /&gt;SynthDef(\echo, { arg out=0, maxdtime=0.2, dtime=0.2, decay=2, gate=1;&lt;br /&gt;var env, in;&lt;br /&gt;env = Linen.kr(gate, 0.05, 1, 0.1, 2);&lt;br /&gt;in = In.ar(out, 2);&lt;br /&gt;XOut.ar(out, env, CombL.ar(in * env, maxdtime, dtime, decay, 1, in));&lt;br /&gt;}, [\ir, \ir, 0.1, 0.1, 0]).store;&lt;br /&gt;&lt;br /&gt;SynthDef(\distort, { arg out=0, pregain=40, amp=0.2, gate=1;&lt;br /&gt;var env;&lt;br /&gt;env = Linen.kr(gate, 0.05, 1, 0.1, 2);&lt;br /&gt;XOut.ar(out, env, (In.ar(out, 2) * pregain).distort * amp);&lt;br /&gt;}, [\ir, 0.1, 0.1, 0]).store;&lt;br /&gt;&lt;br /&gt;SynthDef(\wah, { arg out=0, gate=1;&lt;br /&gt;var env, in;&lt;br /&gt;env = Linen.kr(gate, 0.05, 1, 0.4, 2);&lt;br /&gt;in = In.ar(out, 2);&lt;br /&gt;XOut.ar(out, env, RLPF.ar(in, LinExp.kr(LFNoise1.kr(0.3), -1, 1, 200,&lt;br /&gt;8000), 0.1).softclip * 0.8);&lt;br /&gt;}, [\ir, 0]).store;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;               &lt;br /&gt;               &lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;    a = Pseq  ([1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]);&lt;br /&gt;    b = Pseq  ([0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0]);&lt;br /&gt;    c = Pseq  ([0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0]);&lt;br /&gt;    d = Pseq  ([0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1]);    &lt;br /&gt;    e = Pwhite (0.14, 0.16, inf);&lt;br /&gt;    &lt;br /&gt;    p = Pbind(&lt;br /&gt;       \instrument, \drums,&lt;br /&gt;      \dur, e,&lt;br /&gt;       \bassLevel,  Pseq ([a], inf), &lt;br /&gt;       \snareLevel, Pseq ([b], inf),&lt;br /&gt;       \hatLevel,   Pseq ([c], inf),       &lt;br /&gt;       \tomLevel,   Pseq ([d], inf)&lt;br /&gt;                             &lt;br /&gt;                       );&lt;br /&gt;                       &lt;br /&gt;     &lt;br /&gt;     q = Pfx(p, \echo, \dtime, 0.02, \decay, 0.1);     &lt;br /&gt;            &lt;br /&gt;    r = Pfx(q, \distort, \pregain, 20, \amp, 0.25);&lt;br /&gt;    &lt;br /&gt;     o = Pfx(r, \wah).play;&lt;br /&gt;                        )   &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Pfx takes a pattern and the name of the effect synthdef as arguemnts, then the names and the arguments you'd usually pass to the synthdef to control it. Pfx then takes the patern you've specified and plays it through the effect you've given it. &lt;br&gt; &lt;br /&gt;As shown in the above code, you can easily nest Pfx patterns to layer on more effects. I've got my original drum machine pattern defined as normal then I've passed it to a Pfx named q, then passed that new pattern on to r and then o, so I end up with my initially defined pattern passed through three effects. &lt;br&gt; &lt;br /&gt;Sounds dubesque.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-4145026617560710242?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/4145026617560710242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/04/pattern-fx-with-pfx.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/4145026617560710242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/4145026617560710242'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/04/pattern-fx-with-pfx.html' title='Pattern FX with Pfx'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-7751241887030842122</id><published>2009-04-08T17:18:00.000-07:00</published><updated>2009-04-16T16:11:26.731-07:00</updated><title type='text'>Moog miditest</title><content type='html'>More work on my Moogy synth, nothing too spectacular, once again I've made use of .miditest from &lt;a href="http://www.dewdrop-world.net/sc3/index.php"&gt;Dewdrop_lib&lt;/a&gt;. I've just invoked the miditest method and added control specs for all the parameters. This is the 'lfo' amplitude modulation version of my synth, the oscType sliders let you select from the 12 possible combinations of saw, sin and pulse waves with trinagle, sin or pulse wave amplitude modulation. &lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;( &lt;br /&gt; SynthDef(&amp;quot;Moog&amp;quot;,{&lt;br /&gt;&lt;br /&gt;arg oscType =0, oscType2 = 0, pan = 0, level = 0.5, cutoff = 500, gain = 3.3, attack = 0.1, decay = 0.1, sust = 0.7, rel = 0.2, attackf = 0.1, decayf = 0.1, sustf = 0.9, relf = 0.2, gate = 1, freq =440, lfo1Rate = 12, lfo2Rate =4, lfo3Rate = 6;&lt;br /&gt;&lt;br /&gt;var lfo1 = Lag2.kr(LFSaw.kr(lfo1Rate), 0.1);&lt;br /&gt;var lfo2 = Lag2.kr(LFTri.kr(lfo2Rate), 0.1);&lt;br /&gt;var lfo3 = SinOsc.kr(lfo3Rate);&lt;br /&gt;&lt;br /&gt;var oscArray = [Saw.ar(freq), SinOsc.ar(freq), Pulse.ar(freq),Saw.ar(freq, lfo1), SinOsc.ar(freq,0, lfo1), Pulse.ar(freq, 0.5,lfo1), Saw.ar(freq,lfo2), SinOsc.ar(freq, 0,lfo2), Pulse.ar(freq, 0.5,lfo2), Saw.ar(freq, lfo3), SinOsc.ar(freq,0, lfo3), Pulse.ar(freq, 0.5, lfo3)];&lt;br /&gt;var oscArray2 = [Saw.ar(freq), SinOsc.ar(freq), Pulse.ar(freq),Saw.ar(freq, lfo1), SinOsc.ar(freq,0, lfo1), Pulse.ar(freq, 0.5,lfo1), Saw.ar(freq,lfo2), SinOsc.ar(freq, 0,lfo2), Pulse.ar(freq,0.5,lfo2), Saw.ar(freq, lfo3), SinOsc.ar(freq,0, lfo3), Pulse.ar(freq, 0.5, lfo3)];&lt;br /&gt;&lt;br /&gt;var ampEnv = EnvGen.ar(Env.adsr(attack, decay, sust, rel), gate, doneAction:2);&lt;br /&gt;var filterEnv = EnvGen.ar(Env.adsr(attackf, decayf, sustf, relf), gate, doneAction:2);&lt;br /&gt;var osc1 = Select.ar(oscType, oscArray);&lt;br /&gt;var osc2 = Select.ar(oscType2, oscArray2);&lt;br /&gt;var fade = Pan2.ar(XFade2.ar(osc1, osc2, pan , level * ampEnv, 0));&lt;br /&gt;var filter = MoogFF.ar(fade, cutoff * filterEnv, gain);&lt;br /&gt;Out.ar(0,filter)&lt;br /&gt;&lt;br /&gt;}).miditest(nil, [[0, 11, \linear, 1, 0, 1], [0, 11, \linear, 1, 0, 1], [-1, 1, \linear, 0.1, 0, 0.1], [0, 4, \linear, 0.1, 1, 0.1], [0, 10000, \linear, 0.1, 5000, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],nil, nil, [0, 50, \linear, 0.1, 1, 0.1],[0, 50, \linear, 0.1, 1, 0.1], [0, 50, \linear, 0.1, 1, 0.1]])&lt;br /&gt;)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;By the way, I use &lt;a href="http://www.manyetas.com/creed/midikeys.html"&gt;MidiKeys&lt;/a&gt;with OS X to play midi notes with an ordinary alphanumeric keyboard. Very handy and SuperCollider recognises it without any trouble. &lt;br /&gt;&lt;a href="http://www.hitsquad.com/smm/programs/VMKXP/"&gt;This&lt;/a&gt; appears to be a Windows substitute but I've no idea what it's like and it might be a pain in the arse to get working.  If you're running linux you're on your own.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-7751241887030842122?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/7751241887030842122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/04/more-work-on-my-moogy-synth-nothing-too.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/7751241887030842122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/7751241887030842122'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/04/more-work-on-my-moogy-synth-nothing-too.html' title='Moog miditest'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-3594352904463720103</id><published>2009-04-03T17:02:00.000-07:00</published><updated>2009-04-03T17:23:08.479-07:00</updated><title type='text'>Complex envelopes.</title><content type='html'>I posted a phase modulation synth a while ago, but here's another one, this time using the PMOsc ugen and some custom defined envelopes. &lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;(&lt;br /&gt;SynthDef(&amp;quot;phase&amp;quot;, { &amp;#124;freq = 440, modfreq = 600,&lt;br /&gt;index = 3, modphase = 2, gate = 1&amp;#124;&lt;br /&gt;var env1 = EnvGen.kr(Env.new([0.2,0.6,0.6,0.8,0.01, 0.2, 0.1, 0.01],[0.1,0.3,0.1,0.2], 'linear', 3, 6));&lt;br /&gt;&lt;br /&gt;var pmosc = PMOsc.ar(freq,modfreq, index , modphase);&lt;br /&gt;var out = MoogFF.ar(pmosc, 5000 * env1, 0.1);&lt;br /&gt;Out.ar(0, Pan2.ar(out * EnvGen.kr(Env.new([0.1,0.5,0.3,0.6,0.7,0.8,0.7,0],[0.02,0.03,0.04,0.02,0.04,0.1,0.1],'linear', 2, 1), gate, doneAction:2)))&lt;br /&gt;}).miditest(nil, [nil, [0, 100, \linear, 0, 2], [0, 20, \linear, 0, 2],&lt;br /&gt;[0, 4, \linear, 0, 2], nil]);&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Defining new envelopes is reasonably easy, the help file explains most of it very well, but the release node and looping function took me a while to work out. &lt;br&gt; &lt;br /&gt;When you create a new envelope with Env.new you can give it a release node, this is the value of the envelope that will be held until the note is released. If you've got a envelope handyly defined like this (the first array is the list if output values, the second is the time it takes to transition to the next one)&lt;br&gt; &lt;br /&gt;Env.new([1,2,3,4,5] , [1,2,3,4]. 'linear', 5]&lt;br /&gt;the note will be held at the first value on the list, '5' in this case, until it's released.&lt;br /&gt;If you define a loop node like this &lt;br&gt;&lt;br /&gt;Env.new([1,2,3,4,5] , [1,2,3,4]. 'linear', 5, 1] &lt;br&gt;&lt;br /&gt;When the note is held it will loop through the nodes starting at the loop node and ending at the node before the release node untill the note is realsed. So in this case when the note is held, the values put out by the envelope will loop through the values '1, 2, 3, 4' as long as the note is held and then transition to '5'when it's released. I think. &lt;br&gt; &lt;br /&gt;&lt;br /&gt;And that's jazz.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-3594352904463720103?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/3594352904463720103/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/04/complex-envelopes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3594352904463720103'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3594352904463720103'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/04/complex-envelopes.html' title='Complex envelopes.'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-8375889200895207525</id><published>2009-04-01T15:47:00.001-07:00</published><updated>2009-04-03T17:01:59.036-07:00</updated><title type='text'>Using BBCut and a Simple Drum Machine</title><content type='html'>I've had this code for ages but I forgot about it. &lt;br /&gt;It's my simple drum machine again, but this time put through BBCut, the beat slicing library. I've got to admit, it doesn't sound too good yet, but the principle's there. &lt;br /&gt;&lt;br /&gt;Also it's yet another experiment with formatting, I'll find a something that works one day.&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;s.boot&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;SynthDef(\drums, {&amp;#124;out = 0, bassLevel = 0, &lt;br /&gt;snareLevel = 0, hatLevel = 0, tomLevel = 0,&lt;br /&gt; pan1 = 0, pan2 = 0, pan3 = 0, pan4 = 0&amp;#124;&lt;br /&gt;&lt;br /&gt;    var  env1, env2, env3, bass, snare, hat, tom, bassOut, snareOut,&lt;br /&gt;    hatOut, tomOut, mixer; &lt;br /&gt;    env1 = EnvGen.kr(Env.perc(0.001, 0.2, 1, -4), 1, doneAction:2);&lt;br /&gt;    env2 = EnvGen.kr(Env.perc(0.002, 0.3, 1, -2), 1, doneAction:2);&lt;br /&gt;    env3 = EnvGen.kr(Env.perc(0.001, 0.1, 1, -5), 1, doneAction:2);    &lt;br /&gt;    bass = SinOsc.ar(80) + Crackle.ar(1, 0.5);&lt;br /&gt;    bassOut = Pan2.ar(bass*env1, pan1, bassLevel);&lt;br /&gt;    &lt;br /&gt;    snare = SinOsc.ar(40) - WhiteNoise.ar(0.5, 0.5);&lt;br /&gt;    snareOut = Pan2.ar(snare*env1, pan2, snareLevel);    &lt;br /&gt;    &lt;br /&gt;    hat = Klank.ar(`[ [ 6563, 9875 ],&lt;br /&gt;               [ 0.61, 0.55046827363918 ],&lt;br /&gt;               [ 0.0024, 0.0036 ] ], PinkNoise.ar(1));    &lt;br /&gt;    hatOut = Pan2.ar(hat*env2, pan2, hatLevel);    &lt;br /&gt;    &lt;br /&gt;    tom =  SinOsc.ar(440); &lt;br /&gt;    tomOut = Pan2.ar(tom*env3, pan4, tomLevel);    &lt;br /&gt;    &lt;br /&gt;    mixer = (bassOut + snareOut) + (hatOut + tomOut); &lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;    Out.ar(out, mixer);&lt;br /&gt;    &lt;br /&gt;    }).store&lt;br /&gt;    &lt;br /&gt;    )&lt;br /&gt;    &lt;br /&gt;TempoClock.default.tempo_(3);&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;var buf, clock, bbcutgroup;&lt;br /&gt;~synthbus = Bus.audio(s,2);&lt;br /&gt;~synthgroup= Group.head(Node.basicNew(s,1));&lt;br /&gt;&lt;br /&gt;    a = Pseq  ([1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]);&lt;br /&gt;    b = Pseq  ([0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0]);&lt;br /&gt;    c = Pseq  ([0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0]);&lt;br /&gt;    d = Pseq  ([0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1]);    &lt;br /&gt;&lt;br /&gt;p = Pbind(&lt;br /&gt;       \instrument, \drums,&lt;br /&gt;       \dur, 0.2,&lt;br /&gt;       \bassLevel,  Pseq ([a], inf), &lt;br /&gt;       \snareLevel, Pseq ([b], inf),&lt;br /&gt;       \hatLevel,   Pseq ([c], inf),       &lt;br /&gt;       \tomLevel,   Pseq ([d], inf),&lt;br /&gt;       \group, ~synthgroup,&lt;br /&gt;       \out, ~synthbus&lt;br /&gt;).play;&lt;br /&gt;&lt;br /&gt;clock= ExternalClock(TempoClock.default);&lt;br /&gt;&lt;br /&gt;bbcutgroup= Group.after(~synthgroup);&lt;br /&gt;&lt;br /&gt;Routine.run({&lt;br /&gt;buf= BBCutBuffer.alloc(s,44100,2);&lt;br /&gt;s.sync; //this forces a wait for the Buffer to be allocated&lt;br /&gt;BBCut2(CutGroup(CutStream1(~synthbus.index, buf, 0.75, 0.01, 0.5,&lt;br /&gt;-4),bbcutgroup, numChannels:2), SQPusher1.new).play(clock);&lt;br /&gt;});&lt;br /&gt;clock.play;&lt;br /&gt;)&lt;br /&gt;~synthbus.free;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The code is not to hard to follow I hope, it's adapted from the BBcut help  file with help from Dan once again. The only tough bits are the groups and nodes stuff, which to be honest I don't fully understand myself. Maybe I'll post about them in more detail if I ever fathom it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-8375889200895207525?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/8375889200895207525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/04/using-bbcut-and-simple-drum-machine.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8375889200895207525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8375889200895207525'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/04/using-bbcut-and-simple-drum-machine.html' title='Using BBCut and a Simple Drum Machine'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-8214702126991562271</id><published>2009-03-30T15:02:00.000-07:00</published><updated>2009-03-30T15:05:22.967-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='one liner'/><title type='text'>A one liner from the SC users list.</title><content type='html'>&lt;p&gt;Lifted directly from the &lt;a href="http://www.nabble.com/wow-ts22782036.html"&gt;SC Users List&lt;/a&gt; a lovely one liner.  &lt;/p&gt;&lt;p&gt;&lt;br /&gt;// server samplerate should be 44100 &lt;br /&gt;&lt;br /&gt;{Splay.ar(Ringz.ar(Impulse.ar([2, 1, 4], [0.1, 0.11, 0.12]), [0.1,   &lt;br /&gt;0.1, 0.5])) * EnvGen.kr(Env([1, 1, 0], [120, 10]), doneAction: 2)}.play &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- &lt;br /&gt;This work is licensed under the Creative Commons Attribution-Share   &lt;br /&gt;Alike 3.0 Germany License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/de/  &lt;br /&gt;  or send a letter to Creative Commons, 171 Second Street, Suite 300,   &lt;br /&gt;San Francisco, California, 94105, USA.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Tasty. &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-8214702126991562271?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/8214702126991562271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/one-liner-from-sc-users-list.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8214702126991562271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8214702126991562271'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/one-liner-from-sc-users-list.html' title='A one liner from the SC users list.'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-4290119022834410620</id><published>2009-03-27T16:50:00.000-07:00</published><updated>2009-03-27T17:01:47.098-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MCLD'/><title type='text'>Stolen From MCLD</title><content type='html'>Dan Stowel AKA MCLD, legendary SuperCollidist, has brought honour to his family and started &lt;a href="http://twitter.com/mclduk"&gt;twittering about SuperCollider&lt;/a&gt;, &lt;br /&gt;&lt;br /&gt;Posting very short snippets of code such as this. &lt;br /&gt;&lt;br /&gt;{t=HPZ1.kr(LFNoise0.kr(4));{Pulse.ar((t*10000+0.0001).lag(0, 0.1))}.dup+(SinOsc.ar([220, 330])*Integrator.kr(t))*0.1}.play;//&lt;br /&gt;&lt;br /&gt;Nice, &lt;br /&gt;&lt;br /&gt;He also drank a jar of coffee and took some E, now he's totally &lt;a href="http://www.wired.com/gadgets/mods/multimedia/2009/03/gallery_instruments?slide=20&amp;slideView=10"&gt;Wired!&lt;/a&gt; i.e. he's in Wired Magazine. &lt;br /&gt;&lt;br /&gt;Nicer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-4290119022834410620?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/4290119022834410620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/stolen-from-mcld.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/4290119022834410620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/4290119022834410620'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/stolen-from-mcld.html' title='Stolen From MCLD'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-2718836546077613260</id><published>2009-03-21T17:24:00.000-07:00</published><updated>2009-03-21T17:46:37.350-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='heterodyne'/><category scheme='http://www.blogger.com/atom/ns#' term='lie'/><category scheme='http://www.blogger.com/atom/ns#' term='theremin'/><title type='text'>The heterodyne is a lie</title><content type='html'>&lt;p&gt;I knew there was something not quite right with my 'more accurate Theremin' code. &lt;/p&gt;&lt;p&gt;It does work, but not for the reason that I thought it did. Here's the original code, &lt;/p&gt;&lt;p&gt;(&lt;br /&gt;{&lt;br /&gt;var mouse = MouseX.kr(100000,110000,1);&lt;br /&gt;&lt;br /&gt;BPF.ar((SinOsc.ar(100000) * SinOsc.ar(mouse)), mouse - 100000, 0.2);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}.scope&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I should have known, 100Khz is waaaay above the maximum frequency that can be produced by a standard sampling rate of 40-some thousand hz,  according to &lt;a href="http://en.wikipedia.org/wiki/Nyquist–Shannon_sampling_theorem"&gt;Nyquist-Shannon sampling theorem&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Simply put, &lt;a href="http://en.wikipedia.org/wiki/Aliasing"&gt; aliasing&lt;/a&gt; causes the code to output the sound, the rest is erm , complicated. &lt;/p&gt;&lt;p&gt;A better explanation can be found on the &lt;a href="http://www.nabble.com/This-heterodyning-code-shouldn't-work-but-it-does.-Why--ts22613062.html"&gt;SC user list where I asked about it&lt;/a&gt;.  &lt;/p&gt;&lt;p&gt;Qapla!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-2718836546077613260?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/2718836546077613260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/heterodyne-is-lie.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/2718836546077613260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/2718836546077613260'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/heterodyne-is-lie.html' title='The heterodyne is a lie'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-2613997478987452357</id><published>2009-03-20T17:23:00.000-07:00</published><updated>2009-03-20T18:27:20.129-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='midi'/><category scheme='http://www.blogger.com/atom/ns#' term='phase modulation.'/><title type='text'>Midievalism - Midi control</title><content type='html'>&lt;p&gt;&lt;a href="http://www.dewdrop-world.net/sc3/index.php"&gt;James Harkins' Dewdrop_lib&lt;/a&gt; , has an armada of wonderful surprises for the budding SuperCollidist, including several classes for dealing with midi stuff. &lt;/p&gt;&lt;p&gt;This is part of the official extensions package, but you'll still need to install the quark and recompile the language for it to work. &lt;/p&gt;&lt;p&gt;A useful method is .miditest, which you can append to any synthdef and automatically create a simple midi interface and a gui to control it. It's very simple to use and the help file is easy to understand. &lt;/p&gt;&lt;p&gt;Here's an example of a simple phase modulating synth I made. The synth itself is pretty simple, I'm just using sin oscillators to modulate the phase of another SinOsc. &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="font-size:78%;"&gt;(&lt;br /&gt;SynthDef(&lt;span style="'"&gt;"phase"&lt;/span&gt;, { |freq = &lt;span style="'"&gt;440&lt;/span&gt;, pm1f = &lt;span style="'"&gt;2&lt;/span&gt;,&lt;br /&gt;pm2f = &lt;span style="'"&gt;2&lt;/span&gt;, pm3f = &lt;span style="'"&gt;2&lt;/span&gt;, gate = &lt;span style="'"&gt;1&lt;/span&gt;|&lt;br /&gt;&lt;br /&gt;var out =&lt;br /&gt;SinOsc.ar(freq, SinOsc.ar(pm1f, SinOsc.ar(&lt;span style="'"&gt;2&lt;/span&gt;, SinOsc.ar(pm2f,&lt;br /&gt;SinOsc.ar(pm3f))))*&lt;span style="'"&gt;2&lt;/span&gt;pi);&lt;br /&gt;Out.ar(&lt;span style="'"&gt;0&lt;/span&gt;, Pan2.ar(out * EnvGen.kr(Env.adsr, gate, doneAction:&lt;span style="'"&gt;2&lt;/span&gt;)))&lt;br /&gt;}).miditest(nil, [nil, [&lt;span style="'"&gt;0&lt;/span&gt;, &lt;span style="'"&gt;50&lt;/span&gt;, \linear, &lt;span style="'"&gt;0&lt;/span&gt;, &lt;span style="'"&gt;2&lt;/span&gt;], [&lt;span style="'"&gt;0&lt;/span&gt;, &lt;span style="'"&gt;50&lt;/span&gt;, \linear, &lt;span style="'"&gt;0&lt;/span&gt;, &lt;span style="'"&gt;2&lt;/span&gt;],&lt;br /&gt;[&lt;span style="'"&gt;0&lt;/span&gt;, &lt;span style="'"&gt;50&lt;/span&gt;, \linear, &lt;span style="'"&gt;0&lt;/span&gt;, &lt;span style="'"&gt;2&lt;/span&gt;], nil]);&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To make miditest work correctly you'll need to supply it control specs for each of the parameters of your synth in the second argument. If any of your paremeters don't need to be controlled by the gui, putting nil as the argument will cause it to be left out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-2613997478987452357?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/2613997478987452357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/midievalism-midi-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/2613997478987452357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/2613997478987452357'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/midievalism-midi-control.html' title='Midievalism - Midi control'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-5088983338320154937</id><published>2009-03-19T17:37:00.000-07:00</published><updated>2009-03-19T18:04:40.886-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='patterns'/><category scheme='http://www.blogger.com/atom/ns#' term='birthday'/><category scheme='http://www.blogger.com/atom/ns#' term='Synthdef'/><title type='text'>Some Birthday Code</title><content type='html'>&lt;p&gt;It's was my birthday recently and I was lucky enough to  get this&lt;a href="http://sites.google.com/site/supercolliderfiles/sc-files/matt_dubhb.scd?attredirects=0"&gt; birthday code&lt;/a&gt; from my old friend and &lt;a href="http://www.mcld.co.uk/"&gt;Finchley's premier SuperCollidist, Dan. &lt;/a&gt; &lt;/p&gt;&lt;p&gt;I was going to post the code on here, but it's pretty long and I can't get it to format nicely at the moment, so you'll have to make do with the .scd file in the link above. &lt;/p&gt;&lt;p&gt;Happy Birthday to me.  &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-5088983338320154937?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/5088983338320154937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/s.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/5088983338320154937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/5088983338320154937'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/s.html' title='Some Birthday Code'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-3414832788168136067</id><published>2009-03-12T15:58:00.000-07:00</published><updated>2009-03-12T16:50:38.825-07:00</updated><title type='text'>Lag in the Time of Cholera.</title><content type='html'>&lt;p&gt;I updated my Moog synth to use low frequency oscillators to modulate the amplitude a while ago , finding a new use for the Lag Ugen in the process. &lt;/p&gt;&lt;p&gt;Here's the relevant bit, &lt;/p&gt;&lt;p&gt;var lfo1 = Lag2.kr(LFSaw.kr(lfo1Rate), 0.1);&lt;br /&gt;var lfo2 = Lag2.kr(LFTri.kr(lfo2Rate), 0.1);&lt;br /&gt;var lfo3 = Lag2.kr(SinOsc.kr(lfo3Rate), 0.1);&lt;/p&gt;&lt;p&gt;When I put it onto my oscillator array the lfo modulates the multipler of the Ugens. &lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Why the Lag?&lt;/p&gt;&lt;p&gt;Without it it sounds pretty bad, the sudden changes in amplitude cause a nasty clicking sound. Lag smoothes out the waveform so that the change is more gradual and sounds much better. &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-3414832788168136067?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/3414832788168136067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/lag-in-time-of-cholera.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3414832788168136067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3414832788168136067'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/lag-in-time-of-cholera.html' title='Lag in the Time of Cholera.'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-8950548799456207723</id><published>2009-03-10T18:04:00.000-07:00</published><updated>2009-03-10T18:12:48.790-07:00</updated><title type='text'>The Joy of Frequecy Modulation</title><content type='html'>&lt;p&gt;Here's a simple frequency modulating synth def I came up with, &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;(&lt;br /&gt;   SynthDef(\efemer, {|freq = &lt;span style=" ;color:Maroon;"&gt;240&lt;/span&gt;, modlev1 = &lt;span style=" ;color:Maroon;"&gt;100&lt;/span&gt;, modlev2 = &lt;span style=" ;color:Maroon;"&gt;100&lt;/span&gt;,&lt;br /&gt;carlev = &lt;span style=" ;color:Maroon;"&gt;1&lt;/span&gt;, pulsewidth = &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.5&lt;/span&gt;, mod1osctype = &lt;span style=" ;color:Maroon;"&gt;1&lt;/span&gt;, &lt;br /&gt;mod2osctype = &lt;span style=" ;color:Maroon;"&gt;2&lt;/span&gt; , carosctype = &lt;span style=" ;color:Maroon;"&gt;2&lt;/span&gt;, sinphase = &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;|&lt;br /&gt;   &lt;br /&gt;       var mod1array = [Saw.ar(freq, modlev1), Pulse.ar(freq, pulsewidth, modlev1), &lt;br /&gt;SinOsc.ar(freq, sinphase, modlev1)];&lt;br /&gt;       &lt;br /&gt;       var mod1 = Select.ar(mod1osctype, mod1array); &lt;br /&gt;       &lt;br /&gt;       var mod2array = [Saw.ar(freq + mod1, modlev2), &lt;br /&gt;Pulse.ar(freq + mod1, pulsewidth, modlev2),&lt;br /&gt;SinOsc.ar(freq + mod1, sinphase, modlev2)];  &lt;br /&gt;       &lt;br /&gt;       var mod2 = Select.ar(mod2osctype, mod2array);&lt;br /&gt;       &lt;br /&gt;       var cararray = [Saw.ar(freq + mod2, carlev), &lt;br /&gt;Pulse.ar(freq + mod2, pulsewidth, carlev), &lt;br /&gt;SinOsc.ar(freq = mod2, &lt;span style=" ;color:Maroon;"&gt;1&lt;/span&gt;, carlev)];&lt;br /&gt;       &lt;br /&gt;       var car = Select.ar(carosctype, cararray);&lt;br /&gt;       var env = EnvGen.ar( Env.perc(&lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.11&lt;/span&gt;, &lt;span style=" ;color:Maroon;"&gt;1&lt;/span&gt;), doneAction: &lt;span style=" ;color:Maroon;"&gt;2&lt;/span&gt;);        &lt;br /&gt;       &lt;br /&gt;       Out.ar(&lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;, Pan2.ar(car * env))&lt;br /&gt;       }).store&lt;br /&gt;       )    &lt;br /&gt;       &lt;br /&gt;       &lt;br /&gt;       (&lt;br /&gt;Pbind(\instrument, &lt;span style=" ;color:Maroon;"&gt;"efemer"&lt;/span&gt;, &lt;br /&gt;   \mod1osctype, Pseq([&lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;,&lt;span style=" ;color:Maroon;"&gt;1&lt;/span&gt;,&lt;span style=" ;color:Maroon;"&gt;2&lt;/span&gt;], inf), &lt;br /&gt;   \freq, Pseq([&lt;span style=" ;color:Maroon;"&gt;220&lt;/span&gt;,&lt;span style=" ;color:Maroon;"&gt;330&lt;/span&gt;,&lt;span style=" ;color:Maroon;"&gt;440&lt;/span&gt;,&lt;span style=" ;color:Maroon;"&gt;550&lt;/span&gt;], inf), &lt;br /&gt;   \dur, &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.3&lt;/span&gt;&lt;br /&gt;   ).play&lt;br /&gt;   )&lt;br /&gt;   &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;I think it need's some work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-8950548799456207723?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/8950548799456207723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/joy-of-frequecy-modulation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8950548799456207723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8950548799456207723'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/joy-of-frequecy-modulation.html' title='The Joy of Frequecy Modulation'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-805597440141149501</id><published>2009-03-07T15:55:00.000-08:00</published><updated>2009-03-07T16:28:34.172-08:00</updated><title type='text'>A More Accurate Theremin (possibly)</title><content type='html'>&lt;p&gt;One of the weird things about the Theremin is the way it creates sound. Rather than generating sound directly from a voltage controlled oscillator like later analogue synths, it creates sound via the &lt;a href="http://en.wikipedia.org/wiki/Heterodyne"&gt;heterodyne principle&lt;/a&gt;. Why I have no idea, but it does.  Before I go any further I sould point out that  I learned everything I know about signal processing from Wikipedia, so my explanations here might be a bit garbled.  &lt;/p&gt;&lt;p&gt;In a Theremin there are two high frequency oscilators, one at a fixed frequency and one at a frequency controlled by the movement of the players hand.  These two signals are multiplied by each other, which gives two new frequecies, one at the sum of the original two and one at the diffrence between them.  The difference of these two is the audio signal that is output, so &lt;/p&gt;&lt;p&gt;120000hz * 115000 = 235000hz and 5000hz. &lt;/p&gt;&lt;p&gt;I think. &lt;/p&gt;&lt;p&gt;So just for the hell of it I decided to try doing this in SuperCollider and surprise, it works!&lt;/p&gt;&lt;p&gt;(&lt;br /&gt;{&lt;br /&gt;var mouse = MouseX.kr(100000,110000,1);&lt;br /&gt;&lt;br /&gt;BPF.ar((SinOsc.ar(100000) * SinOsc.ar(mouse)), mouse - 100000, 0.2);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}.scope&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I've put it through a band pass filter that follows the audio frequency in an attempt to filter out what I can only assume are sidebands or aliasing or something. It doesn't quite work completely, but it's better than nothing. &lt;/p&gt;&lt;p&gt;The Ondes Martenot used heterodyning too so I did the same thing with my simple version of it. &lt;/p&gt;&lt;p&gt;(&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;var mouse = MouseX.kr(100000,110000,1);&lt;br /&gt;&lt;br /&gt;w = SCWindow.new("I catch keystrokes");&lt;br /&gt;w.front; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;FreeVerb.ar(BPF.ar((SinOsc.ar(100000, 0, KeyState.kr(36, 0, MouseY.kr(1,0)) ) * SinOsc.ar(mouse)), mouse - 100000, 0.2), 0.5, 0.3);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}.freqscope&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;And that's Jazz. &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-805597440141149501?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/805597440141149501/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/more-accurate-theremin-possibly.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/805597440141149501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/805597440141149501'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/more-accurate-theremin-possibly.html' title='A More Accurate Theremin (possibly)'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-6416634445630134316</id><published>2009-03-04T16:56:00.000-08:00</published><updated>2009-03-04T17:14:39.155-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lfo'/><category scheme='http://www.blogger.com/atom/ns#' term='modulation'/><category scheme='http://www.blogger.com/atom/ns#' term='moog'/><title type='text'>Adding LFO modulation</title><content type='html'>Another addition to my Moog style synth, LFO amplitude modulation.&lt;br /&gt;&lt;br /&gt;Here's the code,&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;(&lt;br /&gt;SynthDef(&lt;span style=" ;color:Maroon;"&gt;"Moog"&lt;/span&gt;,{&lt;br /&gt;&lt;br /&gt;arg oscType =&lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;, oscType2 = &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;, pan = &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;, level = &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.5&lt;/span&gt;, cutoff = &lt;span style=" ;color:Maroon;"&gt;500&lt;/span&gt;, gain = &lt;span style=" ;color:Maroon;"&gt;3&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.3&lt;/span&gt;,&lt;br /&gt;attack = &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.1&lt;/span&gt;, decay = &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.1&lt;/span&gt;, sust = &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.7&lt;/span&gt;, rel = &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.2&lt;/span&gt;, attackf = &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.1&lt;/span&gt;, decayf = &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.1&lt;/span&gt;,&lt;br /&gt;sustf = &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.9&lt;/span&gt;, relf = &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.2&lt;/span&gt;, gate = &lt;span style=" ;color:Maroon;"&gt;1&lt;/span&gt;, freq =&lt;span style=" ;color:Maroon;"&gt;440&lt;/span&gt;, lagLev = &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.2&lt;/span&gt;, lfo1Rate = &lt;span style=" ;color:Maroon;"&gt;12&lt;/span&gt;,&lt;br /&gt;lfo2Rate =&lt;span style=" ;color:Maroon;"&gt;4&lt;/span&gt;, lfo3Rate = &lt;span style=" ;color:Maroon;"&gt;6&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;var lfo1 = Lag2.kr(LFSaw.kr(lfo1Rate), &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.1&lt;/span&gt;);&lt;br /&gt;var lfo2 = Lag2.kr(LFTri.kr(lfo2Rate), &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.1&lt;/span&gt;);&lt;br /&gt;var lfo3 = Lag2.kr(SinOsc.kr(lfo3Rate), &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.1&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;var oscArray = [Saw.ar(Lag.kr(freq, lagLev)), SinOsc.ar(Lag.kr(freq, lagLev)),&lt;br /&gt;Pulse.ar(Lag.kr(freq, lagLev)),Saw.ar(Lag.kr(freq, lagLev), lfo1),&lt;br /&gt;SinOsc.ar(Lag.kr(freq, lagLev),&lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;, lfo1), Pulse.ar(Lag.kr(freq, lagLev), lfo1),&lt;br /&gt;Saw.ar(Lag.kr(freq, lagLev),lfo2), SinOsc.ar(Lag.kr(freq, lagLev), &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;,lfo2),&lt;br /&gt;Pulse.ar(Lag.kr(freq, lagLev), lfo2), Saw.ar(Lag.kr(freq, lagLev), lfo3),&lt;br /&gt;SinOsc.ar(Lag.kr(freq, lagLev), &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;, lfo3), Pulse.ar(Lag.kr(freq, lagLev), &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;, lfo3)];&lt;br /&gt;&lt;br /&gt;var oscArray2 = [Saw.ar(Lag.kr(freq, lagLev)), SinOsc.ar(Lag.kr(freq, lagLev)),&lt;br /&gt;Pulse.ar(Lag.kr(freq, lagLev)),Saw.ar(Lag.kr(freq, lagLev), lfo1),&lt;br /&gt;SinOsc.ar(Lag.kr(freq, lagLev),&lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;, lfo1), Pulse.ar(Lag.kr(freq, lagLev), lfo1),&lt;br /&gt;Saw.ar(Lag.kr(freq, lagLev),lfo2), SinOsc.ar(Lag.kr(freq, lagLev), &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;,lfo2),&lt;br /&gt;Pulse.ar(Lag.kr(freq, lagLev), lfo2), Saw.ar(Lag.kr(freq, lagLev), lfo3),&lt;br /&gt;SinOsc.ar(Lag.kr(freq, lagLev), &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;, lfo3), Pulse.ar(Lag.kr(freq, lagLev), &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;, lfo3)];&lt;br /&gt;&lt;br /&gt;var ampEnv = EnvGen.ar(Env.adsr(attack, decay, sust, rel), gate, doneAction:&lt;span style=" ;color:Maroon;"&gt;2&lt;/span&gt;);&lt;br /&gt;var filterEnv = EnvGen.ar(Env.adsr(attackf, decayf, sustf, relf), gate, doneAction:&lt;span style=" ;color:Maroon;"&gt;2&lt;/span&gt;);&lt;br /&gt;var osc1 = Select.ar(oscType, oscArray);&lt;br /&gt;var osc2 = Select.ar(oscType2, oscArray2);&lt;br /&gt;var fade = Pan2.ar(XFade2.ar(osc1, osc2, pan , level * ampEnv, &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;));&lt;br /&gt;var filter = MoogFF.ar(fade, cutoff * filterEnv, gain);&lt;br /&gt;Out.ar(&lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;,filter)&lt;br /&gt;&lt;br /&gt;}).store&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And here's a download &lt;a href="http://sites.google.com/site/supercolliderfiles/Home/MoogwithLFO.rtf?attredirects=0"&gt;link&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'll talk a bit more about this later.&lt;br /&gt;&lt;br /&gt;Hail Atlantis.&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-6416634445630134316?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/6416634445630134316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/adding-lfo-modulation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/6416634445630134316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/6416634445630134316'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/adding-lfo-modulation.html' title='Adding LFO modulation'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-7458945135762119935</id><published>2009-03-02T17:33:00.001-08:00</published><updated>2009-03-07T16:27:46.187-08:00</updated><title type='text'>A Simple Ondes Martenot</title><content type='html'>&lt;p&gt;The &lt;a href="http://en.wikipedia.org/wiki/Ondes_Martenot"&gt;Ondes Martenot&lt;/a&gt; is a very early electronic synthesiser created in the late 1920's by Maurice Martenot. It's generates sound in a similar way to the Theremin, but is much more sophisticated, having several waveforms and filters. &lt;/p&gt;&lt;p&gt;The unique thing about the Ondes Martenot is it's control method. Like many later monophonic synths it's got a piano style keyboard,  but it also has a unique finger ring controller. This is a ring connected to a pice of wire worn on the players right index finger, as the ring moves back and forth it alters the pitch of the synth.  &lt;/p&gt;&lt;p&gt;Whether the player is using the keyboard or the ring controller, the sounds themselves are triggered by a an experession key, a small glass button to the left of the keyboard. This is an analogue control, the more the button is pressed down the greater the amplitude. &lt;/p&gt;&lt;p&gt;Here's a YouTube Video of one being played, which should make things clearer. &lt;/p&gt;&lt;object width="425" height="344"&gt;&lt;embed src="http://www.youtube.com/v/1LobZ8vg9qE&amp;amp;hl=en&amp;amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;p&gt;You've probably seen a simple Theremin implemented in SuperCollider several times, it's a classic bit of code, the audio equivalent of 'Hello World',  here it is again in all it's glory. &lt;br /&gt;&lt;br /&gt;{SinOsc.ar(MouseX.kr(20,20000))}.play&lt;/p&gt;&lt;p&gt;To extend this a little bit I decided to create a simple Ondes Martenot style synth, using a key on the keyboard as an expression key. Sadly this is only a binary control, it's either on or off, unlike the orginal, instead I've used the mouse y position to control the level, with the key just acting as a switch. &lt;/p&gt;&lt;p&gt;Here's the code. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;pre&gt;( &lt;br /&gt;w = SCWindow.&lt;span style=" ;color:Blue;"&gt;new&lt;/span&gt;(&lt;span style=" ;color:Maroon;"&gt;"I catch keystrokes"&lt;/span&gt;);w.front;  &lt;br /&gt;{ FreeVerb.ar(SinOsc.ar(MouseX.kr(&lt;span style=" ;color:Maroon;"&gt;20&lt;/span&gt;, &lt;span style=" ;color:Maroon;"&gt;20000&lt;/span&gt;, &lt;span style=" ;color:Maroon;"&gt;1&lt;/span&gt;), &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;,&lt;br /&gt;KeyState.kr(&lt;span style=" ;color:Maroon;"&gt;36&lt;/span&gt;, &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;, MouseY.kr(&lt;span style=" ;color:Maroon;"&gt;1&lt;/span&gt;,&lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;))),&lt;br /&gt;&lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.5&lt;/span&gt;, &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.3&lt;/span&gt;, &lt;span style=" ;color:Maroon;"&gt;0&lt;/span&gt;&lt;span style=" ;color:Maroon;"&gt;.1&lt;/span&gt;) }.play; &lt;br /&gt;)&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;This firstly creates a standard window, as the title suggests, to catch keystrokes. I got this idea from the help file on keyboard input, it serves no purpose other than as a safe place to direct keyboard input to. &lt;/p&gt;&lt;p&gt;A keyState ugen provides the extra control input to the SinOsc. A KeyState takes 3 arguments, the key number it is to respond to, the output when the key is not pressed and the output when it is. As you can see Im using this to control the amplitude of a SinOsc, when key 36 (the enter key) is pressed it outputs the mouse y value as the multiplier for the osc. &lt;/p&gt;&lt;p&gt;Using the a key to trigger the sound gives a bit more expressive power than the standard Theremin, plus it's great for doing impressions of the &lt;a href="http://en.wikipedia.org/wiki/Clangers"&gt;Clangers.&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-7458945135762119935?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/7458945135762119935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/simple-ondes-martenot.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/7458945135762119935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/7458945135762119935'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/simple-ondes-martenot.html' title='A Simple Ondes Martenot'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-3590948047409972093</id><published>2009-03-01T13:14:00.000-08:00</published><updated>2009-03-01T13:38:29.947-08:00</updated><title type='text'>Another try with the 303 code.</title><content type='html'>&lt;p&gt;It's been pointed out that blogger's formatting has mangled some of the code here. This is an attempt to rectify that. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;If anyone has any trouble copy and pasting this please let me know. &lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;(&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;s = &lt;span style="color:#0000bf;"&gt;Server&lt;/span&gt;.internal;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SynthDef&lt;/span&gt;(&lt;span style="color:#606060;"&gt;"sc303"&lt;/span&gt;, { &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; out=0, freq=440, wave=0, ctf=100, res=0.2,&lt;span class="Apple-converted-space"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;sus=0, dec=1.0, env=1000, gate=0, vol=0.2;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span style="color:#0000bf;"&gt;var&lt;/span&gt; filEnv, volEnv, waves;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// can't use adsr with exp curve???&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;//volEnv = EnvGen.ar(Env.adsr(1, 0, 1, dec, vol, 'exp'), In.kr(bus));&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;volEnv = &lt;span style="color:#0000bf;"&gt;EnvGen&lt;/span&gt;.ar(&lt;span style="color:#0000bf;"&gt;Env&lt;/span&gt;.new([10e-10, 1, 1, 10e-10], [0.01, sus, dec], &lt;span style="color:#007300;"&gt;'exp'&lt;/span&gt;), gate);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;filEnv = &lt;span style="color:#0000bf;"&gt;EnvGen&lt;/span&gt;.ar(&lt;span style="color:#0000bf;"&gt;Env&lt;/span&gt;.new([10e-10, 1, 10e-10], [0.01, dec], &lt;span style="color:#007300;"&gt;'exp'&lt;/span&gt;), gate);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;waves = [&lt;span style="color:#0000bf;"&gt;Saw&lt;/span&gt;.ar(freq, volEnv), &lt;span style="color:#0000bf;"&gt;Pulse&lt;/span&gt;.ar(freq, 0.5, volEnv)];&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span style="color:#0000bf;"&gt;Out&lt;/span&gt;.ar(out, &lt;span style="color:#0000bf;"&gt;RLPF&lt;/span&gt;.ar( &lt;span style="color:#0000bf;"&gt;Select&lt;/span&gt;.ar(wave, waves), ctf + (filEnv * env), res).dup * vol);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;}).send(s);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;/*&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;s.sendMsg("s_new", "sc303", 3000, 0, 0);&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;s.sendMsg("n_set", 3000, 'gate', 1, 'freq', 220);&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;s.sendMsg("n_set", 3000, 'gate', 0);&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;s.sendMsg("n_set", 3000, 'dec', 1);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;s.sendMsg("n_free", ~node)&lt;span class="Apple-converted-space"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;*/&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;// make GUI!&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;(&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~bpm = 140;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~step = 0;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// set default note ons&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~defaultNoteOns = &lt;span style="color:#0000bf;"&gt;Array&lt;/span&gt;.fill(16,1);&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// this is the note on array that will be used in the sequencer routine&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~noteOns = ~defaultNoteOns;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// set root&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~root = 36;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// set default pitches&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~defaultPitches = [ 0, 12, 0, 0, -12, 0, 0, 0, -12, 0, 12, 0, 3, -5, 2, 0 ];&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// this is the pitch array that will be used in the sequencer routine&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~pitches = ~defaultPitches;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;~tStepLED = &lt;/span&gt;&lt;span style="color:#0000bf;"&gt;Array&lt;/span&gt;&lt;span style="color:#000000;"&gt;.new; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// the step indicator LEDs as an array&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;~sNoteOn = &lt;/span&gt;&lt;span style="color:#0000bf;"&gt;Array&lt;/span&gt;&lt;span style="color:#000000;"&gt;.new;&lt;span class="Apple-converted-space"&gt;  &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;// the note-on sliders as an array&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;~tNoteOn = &lt;/span&gt;&lt;span style="color:#0000bf;"&gt;Array&lt;/span&gt;&lt;span style="color:#000000;"&gt;.new;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// the note-on value boxes as an array&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;~sPitch = &lt;/span&gt;&lt;span style="color:#0000bf;"&gt;Array&lt;/span&gt;&lt;span style="color:#000000;"&gt;.new;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// the pitch sliders as an array&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;~tPitch = &lt;/span&gt;&lt;span style="color:#0000bf;"&gt;Array&lt;/span&gt;&lt;span style="color:#000000;"&gt;.new; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// the pitch value boxes as an array&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;w = &lt;span style="color:#0000bf;"&gt;SCWindow&lt;/span&gt;(&lt;span style="color:#606060;"&gt;"SC-303"&lt;/span&gt;, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(128, 64, 510, 320));&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;w.view.background = &lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.white;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;w.front;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~layoutLeft = &lt;span style="color:#0000bf;"&gt;SCCompositeView&lt;/span&gt;(w, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0, 0, 400, 320));&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span style="color:#bf0000;"&gt;// make the left pane of the window&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~layoutLeft.decorator = &lt;span style="color:#0000bf;"&gt;FlowLayout&lt;/span&gt;(~layoutLeft.bounds); &lt;span style="color:#bf0000;"&gt;// auto-arrange the elements&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~layoutRight = &lt;span style="color:#0000bf;"&gt;SCCompositeView&lt;/span&gt;(w, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(400, 0, 400, 120));&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~layoutRight.decorator = &lt;span style="color:#0000bf;"&gt;FlowLayout&lt;/span&gt;(~layoutRight.bounds);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;// make transport controls&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// Tempo&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCStaticText&lt;/span&gt;(~layoutRight, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 45, 14)).string_(&lt;span style="color:#606060;"&gt;"BPM: "&lt;/span&gt;);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~tBpm = &lt;span style="color:#0000bf;"&gt;SCNumberBox&lt;/span&gt;(~layoutRight, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 45, 14))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.string_(~bpm)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.action_({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; item;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~bpm = item.value;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~sBpm.value_((~bpm-40)/200);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~layoutRight.decorator.nextLine;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~sBpm = &lt;span style="color:#0000bf;"&gt;SCSlider&lt;/span&gt;(~layoutRight, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 100, 20))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new(0.8,0.8,0.8))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.value_((~bpm-40)/200)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.action_({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; sldr;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~bpm = ((sldr.value)*200) + 40;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~tBpm.string_(~bpm);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~layoutRight.decorator.nextLine;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// Reset&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCButton&lt;/span&gt;(~layoutRight, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0,45,20))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.states_([[&lt;span style="color:#606060;"&gt;"|&amp;lt;"&lt;/span&gt;]])&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.action_({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; item;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~tStepLED[~step].background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new(0.6,0,0));&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~step = 0;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~tStepLED[0].background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new(1,0,0));&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// Play/Pause&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCButton&lt;/span&gt;(~layoutRight, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0,45,20))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.states_([[&lt;span style="color:#606060;"&gt;"&amp;gt;"&lt;/span&gt;],[&lt;span style="color:#606060;"&gt;"||"&lt;/span&gt;]])&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.action_({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; item;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;if( item.value == 0, {&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~seqr.stop;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;},{&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~seqr.reset;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~seqr.play;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~layoutRight.decorator.nextLine;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// Root note&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCStaticText&lt;/span&gt;(~layoutRight, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 45, 14)).string_(&lt;span style="color:#606060;"&gt;"Root: "&lt;/span&gt;);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~tRoot = &lt;span style="color:#0000bf;"&gt;SCStaticText&lt;/span&gt;(~layoutRight, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 45, 14)).string_(~root);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~layoutRight.decorator.nextLine;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCSlider&lt;/span&gt;(~layoutRight, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 100, 20))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new(0.8,0.8,0.8))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.value_((~root-24)/36)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.step_(1/48)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.action_({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; sldr;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~root = ((sldr.value)*36) + 24;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~tRoot.string_(~root);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;// make synth control labels&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCStaticText&lt;/span&gt;(~layoutLeft, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 45, 14)).string_(&lt;span style="color:#606060;"&gt;"Wave"&lt;/span&gt;);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCStaticText&lt;/span&gt;(~layoutLeft, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 80, 14)).string_(&lt;span style="color:#606060;"&gt;"Cutoff"&lt;/span&gt;);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCStaticText&lt;/span&gt;(~layoutLeft, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 80, 14)).string_(&lt;span style="color:#606060;"&gt;"Resonance"&lt;/span&gt;);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCStaticText&lt;/span&gt;(~layoutLeft, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 80, 14)).string_(&lt;span style="color:#606060;"&gt;"Decay"&lt;/span&gt;);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCStaticText&lt;/span&gt;(~layoutLeft, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 80, 14)).string_(&lt;span style="color:#606060;"&gt;"Envelope"&lt;/span&gt;);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~layoutLeft.decorator.nextLine;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;// make the synth controls&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// wave-type&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCButton&lt;/span&gt;(~layoutLeft, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0,45,20))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.states_([[&lt;span style="color:#606060;"&gt;"Saw"&lt;/span&gt;],[&lt;span style="color:#606060;"&gt;"Square"&lt;/span&gt;]])&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.action_({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; item;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;s.sendMsg(&lt;span style="color:#606060;"&gt;"n_set"&lt;/span&gt;, ~node, &lt;span style="color:#007300;"&gt;'wave'&lt;/span&gt;, item.value);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// cut-off frequency&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCSlider&lt;/span&gt;(~layoutLeft, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 80, 20))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new(0.8,0.8,0.8))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.action_({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; sldr;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;s.sendMsg(&lt;span style="color:#606060;"&gt;"n_set"&lt;/span&gt;, ~node, &lt;span style="color:#007300;"&gt;'ctf'&lt;/span&gt;, ((sldr.value)*(10000-100))+100); &lt;span style="color:#bf0000;"&gt;// modify synth param&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// resonance amt&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCSlider&lt;/span&gt;(~layoutLeft, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 80, 20))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new(0.8,0.8,0.8))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.action_({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; sldr;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;s.sendMsg(&lt;span style="color:#606060;"&gt;"n_set"&lt;/span&gt;, ~node, &lt;span style="color:#007300;"&gt;'res'&lt;/span&gt;, (1-sldr.value)*(0.97)+0.03); &lt;span style="color:#bf0000;"&gt;// modify synth param&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// decay amt&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCSlider&lt;/span&gt;(~layoutLeft, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 80, 20))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new(0.8,0.8,0.8))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.action_({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; sldr;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;s.sendMsg(&lt;span style="color:#606060;"&gt;"n_set"&lt;/span&gt;, ~node, &lt;span style="color:#007300;"&gt;'dec'&lt;/span&gt;, (sldr.value)*2); &lt;span style="color:#bf0000;"&gt;// modify synth param&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// envelope amt&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span style="color:#0000bf;"&gt;SCSlider&lt;/span&gt;(~layoutLeft, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0, 80, 20))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new(0.8,0.8,0.8))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.action_({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; sldr;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;s.sendMsg(&lt;span style="color:#606060;"&gt;"n_set"&lt;/span&gt;, ~node, &lt;span style="color:#007300;"&gt;'env'&lt;/span&gt;, (sldr.value)*10000); &lt;span style="color:#bf0000;"&gt;// modify synth param&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~layoutLeft.decorator.nextLine;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// make step LEDs&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;16.do({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; i;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~tStepLED = ~tStepLED.add(&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span style="color:#0000bf;"&gt;SCStaticText&lt;/span&gt;(~layoutLeft, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0,20,12))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new(0.6,0,0))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.stringColor_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.white)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.string_(i+1)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~tStepLED[~step].background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new(1,0,0));&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~layoutLeft.decorator.nextLine;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// make the note-on sliders&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;16.do({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; i;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~sNoteOn = ~sNoteOn.add(&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000bf;"&gt;SCSlider&lt;/span&gt;&lt;span style="color:#000000;"&gt;(~layoutLeft, &lt;/span&gt;&lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;&lt;span style="color:#000000;"&gt;(0,0,20,60))&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// position doesn't matter; width, height do&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new(0,0,0.7))&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span style="color:#bf0000;"&gt;// color the slider&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.step_(0.1)&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// values are stepped by 0.1&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.value_(~noteOns[i])&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// assign it its value from the note on array&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.action_({ &lt;/span&gt;&lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt;&lt;span style="color:#000000;"&gt; sldr;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// when the slider is moved...&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~noteOns[i] = sldr.value;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span style="color:#bf0000;"&gt;// ... update note-on array&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~tNoteOn[i].string = sldr.value; &lt;span style="color:#bf0000;"&gt;// ... update its value box&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// ...change color of value box&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~tNoteOn[i].background = &lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new((1-~noteOns[i]),1,(1-~noteOns[i]));&lt;span class="Apple-converted-space"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;})&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~layoutLeft.decorator.nextLine;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// make the note-on value boxes&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;16.do({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; i;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~tNoteOn = ~tNoteOn.add(&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span style="color:#0000bf;"&gt;SCStaticText&lt;/span&gt;(~layoutLeft, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0,20,20))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new((1-~noteOns[i]),1,(1-~noteOns[i])))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.string_(~sNoteOn[i].value)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.align_(0)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.action_({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; text;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;text.string.postln;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;})&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~layoutLeft.decorator.nextLine;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// make the pitch sliders&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;16.do({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; i;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~sPitch = ~sPitch.add(&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span style="color:#0000bf;"&gt;SCSlider&lt;/span&gt;(~layoutLeft, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0,20,120))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.value_((~pitches[i]+12)/24)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.step_(1/24)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new(0.8,0.8,0.8))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.action_({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; item;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~pitches[i] = ((item.value * 24)-12);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~tPitch[i].string = ((item.value * 24)-12);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;})&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~layoutLeft.decorator.nextLine;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// make the pitch value boxes&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;16.do({ &lt;span style="color:#0000bf;"&gt;arg&lt;/span&gt; i;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~tPitch = ~tPitch.add(&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span style="color:#0000bf;"&gt;SCStaticText&lt;/span&gt;(~layoutLeft, &lt;span style="color:#0000bf;"&gt;Rect&lt;/span&gt;(0,0,20,20))&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.white)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.string_(~pitches[i].value)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.align_(0)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;/*~tempButt = SCButton(w, Rect(0,0,60,60))&lt;/p&gt;&lt;br /&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color:#bf0000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;.states_([&lt;/p&gt;&lt;br /&gt;&lt;p color="#bf0000" style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;["0", Color.red, Color.black]&lt;/p&gt;&lt;br /&gt;&lt;p color="#bf0000" style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;]);*/&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p color="#bf0000" style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; "&gt;// do other stuff&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;(&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~node = s.nextNodeID;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p color="#bf0000" style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; "&gt;// start the synth&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;s.sendMsg(&lt;span style="color:#606060;"&gt;"s_new"&lt;/span&gt;, &lt;span style="color:#606060;"&gt;"sc303"&lt;/span&gt;, ~node, 1, 1);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p color="#bf0000" style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; "&gt;// make the step sequencer&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~seqr = &lt;span style="color:#0000bf;"&gt;Routine&lt;/span&gt;.new({&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;loop({&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p color="#bf0000" style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; "&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// turn on LED&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;{~tStepLED[~step].background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new(1,0,0)); &lt;span style="color:#bf0000;"&gt;/*(~step.asString + "on").postln;*/&lt;/span&gt;}.defer;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;if(~noteOns[~step].coin, {&lt;/p&gt;&lt;br /&gt;&lt;p color="#bf0000" style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; "&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// play note!&lt;/p&gt;&lt;br /&gt;&lt;p color="#bf0000" style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; "&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// this is out of sync&lt;/p&gt;&lt;br /&gt;&lt;p color="#bf0000" style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; "&gt;&lt;span style="font: 12.0px Helvetica"&gt;//&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;s.sendMsg("n_set", ~node, 'gate', 1, 'freq', (~pitches[~step]+~root).midicps);&lt;/p&gt;&lt;br /&gt;&lt;p color="#bf0000" style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; "&gt;&lt;span style="font: 12.0px Helvetica"&gt;//&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;(7.5/~bpm).wait;&lt;/p&gt;&lt;br /&gt;&lt;p color="#bf0000" style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; "&gt;&lt;span style="font: 12.0px Helvetica"&gt;//&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;s.sendMsg("n_set", ~node, 'gate', 0);&lt;/p&gt;&lt;br /&gt;&lt;p color="#bf0000" style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; "&gt;&lt;span style="font: 12.0px Helvetica"&gt;//&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;(7.5/~bpm).wait;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// buffer playback on server (adds start/stop delay, but better inter-note timing)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;s.sendBundle(s.latency, [&lt;span style="color:#606060;"&gt;"n_set"&lt;/span&gt;, ~node, &lt;span style="color:#007300;"&gt;'gate'&lt;/span&gt;, 1, &lt;span style="color:#007300;"&gt;'freq'&lt;/span&gt;, (~pitches[~step]+~root).midicps]);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;(7.5/~bpm).wait;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;s.sendBundle(s.latency, [&lt;span style="color:#606060;"&gt;"n_set"&lt;/span&gt;, ~node, &lt;span style="color:#007300;"&gt;'gate'&lt;/span&gt;, 0]);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;(7.5/~bpm).wait;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;},{&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// it's a rest&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;(15/~bpm).wait;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;// turn off LED&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;{~tStepLED[(~step-1)%16].background_(&lt;span style="color:#0000bf;"&gt;Color&lt;/span&gt;.new(0.6,0,0)); &lt;span style="color:#bf0000;"&gt;/*(((~step-1)%16).asString + "off").postln;*/&lt;/span&gt;}.defer;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;~step = (~step + 1)%16;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;});&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~seqr.play;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~seqr.stop;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~seqr.reset;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco"&gt;~pitches&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-3590948047409972093?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/3590948047409972093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/another-try-with-303-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3590948047409972093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3590948047409972093'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/03/another-try-with-303-code.html' title='Another try with the 303 code.'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-5998438480682258490</id><published>2009-02-28T16:54:00.001-08:00</published><updated>2009-02-28T17:27:56.068-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='303'/><category scheme='http://www.blogger.com/atom/ns#' term='routines'/><title type='text'>303 Emulator</title><content type='html'>&lt;p&gt;Found in the depths of the SC Users list archive, a very nice 303 emulator created by SuperCollidist extraordinaire &lt;a href="http://www.mat.ucsb.edu/~l.putnam/code.html"&gt;Lance J. Putnam&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;To run this you'll need to evaluate the two sections separately, then send the sequncer routine a play message, like this. &lt;/p&gt;&lt;p&gt;~seqr.play;&lt;/p&gt;&lt;p&gt;This is a fairly large chunk of code so here's an &lt;a href="http://sites.google.com/site/supercolliderfiles/Home/303.rtf?attredirects=0"&gt; .rtf version. &lt;/a&gt;  &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;(&lt;br /&gt;s = Server.internal;&lt;br /&gt;&lt;br /&gt;SynthDef("sc303", { arg out=0, freq=440, wave=0, ctf=100, res=0.2, &lt;br /&gt;  sus=0, dec=1.0, env=1000, gate=0, vol=0.2;&lt;br /&gt; var filEnv, volEnv, waves;&lt;br /&gt; &lt;br /&gt; // can't use adsr with exp curve???&lt;br /&gt; //volEnv = EnvGen.ar(Env.adsr(1, 0, 1, dec, vol, 'exp'), In.kr(bus));&lt;br /&gt; volEnv = EnvGen.ar(Env.new([10e-10, 1, 1, 10e-10], [0.01, sus, dec], 'exp'), gate);&lt;br /&gt; filEnv = EnvGen.ar(Env.new([10e-10, 1, 10e-10], [0.01, dec], 'exp'), gate);&lt;br /&gt; &lt;br /&gt; waves = [Saw.ar(freq, volEnv), Pulse.ar(freq, 0.5, volEnv)];&lt;br /&gt; &lt;br /&gt; Out.ar(out, RLPF.ar( Select.ar(wave, waves), ctf + (filEnv * env), res).dup * vol);&lt;br /&gt;}).send(s);&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;s.sendMsg("s_new", "sc303", 3000, 0, 0);&lt;br /&gt;s.sendMsg("n_set", 3000, 'gate', 1, 'freq', 220);&lt;br /&gt;s.sendMsg("n_set", 3000, 'gate', 0);&lt;br /&gt;s.sendMsg("n_set", 3000, 'dec', 1);&lt;br /&gt;&lt;br /&gt;s.sendMsg("n_free", ~node) &lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// make GUI!&lt;br /&gt;(&lt;br /&gt;~bpm = 140;&lt;br /&gt;~step = 0;&lt;br /&gt; // set default note ons&lt;br /&gt;~defaultNoteOns = Array.fill(16,1);&lt;br /&gt; // this is the note on array that will be used in the sequencer routine&lt;br /&gt;~noteOns = ~defaultNoteOns;&lt;br /&gt;&lt;br /&gt; // set root&lt;br /&gt;~root = 36;&lt;br /&gt;&lt;br /&gt; // set default pitches&lt;br /&gt;~defaultPitches = [ 0, 12, 0, 0, -12, 0, 0, 0, -12, 0, 12, 0, 3, -5, 2, 0 ];&lt;br /&gt; // this is the pitch array that will be used in the sequencer routine&lt;br /&gt;~pitches = ~defaultPitches;&lt;br /&gt;&lt;br /&gt;~tStepLED = Array.new;  // the step indicator LEDs as an array&lt;br /&gt;~sNoteOn = Array.new;   // the note-on sliders as an array&lt;br /&gt;~tNoteOn = Array.new; // the note-on value boxes as an array&lt;br /&gt;~sPitch = Array.new; // the pitch sliders as an array&lt;br /&gt;~tPitch = Array.new;  // the pitch value boxes as an array&lt;br /&gt;&lt;br /&gt;w = SCWindow("SC-303", Rect(128, 64, 510, 320));&lt;br /&gt;w.view.background = Color.white;&lt;br /&gt;w.front;&lt;br /&gt;&lt;br /&gt;~layoutLeft = SCCompositeView(w, Rect(0, 0, 400, 320)); // make the left pane of the window&lt;br /&gt;~layoutLeft.decorator = FlowLayout(~layoutLeft.bounds); // auto-arrange the elements&lt;br /&gt;~layoutRight = SCCompositeView(w, Rect(400, 0, 400, 120));&lt;br /&gt;~layoutRight.decorator = FlowLayout(~layoutRight.bounds);&lt;br /&gt;&lt;br /&gt;// make transport controls&lt;br /&gt;&lt;br /&gt; // Tempo&lt;br /&gt;SCStaticText(~layoutRight, Rect(0,0, 45, 14)).string_("BPM: ");&lt;br /&gt;~tBpm = SCNumberBox(~layoutRight, Rect(0,0, 45, 14))&lt;br /&gt; .string_(~bpm)&lt;br /&gt; .action_({ arg item;&lt;br /&gt;  ~bpm = item.value;&lt;br /&gt;  ~sBpm.value_((~bpm-40)/200);&lt;br /&gt; });&lt;br /&gt;&lt;br /&gt;~layoutRight.decorator.nextLine;&lt;br /&gt;~sBpm = SCSlider(~layoutRight, Rect(0,0, 100, 20))&lt;br /&gt; .background_(Color.new(0.8,0.8,0.8))&lt;br /&gt; .value_((~bpm-40)/200)&lt;br /&gt; .action_({ arg sldr;&lt;br /&gt;  ~bpm = ((sldr.value)*200) + 40;&lt;br /&gt;  ~tBpm.string_(~bpm);&lt;br /&gt; });&lt;br /&gt;&lt;br /&gt;~layoutRight.decorator.nextLine;&lt;br /&gt;&lt;br /&gt; // Reset&lt;br /&gt;SCButton(~layoutRight, Rect(0,0,45,20))&lt;br /&gt; .states_([["|&lt;"]])  .action_({ arg item;   ~tStepLED[~step].background_(Color.new(0.6,0,0));   ~step = 0;   ~tStepLED[0].background_(Color.new(1,0,0));  });   // Play/Pause SCButton(~layoutRight, Rect(0,0,45,20))  .states_([["&gt;"],["||"]])&lt;br /&gt; .action_({ arg item;&lt;br /&gt;  if( item.value == 0, {&lt;br /&gt;   ~seqr.stop;&lt;br /&gt;  },{&lt;br /&gt;   ~seqr.reset;&lt;br /&gt;   ~seqr.play;&lt;br /&gt;  });&lt;br /&gt; });&lt;br /&gt;&lt;br /&gt;~layoutRight.decorator.nextLine;&lt;br /&gt;&lt;br /&gt; // Root note&lt;br /&gt;SCStaticText(~layoutRight, Rect(0,0, 45, 14)).string_("Root: ");&lt;br /&gt;~tRoot = SCStaticText(~layoutRight, Rect(0,0, 45, 14)).string_(~root);&lt;br /&gt;~layoutRight.decorator.nextLine;&lt;br /&gt;SCSlider(~layoutRight, Rect(0,0, 100, 20))&lt;br /&gt; .background_(Color.new(0.8,0.8,0.8))&lt;br /&gt; .value_((~root-24)/36)&lt;br /&gt; .step_(1/48)&lt;br /&gt; .action_({ arg sldr;&lt;br /&gt;  ~root = ((sldr.value)*36) + 24;&lt;br /&gt;  ~tRoot.string_(~root);&lt;br /&gt; });&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;// make synth control labels&lt;br /&gt;SCStaticText(~layoutLeft, Rect(0,0, 45, 14)).string_("Wave");&lt;br /&gt;SCStaticText(~layoutLeft, Rect(0,0, 80, 14)).string_("Cutoff");&lt;br /&gt;SCStaticText(~layoutLeft, Rect(0,0, 80, 14)).string_("Resonance");&lt;br /&gt;SCStaticText(~layoutLeft, Rect(0,0, 80, 14)).string_("Decay");&lt;br /&gt;SCStaticText(~layoutLeft, Rect(0,0, 80, 14)).string_("Envelope");&lt;br /&gt;~layoutLeft.decorator.nextLine;&lt;br /&gt;&lt;br /&gt;// make the synth controls&lt;br /&gt; // wave-type&lt;br /&gt;SCButton(~layoutLeft, Rect(0,0,45,20))&lt;br /&gt; .states_([["Saw"],["Square"]])&lt;br /&gt; .action_({ arg item;&lt;br /&gt;  s.sendMsg("n_set", ~node, 'wave', item.value);&lt;br /&gt; });&lt;br /&gt; // cut-off frequency&lt;br /&gt;SCSlider(~layoutLeft, Rect(0,0, 80, 20))&lt;br /&gt; .background_(Color.new(0.8,0.8,0.8))&lt;br /&gt; .action_({ arg sldr;&lt;br /&gt;  s.sendMsg("n_set", ~node, 'ctf', ((sldr.value)*(10000-100))+100); // modify synth param&lt;br /&gt; });&lt;br /&gt; &lt;br /&gt; // resonance amt&lt;br /&gt;SCSlider(~layoutLeft, Rect(0,0, 80, 20))&lt;br /&gt; .background_(Color.new(0.8,0.8,0.8))&lt;br /&gt; .action_({ arg sldr;&lt;br /&gt;  s.sendMsg("n_set", ~node, 'res', (1-sldr.value)*(0.97)+0.03); // modify synth param&lt;br /&gt; });&lt;br /&gt; &lt;br /&gt; // decay amt&lt;br /&gt;SCSlider(~layoutLeft, Rect(0,0, 80, 20))&lt;br /&gt; .background_(Color.new(0.8,0.8,0.8))&lt;br /&gt; .action_({ arg sldr;&lt;br /&gt;  s.sendMsg("n_set", ~node, 'dec', (sldr.value)*2); // modify synth param&lt;br /&gt; });&lt;br /&gt; &lt;br /&gt; // envelope amt&lt;br /&gt;SCSlider(~layoutLeft, Rect(0,0, 80, 20))&lt;br /&gt; .background_(Color.new(0.8,0.8,0.8))&lt;br /&gt; .action_({ arg sldr;&lt;br /&gt;  s.sendMsg("n_set", ~node, 'env', (sldr.value)*10000); // modify synth param&lt;br /&gt; });&lt;br /&gt;&lt;br /&gt;~layoutLeft.decorator.nextLine;&lt;br /&gt;&lt;br /&gt; // make step LEDs&lt;br /&gt;16.do({ arg i;&lt;br /&gt; ~tStepLED = ~tStepLED.add(&lt;br /&gt;  SCStaticText(~layoutLeft, Rect(0,0,20,12))&lt;br /&gt;   .background_(Color.new(0.6,0,0))&lt;br /&gt;   .stringColor_(Color.white)&lt;br /&gt;   .string_(i+1)&lt;br /&gt; );&lt;br /&gt;});&lt;br /&gt;~tStepLED[~step].background_(Color.new(1,0,0));&lt;br /&gt;~layoutLeft.decorator.nextLine;&lt;br /&gt;&lt;br /&gt; // make the note-on sliders&lt;br /&gt;16.do({ arg i;&lt;br /&gt; ~sNoteOn = ~sNoteOn.add(&lt;br /&gt;  SCSlider(~layoutLeft, Rect(0,0,20,60))   // position doesn't matter; width, height do&lt;br /&gt;   .background_(Color.new(0,0,0.7))  // color the slider&lt;br /&gt;   .step_(0.1)      // values are stepped by 0.1&lt;br /&gt;   .value_(~noteOns[i])    // assign it its value from the note on array&lt;br /&gt;   .action_({ arg sldr;    // when the slider is moved...&lt;br /&gt;    ~noteOns[i] = sldr.value;  // ... update note-on array&lt;br /&gt;    ~tNoteOn[i].string = sldr.value; // ... update its value box&lt;br /&gt;     // ...change color of value box&lt;br /&gt;    ~tNoteOn[i].background = Color.new((1-~noteOns[i]),1,(1-~noteOns[i])); &lt;br /&gt;   })&lt;br /&gt; );&lt;br /&gt;});&lt;br /&gt;~layoutLeft.decorator.nextLine;&lt;br /&gt;&lt;br /&gt; // make the note-on value boxes&lt;br /&gt;16.do({ arg i;&lt;br /&gt; ~tNoteOn = ~tNoteOn.add(&lt;br /&gt;  SCStaticText(~layoutLeft, Rect(0,0,20,20))&lt;br /&gt;   .background_(Color.new((1-~noteOns[i]),1,(1-~noteOns[i])))&lt;br /&gt;   .string_(~sNoteOn[i].value)&lt;br /&gt;   .align_(0)&lt;br /&gt;   .action_({ arg text;&lt;br /&gt;    text.string.postln;&lt;br /&gt;   })&lt;br /&gt; );&lt;br /&gt;});&lt;br /&gt;~layoutLeft.decorator.nextLine;&lt;br /&gt;&lt;br /&gt; // make the pitch sliders&lt;br /&gt;16.do({ arg i;&lt;br /&gt; ~sPitch = ~sPitch.add(&lt;br /&gt;  SCSlider(~layoutLeft, Rect(0,0,20,120))&lt;br /&gt;   .value_((~pitches[i]+12)/24)&lt;br /&gt;   .step_(1/24)&lt;br /&gt;   .background_(Color.new(0.8,0.8,0.8))&lt;br /&gt;   .action_({ arg item;&lt;br /&gt;    ~pitches[i] = ((item.value * 24)-12);&lt;br /&gt;    ~tPitch[i].string = ((item.value * 24)-12);&lt;br /&gt;   })&lt;br /&gt; );&lt;br /&gt;});&lt;br /&gt;~layoutLeft.decorator.nextLine;&lt;br /&gt;&lt;br /&gt; // make the pitch value boxes&lt;br /&gt;16.do({ arg i;&lt;br /&gt; ~tPitch = ~tPitch.add(&lt;br /&gt;  SCStaticText(~layoutLeft, Rect(0,0,20,20))&lt;br /&gt;   .background_(Color.white)&lt;br /&gt;   .string_(~pitches[i].value)&lt;br /&gt;   .align_(0)&lt;br /&gt; );&lt;br /&gt;});&lt;br /&gt;/*~tempButt = SCButton(w, Rect(0,0,60,60))&lt;br /&gt;   .states_([&lt;br /&gt;    ["0", Color.red, Color.black]&lt;br /&gt;   ]);*/&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;// do other stuff&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;~node = s.nextNodeID;&lt;br /&gt;&lt;br /&gt;// start the synth&lt;br /&gt;s.sendMsg("s_new", "sc303", ~node, 1, 1);&lt;br /&gt;&lt;br /&gt;// make the step sequencer&lt;br /&gt;~seqr = Routine.new({&lt;br /&gt; loop({&lt;br /&gt;   &lt;br /&gt;   // turn on LED&lt;br /&gt;  {~tStepLED[~step].background_(Color.new(1,0,0)); /*(~step.asString + "on").postln;*/}.defer;&lt;br /&gt; &lt;br /&gt;  if(~noteOns[~step].coin, {&lt;br /&gt;   // play note!&lt;br /&gt;    // this is out of sync&lt;br /&gt;//   s.sendMsg("n_set", ~node, 'gate', 1, 'freq', (~pitches[~step]+~root).midicps);&lt;br /&gt;//   (7.5/~bpm).wait;&lt;br /&gt;//   s.sendMsg("n_set", ~node, 'gate', 0);&lt;br /&gt;//   (7.5/~bpm).wait;&lt;br /&gt;   &lt;br /&gt;    // buffer playback on server (adds start/stop delay, but better inter-note timing)&lt;br /&gt;   s.sendBundle(s.latency, ["n_set", ~node, 'gate', 1, 'freq', (~pitches[~step]+~root).midicps]);&lt;br /&gt;   (7.5/~bpm).wait;&lt;br /&gt;   s.sendBundle(s.latency, ["n_set", ~node, 'gate', 0]);&lt;br /&gt;   (7.5/~bpm).wait;&lt;br /&gt;  },{&lt;br /&gt;    // it's a rest&lt;br /&gt;   (15/~bpm).wait;&lt;br /&gt;  });&lt;br /&gt;  &lt;br /&gt;   // turn off LED&lt;br /&gt;  {~tStepLED[(~step-1)%16].background_(Color.new(0.6,0,0)); /*(((~step-1)%16).asString + "off").postln;*/}.defer;&lt;br /&gt;  &lt;br /&gt;  ~step = (~step + 1)%16; &lt;br /&gt;  &lt;br /&gt; });&lt;br /&gt;});&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;~seqr.play;&lt;br /&gt;~seqr.stop;&lt;br /&gt;~seqr.reset;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;I'm going to go into this in more detail and possibly add to it or adapt it later... &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-5998438480682258490?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/5998438480682258490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/303-emulator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/5998438480682258490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/5998438480682258490'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/303-emulator.html' title='303 Emulator'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-8450190712815329270</id><published>2009-02-26T16:26:00.000-08:00</published><updated>2009-02-26T16:33:23.328-08:00</updated><title type='text'>Auto Gui</title><content type='html'>Hidden away in the GUI Overview help file this little gem, &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Automatic GUI&lt;br /&gt;&lt;br /&gt;You can get a quick simple automatic interface for a Synth with SynthDesc : makeWindow.&lt;br /&gt;&lt;br /&gt; (&lt;br /&gt; s.waitForBoot({&lt;br /&gt;  SynthDef("test", { arg out, freq=330, amp=0.6;&lt;br /&gt;   Out.ar(out, SinOsc.ar(freq,0,amp))&lt;br /&gt;  }).store;&lt;br /&gt;  &lt;br /&gt; &lt;br /&gt;  SynthDescLib.global.at(\test).makeWindow;&lt;br /&gt; });&lt;br /&gt; )&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;An auto GUI creator. &lt;br /&gt;I haven't really read around it much yet, but it seems to work pretty well. &lt;br /&gt;&lt;br /&gt;I decided to mate it with the wonderful &lt;a href="http://www.fredrikolofsson.com/pages/code-sc.html"&gt;Atari2600 Ugen&lt;/a&gt; from Fredrik Olofsson. &lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;SynthDef(\atari2600, {|out= 0, gate= 1, tone0= 5, tone1= 8, freq0= 10, freq1= 20, rate= 1, amp= 1, pan= 0|&lt;br /&gt; var e, z;&lt;br /&gt; e= EnvGen.kr(Env.asr(0.01, amp, 0.05), gate, doneAction:2);&lt;br /&gt; z= Atari2600.ar(tone0, tone1, freq0, freq1, 15, 15, rate);&lt;br /&gt; Out.ar(out, Pan2.ar(z*e, pan));&lt;br /&gt;}).store&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;SynthDescLib.global.at(\atari2600).makeWindow;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And I got a handy widget for exploring a new Ugen.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-8450190712815329270?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/8450190712815329270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/auto-gui.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8450190712815329270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8450190712815329270'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/auto-gui.html' title='Auto Gui'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-2429301787810360511</id><published>2009-02-24T16:38:00.000-08:00</published><updated>2009-02-27T11:33:46.307-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='shazam'/><category scheme='http://www.blogger.com/atom/ns#' term='Gui'/><category scheme='http://www.blogger.com/atom/ns#' term='moog'/><title type='text'>Gooey</title><content type='html'>&lt;p&gt;And now a bit more explanation of what I'm doing with my Moog GUI. &lt;/p&gt;&lt;p&gt;There are a few different ways of creating GUIs and controlling synths in SuperCollider, for now I've gone with a simple approach using Pattern Proxies and the standard Slider class, but I might try something different as I add features. &lt;/p&gt;&lt;p&gt;Here's some of my GUI code again, &lt;/p&gt;&lt;p&gt;(&lt;br /&gt;var window = Window.new("Moog",Rect(400, 400, 140, 100)).front;&lt;br /&gt;var cutoffSlider, cutoffRef, resgainSlider;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;~cutoffRef = PatternProxy();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;cutoffSlider = Slider.new(window,Rect(10, 25, 100, 20));&lt;br /&gt; cutoffSlider.action_{&lt;br /&gt; var val;&lt;br /&gt; val = (10000*(cutoffSlider.value));&lt;br /&gt; val.postln;&lt;br /&gt; ~cutoffRef.source_(val);&lt;br /&gt;  };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;StaticText.new(window,Rect(10, 5, 100, 20))&lt;br /&gt; .string_("Cutoff")&lt;br /&gt; .action_{|v| };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;This is the bit that creates the window and the filter cutoff slider. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;The first thing I've done is create a window, the parameters passed to it are the title, the initial position it appears in on the screen and the size of the window itself. &lt;/p&gt;&lt;p&gt;Then I've created a Pattern Proxy, this is the thing that allows me to control my synth with both a GUI and a pattern.  &lt;/p&gt;&lt;p&gt;A Pattern Proxy is an object that can be placed in in a pattern and be changed whilst the pattern is playing. In this case I'm using a GUI to change the value of the Pattern Proxy as the pattern plays. I've set it as a global variable with a ~ so I can use it outside of the function it's created in. &lt;/p&gt;&lt;p&gt;I then create a slider that controls the value of the Pattern Proxy. It's instantiated with the name of the window it is to appear in and values setting it's size and position in the window. &lt;/p&gt;&lt;p&gt;The action_ method controls the action the slider performs when it's moved. In this case it takes the value of the slider object and multiplies it by 10000. Slider values move between 0 and 1, so to turn it into something usable by the synth I need to change the range. For simple linear values multiplying the output works fine, but for more complex stuff you can use a ControlSpec. &lt;/p&gt;&lt;p&gt;I then set the modified value to be the source of the Pattern Proxy, the object it takes it's values from. &lt;/p&gt;&lt;p&gt;After that there's a static text box, created in a similar way to the slider, as a label. &lt;/p&gt;&lt;p&gt;To actually make use of the Pattern Proxy, I need a pattern, so here it is again. &lt;/p&gt;&lt;p&gt;(&lt;br /&gt;Pmono("Moog",&lt;br /&gt; \freq, Pseq([440, 550, 660, 770, 660, 880], inf),&lt;br /&gt; \dur, 0.2,&lt;br /&gt; \oscType, Pseq([1,0,1,0,1], inf),&lt;br /&gt; \oscType2, Pseq([0,0,2,2,1], inf),&lt;br /&gt; \cutoff, (~cutoffRef),&lt;br /&gt; \gain, (~resgainRef)&lt;br /&gt;&lt;br /&gt;).play&lt;br /&gt;) &lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;All I've done is drop in the proxies as I would do with any other pattern streams. &lt;/p&gt;&lt;p&gt;This time I've used a Pmono, which creates only one instance of the synth on ther server and feeds it all the values in turn, instead of creating new ones with each note. This sounds a tad more like a an authentic Moog, plus I need to use a mono pattern with my new version of the synth that features portamento. &lt;/p&gt;&lt;p&gt;Shazam. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-2429301787810360511?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/2429301787810360511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/gooey.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/2429301787810360511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/2429301787810360511'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/gooey.html' title='Gooey'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-6858815151612580087</id><published>2009-02-23T17:27:00.000-08:00</published><updated>2009-02-27T11:35:00.661-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pmono'/><category scheme='http://www.blogger.com/atom/ns#' term='portamento'/><title type='text'>Portamento</title><content type='html'>&lt;p&gt;Before I do anymore GUI stuff a quick addition to my Moog synth itself, portamento!&lt;/p&gt;&lt;p&gt;Also known as slide or glissando, it's a nice feature of many analogue synths, here's the &lt;a href="http://en.wikipedia.org/wiki/Glissando"&gt;wiki page&lt;/a&gt; on it if you're not sure what I'm talking about. &lt;/p&gt;&lt;p&gt;I've been wanting to add this to my synth since I created it but I thought it might be difficult, but after putting my faith in the hand of providence and searching the &lt;a href="http://www.nabble.com/smoothing-parameter-changes-td19233288.html#a19233288"&gt;SuperCollider user mailing list&lt;/a&gt;, I found simple that portamento is in fact dead easy. &lt;/p&gt;&lt;p&gt;Here's my revised SynthDef &lt;/p&gt;&lt;p&gt;( &lt;br /&gt; SynthDef("Moog",{&lt;br /&gt;&lt;br /&gt;arg oscType =0, oscType2 = 1, pan = 0, level = 0.5, cutoff = 500, gain = 3.3, attack = 0.1, decay = 0.1, sust = 0.7, rel = 0.2, attackf = 0.1, decayf = 0.1, sustf = 0.9, relf = 0.2, gate = 1, freq =440, lagLev = 0.2;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;var oscArray = [Saw.ar(Lag.kr(freq, lagLev)), SinOsc.ar(Lag.kr(freq, lagLev)), Pulse.ar(Lag.kr(freq, lagLev))];&lt;br /&gt;var oscArray2 = [Saw.ar(Lag.kr(freq, lagLev)), SinOsc.ar(Lag.kr(freq, lagLev)), Pulse.ar(Lag.kr(freq, lagLev))];&lt;br /&gt;var ampEnv = EnvGen.ar(Env.adsr(attack, decay, sust, rel), gate, doneAction:2);&lt;br /&gt;var filterEnv = EnvGen.ar(Env.adsr(attackf, decayf, sustf, relf), gate, doneAction:2);&lt;br /&gt;var osc1 = Select.ar(oscType, oscArray);&lt;br /&gt;var osc2 = Select.ar(oscType2, oscArray2);&lt;br /&gt;var fade = Pan2.ar(XFade2.ar(osc1, osc2, pan , level * ampEnv, 0));&lt;br /&gt;var filter = MoogFF.ar(fade, cutoff * filterEnv, gain);&lt;br /&gt;Out.ar(0,filter)&lt;br /&gt;&lt;br /&gt;}).store&lt;br /&gt;)&lt;/p&gt;&lt;p&gt;All I've done here is encapsulated each of my frequency arguments for the oscillators in a lag Ugen. The slide time, or the time it takes for the pitch of each note to move from it's original value to the new note is set by the lagLev argument, in seconds.&lt;/p&gt;&lt;p&gt;To make this work you'll need to use a Pmono pattern, it won't work if a new synth is created with each note as it would be with a  Pbind pattern. &lt;/p&gt;&lt;p&gt;And that's Jazz. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-6858815151612580087?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/6858815151612580087/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/before-i-do-anymore-gui-stuff-quick.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/6858815151612580087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/6858815151612580087'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/before-i-do-anymore-gui-stuff-quick.html' title='Portamento'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-1171785081450742441</id><published>2009-02-22T16:32:00.000-08:00</published><updated>2009-02-22T17:00:39.595-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pmono'/><category scheme='http://www.blogger.com/atom/ns#' term='Gui'/><category scheme='http://www.blogger.com/atom/ns#' term='moog'/><title type='text'>A simple GUI</title><content type='html'>&lt;p&gt;&lt;/p&gt;&lt;p&gt;Controlling a synth with text isn't always intuitive, so I've decided to start working towards creating a GUI for my little Moogesque synth. &lt;/p&gt;&lt;p&gt;To begin with I've created a very simple interface with two sliders that allow me to control the filter cutoff frequency and the resonance gain. &lt;/p&gt;&lt;p&gt;Here's the Moog synthdef again. &lt;/p&gt;&lt;p&gt;( &lt;br /&gt; SynthDef("Moog",{&lt;br /&gt;&lt;br /&gt;arg oscType =0, oscType2 = 1, pan = 0, level = 0.5, cutoff = 500, gain = 3.3, attack = 0.1, decay = 0.1, sust = 0.7, rel = 0.2, attackf = 0.1, decayf = 0.1, sustf = 0.9, relf = 0.2, gate = 1, freq =440;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;var oscArray = [Saw.ar(freq ), SinOsc.ar(freq), Pulse.ar(freq)];&lt;br /&gt;var oscArray2 = [Saw.ar(freq), SinOsc.ar(freq), Pulse.ar(freq)];&lt;br /&gt;var ampEnv = EnvGen.ar(Env.adsr(attack, decay, sust, rel), gate, doneAction:2);&lt;br /&gt;var filterEnv = EnvGen.ar(Env.adsr(attackf, decayf, sustf, relf), gate, doneAction:2);&lt;br /&gt;var osc1 = Select.ar(oscType, oscArray);&lt;br /&gt;var osc2 = Select.ar(oscType2, oscArray2);&lt;br /&gt;var fade = Pan2.ar(XFade2.ar(osc1, osc2, pan , level * ampEnv, 0));&lt;br /&gt;var filter = MoogFF.ar(fade, cutoff * filterEnv, gain);&lt;br /&gt;Out.ar(0,filter)&lt;br /&gt;&lt;br /&gt;}).store&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I've added a panner to it to center the sound, but other than that it's the same for now. &lt;/p&gt;&lt;p&gt;This is my GUI code. &lt;/p&gt;&lt;p&gt;It should be cross platform but I've only tried it on OS X.  &lt;/p&gt;&lt;p&gt;(&lt;br /&gt;var window = Window.new("",Rect(400, 400, 140, 100)).front;&lt;br /&gt;var  cutoffSlider, cutoffRef, resgainSlider;&lt;br /&gt;&lt;br /&gt;~resgainRef = PatternProxy(3);&lt;br /&gt;~cutoffRef = PatternProxy(440);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;cutoffSlider = Slider.new(window,Rect(10, 25, 100, 20));&lt;br /&gt; cutoffSlider.action_{&lt;br /&gt; var val;&lt;br /&gt; val = (10000*(cutoffSlider.value));&lt;br /&gt; val.postln;&lt;br /&gt; ~cutoffRef.source_(val);&lt;br /&gt;  };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;StaticText.new(window,Rect(10, 5, 100, 20))&lt;br /&gt; .string_("Cutoff")&lt;br /&gt; .action_{|v| };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;resgainSlider = Slider.new(window,Rect(10, 65, 100, 20));&lt;br /&gt; resgainSlider.action_{&lt;br /&gt; var val;&lt;br /&gt; val = (4*(resgainSlider.value));&lt;br /&gt; val.postln;&lt;br /&gt; ~resgainRef.source_(val);&lt;br /&gt;  };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;StaticText.new(window,Rect(10, 45, 100, 20))&lt;br /&gt; .string_("Resonance Gain")&lt;br /&gt; .action_{|v| };&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;and here's a pattern incorporating the GUI elements I've created. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;(&lt;br /&gt;Pmono("Moog",&lt;br /&gt; \freq, Pseq([440, 550, 660, 770, 660, 880], inf),&lt;br /&gt; \dur, 0.2,&lt;br /&gt; \oscType, Pseq([1,0,1,0,1], inf),&lt;br /&gt; \oscType2, Pseq([0,0,2,2,1], inf),&lt;br /&gt; \cutoff, (~cutoffRef),&lt;br /&gt; \gain, (~resgainRef)&lt;br /&gt;&lt;br /&gt;).play&lt;br /&gt;) &lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;This time I've used a Pmono for a more authentic sound, but more on that later...&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-1171785081450742441?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/1171785081450742441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/simple-gui.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/1171785081450742441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/1171785081450742441'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/simple-gui.html' title='A simple GUI'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-3156205017049575304</id><published>2009-02-17T16:54:00.000-08:00</published><updated>2009-02-18T14:59:34.413-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Filter'/><category scheme='http://www.blogger.com/atom/ns#' term='drum machine'/><category scheme='http://www.blogger.com/atom/ns#' term='patterns'/><category scheme='http://www.blogger.com/atom/ns#' term='LPF'/><title type='text'>A Filter and Even More Drum Machine</title><content type='html'>&lt;p&gt;Pulled from the ever informative &lt;a href="http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml"&gt;SuperCollider Users Mailing List&lt;/a&gt; is this fine little example of an interesting low pass filter courtesy of nonprivate,  aka &lt;a href="http://cylob.blogspot.com/"&gt;DJ Cylob. &lt;/a&gt; &lt;/p&gt;&lt;p&gt;"&lt;/p&gt;&lt;p&gt;this is kind of nice,&lt;br /&gt;&lt;br /&gt;here's the normal sort of lpf:&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;{ &lt;br /&gt;var f;&lt;br /&gt;f = FSinOsc.kr(1, 0, 24, 84).midicps;&lt;br /&gt;RLPF.ar(Saw.ar(70,0.2), f, 0.3)&lt;br /&gt;}.play&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;but with this combo of lpf and mid eq, the bass disappears as the resonance increases, which is a bit more like a real filter.&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;{ &lt;br /&gt;var f;&lt;br /&gt;f = FSinOsc.kr(1, 0, 24, 84).midicps;&lt;br /&gt;&lt;br /&gt;MidEQ.ar(&lt;br /&gt; LPF.ar(Saw.ar(70,0.2), f), &lt;br /&gt; f, &lt;br /&gt;&lt;br /&gt; 0.5, 18, 0.6&lt;br /&gt;) &lt;br /&gt;&lt;br /&gt;}.play&lt;br /&gt;)&lt;br /&gt;"&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Inspired by this I decided to see if I could use it on my drum machine and at the same learn how to send the output of a pattern through an effect. &lt;/p&gt;&lt;p&gt;Here's the code I came up with, adapted from the Pbind help file which covers this very topic. &lt;/p&gt;&lt;p&gt;(&lt;br /&gt;SynthDef(\drums, {|out = 0, bassLevel = 0 , snareLevel = 0, hatLevel = 0, tomLevel = 0, pan1 = 0, pan2 = 0, pan3 = 0, pan4 = 0|&lt;br /&gt;&lt;br /&gt; var  env1, env2, env3, env4, bass, snare, hat, tom, bassOut, snareOut, hatOut, tomOut, mixer; &lt;br /&gt; env1 = EnvGen.kr(Env.perc(0.001, 0.2, 1, -4), 1, doneAction:2);&lt;br /&gt; env2 = EnvGen.kr(Env.perc(0.001, 0.5, 1, -1), 1, doneAction:2);&lt;br /&gt; env3 = EnvGen.kr(Env.perc(0.002, 0.3, 1, -2), 1, doneAction:2);&lt;br /&gt; env4 = EnvGen.kr(Env.perc(0.001, 0.1, 1, -5), 1, doneAction:2); &lt;br /&gt; bass = SinOsc.ar(80) + Crackle.ar(1, 0.5);&lt;br /&gt; bassOut = Pan2.ar(bass*env1, pan1, bassLevel);&lt;br /&gt; &lt;br /&gt; snare = SinOsc.ar(120) - WhiteNoise.ar(0.5, 0.5);&lt;br /&gt; snareOut = Pan2.ar(snare*env4, pan2, snareLevel); &lt;br /&gt; &lt;br /&gt; hat = Klank.ar(`[ [ 6563, 9875 ],&lt;br /&gt;      [ 0.6, 0.5 ],&lt;br /&gt;      [ 0.002, 0.003] ], PinkNoise.ar(1)); &lt;br /&gt; hatOut = Pan2.ar(hat*env3, pan2, hatLevel); &lt;br /&gt; &lt;br /&gt; tom =  SinOsc.ar(440); &lt;br /&gt; tomOut = Pan2.ar(tom*env4, pan4, tomLevel); &lt;br /&gt; &lt;br /&gt; mixer = Mix.new([bassOut, snareOut, hatOut, tomOut]); &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; Out.ar(out, mixer);&lt;br /&gt; &lt;br /&gt; }).store&lt;br /&gt; &lt;br /&gt; )&lt;br /&gt;        &lt;br /&gt; &lt;br /&gt;&lt;br /&gt; (&lt;br /&gt;     SynthDef("lpfandmideq", { arg out;   &lt;br /&gt; var audio, efx, f;&lt;br /&gt; f = SinOsc.kr(3, 0, 24, 84).midicps; &lt;br /&gt; audio = In.ar(20,2);&lt;br /&gt; efx=  MidEQ.ar(&lt;br /&gt; LPF.ar(audio, f), &lt;br /&gt; f, &lt;br /&gt;&lt;br /&gt; 0.5, 18, 0.6&lt;br /&gt;); &lt;br /&gt; &lt;br /&gt; Out.ar(out, efx);&lt;br /&gt;}).memStore;               &lt;br /&gt;          )&lt;br /&gt;      &lt;br /&gt;     (          &lt;br /&gt;     a = Synth.after(1, "lpfandmideq");     &lt;br /&gt;      )    &lt;br /&gt;          &lt;br /&gt;          &lt;br /&gt;          (&lt;br /&gt;               &lt;br /&gt;               &lt;br /&gt;  &lt;br /&gt;&lt;br /&gt; a = Pseq  ([1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]);&lt;br /&gt; b = Pseq  ([0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0]);&lt;br /&gt; c = Pseq  ([0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0]);&lt;br /&gt; d = Pseq  ([0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1]); &lt;br /&gt; e = Pwhite (0.14, 0.16, inf);&lt;br /&gt; &lt;br /&gt; p = Pbind(&lt;br /&gt;       \instrument, \drums,&lt;br /&gt;       \out, 20,&lt;br /&gt;       \dur, e,&lt;br /&gt;       \bassLevel,  Pseq ([a], inf), &lt;br /&gt;       \snareLevel, Pseq ([b], inf),&lt;br /&gt;       \hatLevel,   Pseq ([c], inf),       &lt;br /&gt;       \tomLevel,   Pseq ([d], inf)&lt;br /&gt;                             &lt;br /&gt;                       ).play;&lt;br /&gt;                       &lt;br /&gt;     &lt;br /&gt;            )   &lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt; To make this work you will need to make sure that you evaluate each section in brackets separately, apart from that it's pretty striaghtforward really.&lt;/p&gt;&lt;p&gt;In setting up the effect synth I needed to make sure that I set the input bus and the number of channels,  this needs two beacuse the drum machine is a two channel synth&lt;/p&gt;&lt;p&gt;audio = In.ar(20,2);&lt;/p&gt;&lt;p&gt;then create an instance of this synth&lt;/p&gt;&lt;p&gt;(          &lt;br /&gt;     a = Synth.after(1, "lpfandmideq");     &lt;br /&gt;      )    &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;and finally set the output of my pattern to the same bus that I set as the input of my effect. &lt;/p&gt;&lt;p&gt;      \out, 20,&lt;/p&gt;&lt;p&gt;and that's Jazz. &lt;/p&gt;&lt;p&gt;Surprisingly easy really and it doesn't sound too bad. &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-3156205017049575304?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/3156205017049575304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/filter-and-more-drum-machine.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3156205017049575304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3156205017049575304'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/filter-and-more-drum-machine.html' title='A Filter and Even More Drum Machine'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-1808283666626745559</id><published>2009-02-11T15:43:00.000-08:00</published><updated>2009-02-11T16:21:48.169-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='drum machine'/><category scheme='http://www.blogger.com/atom/ns#' term='patterns random'/><title type='text'>More drum machine</title><content type='html'>&lt;p&gt;I've been fiddling with my maliciously inept drum machine a bit more and using a couple of the enormous selection of pattern classes I've added some new features. &lt;/p&gt;&lt;p&gt;A lot of real drum machines both hardware and software have a 'swing' or 'shuffle' which add a bit of syncopation though I suspect most of them do it in a more sophisticated way than what I've done here.   &lt;/p&gt;&lt;p&gt;e = Pwhite (0.14, 0.16);&lt;/p&gt;&lt;p&gt; \dur, e,&lt;/p&gt;&lt;p&gt;I've used a Pwhite pattern to randomly select the \dur interval. &lt;/p&gt;&lt;p&gt;The Pwhite pattern randomly generates values from a range provided by the first two parameters and repeats this a number of times set by the third value entered, with inf being the default. Sticking this into my drum sequence means that the interval between each drum sound will be random, givning it a possibly more 'organic' feel. Or maybe just making it sound wonky. &lt;/p&gt;&lt;p&gt;I've seen some software synths that let the user generate random patterns, I've done something similar using a Pwrand. &lt;/p&gt;&lt;p&gt; f = Pwrand ([0, 1], [75, 25].normalizeSum, inf);&lt;/p&gt;&lt;p&gt; \bassLevel,  Pseq ([f], inf), &lt;/p&gt;&lt;p&gt; A Pwrand pattern generates random numbers from a list with a weighted probability. The above line generates a pattern with a 25% chance of each step having a drum sound  and a 75% chance of being silent. &lt;/p&gt;&lt;p&gt;Pwrand takes two arrays as arguments, the first one being the list of numbers to select randomly from, the second one being a list of probabilities, which should add up to one. Passing the second array a .normaliseSum message neatly side steps my poor mental arithmetic and automatically normalises the array elements to sum to one. Being able to weight the results makes the resulting pattern sound more rhythmic, without long silences or rolls that an unweighted probability would lead to.   &lt;/p&gt;&lt;p&gt;Here's the full pattern with these two bits added. &lt;/p&gt;&lt;p&gt; (&lt;br /&gt;&lt;br /&gt; a = Pseq  ([1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]);&lt;br /&gt; b = Pseq  ([0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0]);&lt;br /&gt; c = Pseq  ([0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0]);&lt;br /&gt; d = Pseq  ([0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1]); &lt;br /&gt; e = Pwhite (0.14, 0.16);&lt;br /&gt; f = Pwrand ([0, 1], [75, 25].normalizeSum, inf);&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; p = Pbind(&lt;br /&gt;       \instrument, \drums,&lt;br /&gt;       \dur, e,&lt;br /&gt;       \bassLevel,  Pseq ([f], inf), &lt;br /&gt;       \snareLevel, Pseq ([b], inf),&lt;br /&gt;       \hatLevel,   Pseq ([f], inf),       &lt;br /&gt;       \tomLevel,   Pseq ([d], inf)&lt;br /&gt;                             &lt;br /&gt;                       ).play;&lt;br /&gt;                       &lt;br /&gt;     &lt;br /&gt;            )&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-1808283666626745559?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/1808283666626745559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/more-drum-machine.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/1808283666626745559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/1808283666626745559'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/more-drum-machine.html' title='More drum machine'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-8350236873583566108</id><published>2009-02-10T15:53:00.000-08:00</published><updated>2009-02-10T17:03:15.910-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='patterns'/><category scheme='http://www.blogger.com/atom/ns#' term='drum machine.'/><category scheme='http://www.blogger.com/atom/ns#' term='drums'/><title type='text'>Simple Drum Machine</title><content type='html'>&lt;p&gt;After shamelessly flashing my Moog synth, I think it's time to reveal another SuperCollider creation. A very simple drum machine, made up of two parts. A SynthDef, defining my drums and a pattern template to play them. &lt;/p&gt;&lt;p&gt;Here's the SynthDef &lt;/p&gt;&lt;p&gt;(&lt;br /&gt;SynthDef(\drums, {|out = 0, bassLevel = 0 , snareLevel = 0, hatLevel = 0, tomLevel = 0, pan1 = 0, pan2 = 0, pan3 = 0, pan4 = 0|&lt;br /&gt;&lt;br /&gt; var  env1, env2, env3, env4, bass, snare, hat, tom, bassOut, snareOut, hatOut, tomOut, mixer; &lt;br /&gt; env1 = EnvGen.kr(Env.perc(0.001, 0.2, 1, -4), 1, doneAction:2);&lt;br /&gt; env2 = EnvGen.kr(Env.perc(0.001, 0.5, 1, -1), 1, doneAction:2);&lt;br /&gt; env3 = EnvGen.kr(Env.perc(0.002, 0.3, 1, -2), 1, doneAction:2);&lt;br /&gt; env4 = EnvGen.kr(Env.perc(0.001, 0.1, 1, -5), 1, doneAction:2); &lt;br /&gt; &lt;/p&gt;&lt;p&gt;bass = SinOsc.ar(80) + Crackle.ar(1, 0.5);&lt;br /&gt; bassOut = Pan2.ar(bass*env1, pan1, bassLevel);&lt;br /&gt; &lt;br /&gt; snare = SinOsc.ar(120) - WhiteNoise.ar(0.5, 0.5);&lt;br /&gt; snareOut = Pan2.ar(snare*env4, pan2, snareLevel); &lt;br /&gt; &lt;br /&gt; hat = Klank.ar(`[ [ 6563, 9875 ],&lt;br /&gt;      [ 0.6, 0.5 ],&lt;br /&gt;      [ 0.002, 0.003] ], PinkNoise.ar(1)); &lt;br /&gt; hatOut = Pan2.ar(hat*env3, pan2, hatLevel); &lt;br /&gt; &lt;br /&gt; tom =  SinOsc.ar(440); &lt;br /&gt; tomOut = Pan2.ar(tom*env4, pan4, tomLevel); &lt;br /&gt; &lt;br /&gt; mixer = Mix.new([bassOut, snareOut, hatOut, tomOut]); &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; Out.ar(out, mixer);&lt;br /&gt; &lt;br /&gt; }).store&lt;br /&gt; &lt;br /&gt; )&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I have four sound sources, four envelopes and four panners. &lt;/p&gt;&lt;p&gt;I have to admit that the drum sounds are a bit crappy and need some more work, they've got a certain Casio feel to them, and not in a good way, but they do the job. &lt;/p&gt;&lt;p&gt;After some experimentation I've discovered that pretty much anything sounds something like a drum if you put it through a percussive envelope, but so far the best results seem to come from some sort of noise source and/or a SinOsc. &lt;/p&gt;&lt;p&gt;The bass drum is a fairly low frequency sine with a bit of crackle added to it at a low level. &lt;/p&gt;&lt;p&gt;The snare is a sine with some white noise subtracted from it, I don't fully understand this yet, but subtracting a white noise source from the sine sounded better than adding it. &lt;/p&gt;&lt;p&gt;A wild guess lead me to the klank UGen in creating the hat( I think it might be a felt one)  and the tom is just a simple SinOsc. &lt;/p&gt;&lt;p&gt;All these sound sources are controlled with percussive envelopes, each with slightly varying attack and release times. &lt;/p&gt;&lt;p&gt;These are then passed to a two channel panner, which apart from allowing me to control the level of the sound also allows me to change the position of the sound between two channels. &lt;/p&gt;&lt;p&gt;       Here's the pattern I use to control it. &lt;br /&gt; &lt;/p&gt;&lt;p&gt;(&lt;br /&gt;               &lt;br /&gt;               &lt;br /&gt;  &lt;br /&gt;&lt;br /&gt; a = Pseq  ([1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]);&lt;br /&gt; b = Pseq  ([0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0]);&lt;br /&gt; c = Pseq  ([0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0]);&lt;br /&gt; d = Pseq  ([0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1]); &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; p = Pbind(&lt;br /&gt;       \instrument, \drums,&lt;br /&gt;       \dur, 0.12,&lt;br /&gt;       \bassLevel,  Pseq ([a], inf), &lt;br /&gt;       \snareLevel, Pseq ([b], inf),&lt;br /&gt;       \hatLevel,   Pseq ([c], inf),       &lt;br /&gt;       \tomLevel,   Pseq ([d], inf)&lt;br /&gt;                             &lt;br /&gt;                       ).play;&lt;br /&gt;                       &lt;br /&gt;     &lt;br /&gt;            )   &lt;br /&gt;&lt;br /&gt;The args passed to my SynthDef include levels for each of the drums. Sequencing these using a pattern seemed like the easiest way of triggering them. Each value of the pattern can be set at either 0 for no drum or &gt;0 to trigger a drum sound. This might not be the most efficient way of doing things but it does work. &lt;/p&gt;&lt;p&gt;I still don't understand exactly how it works, but the /dur argument sets the tempo, I think each event is timed as a fraction of the default clock setting of 1, but I could be wrong. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;You can do all kinds of great things with patterns, above I'm nesting them rather than defining them directly which will allow me to more easily create complex drum sequences. If I want to compose a song I can define more patterns and sequence them with the main pattern. &lt;/p&gt;&lt;p&gt;(&lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;  &lt;br /&gt;&lt;br /&gt; a = Pseq ([1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]);&lt;br /&gt; b = Pseq ([0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0]);&lt;br /&gt; c = Pseq ([0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0]);&lt;br /&gt; d = Pseq ([0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1]); &lt;br /&gt; e = Pseq ([0, 0,  1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1]);&lt;br /&gt; &lt;br /&gt; p = Pbind(&lt;br /&gt;  \instrument, \drums,&lt;br /&gt;  \dur, 0.12,&lt;br /&gt;  \bassLevel, Pseq ([a], inf), &lt;br /&gt;  \snareLevel, Pseq ([b, e], inf),&lt;br /&gt;  \hatLevel, Pseq ([c], inf),  &lt;br /&gt;  \tomLevel, Pseq ([d], inf)&lt;br /&gt;   &lt;br /&gt;  ).play;&lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;  )  &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Like that. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-8350236873583566108?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/8350236873583566108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/simple-drum-machine.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8350236873583566108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/8350236873583566108'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/simple-drum-machine.html' title='Simple Drum Machine'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-3859645336809861857</id><published>2009-02-09T15:18:00.000-08:00</published><updated>2009-02-22T16:53:24.622-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Envelopes'/><category scheme='http://www.blogger.com/atom/ns#' term='Synthdef'/><category scheme='http://www.blogger.com/atom/ns#' term='moog'/><title type='text'>Moooog</title><content type='html'>&lt;p&gt;Last post I showed of my wonderfully entertaining Moog style synth. This time I'm going to go into some of it in  more detail. &lt;/p&gt;&lt;p&gt;Envelopes have troubled me for a while and mental images of stationary have not helped me understand what they do.  After much study I have learned they are in fact structures that control a particular aspect of a sound over time, usually the amplitude or volume, but also filters and effects. &lt;/p&gt;&lt;p&gt;I use two in this synth, one to control the amplitude of the oscillators and one to control the filter.    &lt;/p&gt;&lt;p&gt;(&lt;br /&gt;SynthDef("Moog",{&lt;br /&gt;&lt;br /&gt;arg oscType =0, oscType2 = 1, pan = 0, level = 0.5, cutoff = 500, gain = 3.3, attack = 0.1, decay = 0.1, sust = 0.7, rel = 0.2, attackf = 0.1, decayf = 0.1, sustf = 0.9, relf = 0.2, gate = 1, freq =440;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;var oscArray = [Saw.ar(freq ), SinOsc.ar(freq), Pulse.ar(freq)];&lt;br /&gt;var oscArray2 = [Saw.ar(freq), SinOsc.ar(freq), Pulse.ar(freq)];&lt;br /&gt;var ampEnv = EnvGen.ar(Env.adsr(attack, decay, sust, rel), gate, doneAction:2);&lt;br /&gt;var filterEnv = EnvGen.ar(Env.adsr(attackf, decayf, sustf, relf), gate, doneAction:2);&lt;br /&gt;var osc1 = Select.ar(oscType, oscArray);&lt;br /&gt;var osc2 = Select.ar(oscType2, oscArray2);&lt;br /&gt;var fade = XFade2.ar(osc1, osc2, pan , level * ampEnv);&lt;br /&gt;var filter = MoogFF.ar(fade, cutoff * filterEnv, gain);&lt;br /&gt;Out.ar(0,filter)&lt;br /&gt;&lt;br /&gt;}).store&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;This here is the SynthDef.  I've created two arrays of oscillators which are selected by the arg osc type being passed to the Select ugen. &lt;/p&gt;&lt;p&gt;The envelopes are created by these two lines, &lt;/p&gt;&lt;p&gt;var ampEnv = EnvGen.ar(Env.adsr(attack, decay, sust, rel), gate, doneAction:2);&lt;br /&gt;var filterEnv = EnvGen.ar(Env.adsr(attackf, decayf, sustf, relf), gate, doneAction:2);&lt;/p&gt;&lt;p&gt;I create a new envelope generator object and pass it an adsr (attack, decay, sustain release) evelope specification. The variables attack, decay, sustain and release contain the time in seconds.&lt;/p&gt;&lt;p&gt;var fade = XFade2.ar(osc1, osc2, pan , level * ampEnv);&lt;br /&gt;var filter = MoogFF.ar(fade, cutoff * filterEnv, gain);&lt;/p&gt;&lt;p&gt;Here I times the output of the evnvelopes by the level of the cross fade and the cuttoff frequency of the moog filter giving me a output which is changed over time by the envelope. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-3859645336809861857?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/3859645336809861857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/last-post-i-showed-of-my-wonderfully.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3859645336809861857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3859645336809861857'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/last-post-i-showed-of-my-wonderfully.html' title='Moooog'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2838171651796012966.post-3518814434056224559</id><published>2009-02-07T14:36:00.000-08:00</published><updated>2009-02-09T15:20:31.318-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Synthdef'/><category scheme='http://www.blogger.com/atom/ns#' term='moog'/><title type='text'>Moog Thing</title><content type='html'>This is a blog about &lt;a href="http://supercollider.sourceforge.net/"&gt;SuperCollider&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Whilst supercollider isn't my first language, I'm not a hugely experienced programmer, so this is going to be very much from a newbies perspective.&lt;br /&gt;&lt;br /&gt;Lets start at the beginning.&lt;br /&gt;&lt;br /&gt;This is the first real SuperCollider program that I managed to get working, very closely aided by my mate &lt;a href="http://www.mcld.co.uk/"&gt;Dan&lt;/a&gt; who is very good at Supercollider indeed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;SynthDef("Moog",{&lt;br /&gt;&lt;br /&gt;arg oscType =0, oscType2 = 1, pan = 0, level = 0.5, cutoff = 500, gain = 3.3, attack = 0.1, decay = 0.1, sust = 0.7, rel = 0.2, attackf = 0.1, decayf = 0.1, sustf = 0.9, relf = 0.2, gate = 1, freq =440;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;var oscArray = [Saw.ar(freq ), SinOsc.ar(freq), Pulse.ar(freq)];&lt;br /&gt;var oscArray2 = [Saw.ar(freq), SinOsc.ar(freq), Pulse.ar(freq)];&lt;br /&gt;var ampEnv = EnvGen.ar(Env.adsr(attack, decay, sust, rel), gate, doneAction:2);&lt;br /&gt;var filterEnv = EnvGen.ar(Env.adsr(attackf, decayf, sustf, relf), gate, doneAction:2);&lt;br /&gt;var osc1 = Select.ar(oscType, oscArray);&lt;br /&gt;var osc2 = Select.ar(oscType2, oscArray2);&lt;br /&gt;var fade = XFade2.ar(osc1, osc2, pan , level * ampEnv);&lt;br /&gt;var filter = MoogFF.ar(fade, cutoff * filterEnv, gain);&lt;br /&gt;Out.ar(0,filter)&lt;br /&gt;&lt;br /&gt;}).store&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;it's a synth. A simple Moog inspired thing, with two oscillators, which can be either saw, sin or square/pulse waves and a mixer to mix them. It's also got a filter and two envelopes, one controlling the filter and one controlling the amplitude.&lt;br /&gt;&lt;br /&gt;here's a pattern to play it with.&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;Pbind(&lt;br /&gt;\instrument, "Moog",&lt;br /&gt;\freq, Pseq([440, 550, 660, 770, 660, 330, 880], inf),&lt;br /&gt;\dur, Pseq([0.2, 0.4, 0.1, 0.2, 0.2], inf),&lt;br /&gt;\oscType, Pseq([0,0,0,0,0], inf),&lt;br /&gt;\oscType2, Pseq([0,0,2,2,1], inf),&lt;br /&gt;\cutoff, Pseq([100,599,1000,20,800], inf),&lt;br /&gt;\pan, Pseq([1], inf)&lt;br /&gt;&lt;br /&gt;).play&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I'll go into more details of it's workings later...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2838171651796012966-3518814434056224559?l=superdupercollider.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://superdupercollider.blogspot.com/feeds/3518814434056224559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/this-is-blog-about-supercollider.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3518814434056224559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2838171651796012966/posts/default/3518814434056224559'/><link rel='alternate' type='text/html' href='http://superdupercollider.blogspot.com/2009/02/this-is-blog-about-supercollider.html' title='Moog Thing'/><author><name>sharopolis</name><uri>http://www.blogger.com/profile/01798188176798542754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
