«first  …5 6 7 8 9 10 11 last»

Feedback Synths

2014-10-12 01:32:00 supercollider

clean-up: #47

Today I found some old code in my SuperCollider folder that I thought I'd clean up and publish.

Experiments in audio feedback.


SynthDef(\feedback1, {|freq= 400, amp= 0.1|
    var env= EnvGen.kr(Env.perc(1, 4), doneAction:2);
    var lin= LocalIn.ar(1);
    var src= SinOsc.ar(freq, lin*2pi, amp*env);
    Out.ar(0, Pan2.ar(src));
Synth(\feedback1, [\freq, 300])
Synth(\feedback1, [\freq, 300, \amp, 0.255])

SynthDef(\feedback2, {|freq= 400, amp= 0.1, fb= 2, del= 0.1|
    var env= EnvGen.kr(Env.perc(1, 4), doneAction:2);
    var lin= DelayN.ar(LocalIn.ar(1), 1, del);
    var src= SinOsc.ar(freq, lin*2pi*fb, amp)*env;
    Out.ar(0, Pan2.ar(src));
Synth(\feedback2, [\del, 0.5])
Synth(\feedback2, [\del, 0.01])
Synth(\feedback2, [\del, 0.01, \fb, 3])
Synth(\feedback2, [\freq, 300, \del, 0.1, \fb, 2.5])

SynthDef(\feedback3, {|freq= 400, amp= 0.1, fb= 2, del= 0.1, lfo= 1, rate= 2|
    var env= EnvGen.kr(Env.perc(1, 4), doneAction:2);
    var lin= DelayN.ar(LocalIn.ar(1), 1, del);
    var src= SinOsc.ar(freq+SinOsc.ar(rate, 0, lfo), lin*2pi*fb, amp)*env;
    Out.ar(0, Pan2.ar(src));
Synth(\feedback3, [\del, 0.5])
Synth(\feedback3, [\del, 0.01])
Synth(\feedback3, [\del, 0.01, \fb, 3])
Synth(\feedback3, [\del, 0.01, \fb, 2, \lfo, 15])
Synth(\feedback3, [\del, 0.01, \fb, 3, \lfo, 100, \freq, 100])
Synth(\feedback3, [\del, 0.02, \fb, 3, \lfo, 100, \freq, 100])
Synth(\feedback3, [\del, 0.5, \fb, 201, \lfo, 200, \freq, 200, \rate, 202])
Synth(\feedback3, [\del, 0.5, \fb, 1, \lfo, 200, \freq, 300, \rate, 0.01])

SynthDef(\feedback4, {|freq= 400, amp= 0.1, fb= 2, del= 0.1, lfo= 1, rate= 2, cutoff= 500|
    var env= EnvGen.kr(Env.perc(1, 4), doneAction:2);
    var lin= DelayN.ar(HPF.ar(LocalIn.ar(1), cutoff), 1, del);
    var src= SinOsc.ar(freq+SinOsc.ar(rate, 0, lfo), lin*2pi*fb, amp)*env;
    Out.ar(0, Pan2.ar(src));
Synth(\feedback4, [\del, 0.5])
Synth(\feedback4, [\del, 0.01, \cutoff, 100])
Synth(\feedback4, [\del, 0.01, \fb, 3, \cutoff, 100])
Synth(\feedback4, [\del, 0.01, \fb, 2, \lfo, 15, \cutoff, 100])
Synth(\feedback4, [\del, 0.01, \fb, 3, \lfo, 100, \freq, 100, \cutoff, 100])
Synth(\feedback4, [\del, 0.02, \fb, 3, \lfo, 100, \freq, 100, \cutoff, 100])
Synth(\feedback4, [\del, 0.5, \fb, 201, \lfo, 200, \freq, 200, \rate, 202, \cutoff, 100])
Synth(\feedback4, [\del, 0.5, \fb, 1, \lfo, 200, \freq, 300, \rate, 0.01, \cutoff, 100])

2nd Fluid Simulator in SuperCollider

2014-10-11 00:20:11 supercollider

clean-up: #46

Here's another SuperCollider port of msafluid by Memo Akten. It is very similar to the MSAFluidSolver2D I ported from Java, but this one is from the C++ version (openFrameworks ofxMSAFluid) and has more features and a GUI interface.

Unfortunately, it runs slower than the Java port.

Classes, help files and an example are attached as a zip archive below.

MSAFluidSolver screenshot


Tweets 0220-0225

2014-10-09 23:17:45 supercollider

clean-up: #45

Today I recorded and uploaded my latest six SuperCollider sctweets to my SoundCloud account. They were all recorded using SC 3.7a0 and Audacity for trimming, normalising, adding a quick fade out and exporting.

Recording short sound files of these one-liners help non-sc-users get an idea about what is going on and it's also good for archiving. They make it possible to, in the future when SC 3.7a0 is long gone, go back and listen to what the code did produce.


a=SinOsc;play{RecordBuf.ar(c=InFeedback.ar,b=Buffer.alloc(s,9e4));HPF.ar(a.ar(99,c*6)/9+TGrains.ar(2,a ar:3,b,c+3,2,12),9)}// #SuperCollider


a=SinOsc;play{tanh((c=InFeedback.ar(0,2))+HPF.ar(a.ar(b=1/[5,4],a.ar(a.ar(b*1.1,a.ar(b*2))+a.ar(b*1.4,c,5,4).ceil*99)),9))}// #SuperCollider


a=SinOscFB;play{((c=InFeedback.ar(0,2).lag(b=1/67))+DelayL.ar(HPF.ar(a.ar([99,98]*50.666*a.ar(c+b*b,c),c%2),50),b,b)).tanh}// #SuperCollider


a=LFSaw;play{Splay.ar(BPF.ar(a.ar(f=Duty.ar(a.ar(a.ar(c=3/d=(2..6)))*a.ar(d)/c,0,Dseq(ceil(a ar:d)+d*99,inf))+a.ar(c)),f))}// #SuperCollider


a=SinOsc;play{d=BufRd.ar(2,b=LocalBuf(c=2e5,2).clear,a.ar([2,3]*9)*c,0);BufWr.ar(a.ar(3/[2,3])/3,b,a.ar([99,145]).abs*c);d}// #SuperCollider


a=LFSaw;play{b=(1..8)*99;Splay.ar(CombN.ar(Blip.ar(b/2+a.kr(-8/b,1,99),b/4+a.kr(1/b,1,99))*SinOsc.ar(8/b,a.ar(99/b)))).sin}// #SuperCollider

Fluid Simulator in SuperCollider

2014-10-08 20:16:25 supercollider

clean-up: #44

This is a SuperCollider port of Memo Akten's Processing library MSAFluid. I looked at his MSAFluidSolver2D.java version 1.3.0 and rewrote it for SuperCollider. I also optimised it as much as I could but still it is slow and the framerate is very low. I blame the slow SuperCollider graphics. The fluid system itself should perform ok - it's just the drawing that doesn't live up to be useful.

The good news is that one doesn't need to use the fancy graphics. SuperCollider is anyway made for sound synthesis and the fluid simulator can run and particles can be mapped to sound without displaying anything.

Classes, help files and examples are attached as a zip archive below.


Failed Tweet

2014-10-07 23:36:57 supercollider

clean-up: #43

During today's clean-up-of-old-projects I got stuck shrinking an old piece of SuperCollider code down to under 140 characters (sctweet). The shortest I could get it down to was 165 characters. Still, I thought I'd post the results of my efforts here - both if someone has suggestions or if someone wants to study the process. It's the same code, just rewritten over and over to be shorter - using every trick I could think of.

Of course one could imagine other goals than briefness - better sounding or less CPU taxing are two (probably better and more) common goals when optimising code in this manner.

n=Pbind(\tempo,2.5,\freq,Pseq([Pseq([103.8],14),Pseq([82.4],14)],inf),\amp,Pseq([2,1,1,2,2,1,1]/2,inf),\dur, 0.5);Ptpar([0,n,5,Pmul(\dur,2,Pmul(\freq,2,n)),15,Pmul(\freq,3,n),30,Pmul(\freq,3.5,n),80,Pmul(\dur,3,Pmul(\freq,5.035, n)),140,Pmul(\dur,1,Pmul(\freq,8,n))]).play

n=Pbind(\tempo,2.5,f=\freq,Pseq([Pseq([103.8],14),Pseq([82.4],14)],inf),\amp,Pseq([2,1,1,2,2,1,1]/2,inf),d=\dur, 0.5);Ptpar([0,n,5,Pmul(d,2,Pmul(\freq,2,n)),15,Pmul(f,3,n),30,Pmul(f,3.5,n),80,Pmul(d,3,Pmul(f,5.035, n)),140,Pmul(d,1,Pmul(f,8,n))]).play

n=Pbind(\tempo,2.5,f=\freq,Pseq([Pseq([103.8],14),Pseq([82.4],14)],inf),\amp,Pseq([2,1,1,2,2,1,1]/2,inf),d=\dur, 0.5);Ptpar([0,n,5,Pmul(d,2,Pmul(f,2,n)),15,Pmul(f,3,n),30,Pmul(f,3.5,n),80,Pmul(d,3,Pmul(f,5.035, n)),140,Pmul(d,1,Pmul(f,8,n))]).play

n=Pbind(\tempo,2.5,f=\freq,Pseq([Pseq([103.8],14),Pseq([82.4],14)],inf),\amp,Pseq([2,1,1,2,2,1,1]/2,inf),d=\dur, 0.5);Ptpar([0,n,5,Pmul(d,2,Pmul(f,2,n)),15,Pmul(f,3,n),30,Pmul(f,3.5,n),80,Pmul(d,3,Pmul(f,5.035, n)),140,Pmul(f,8,n)]).play







TempoClock.tempo= 1 //need to reset default clock tempo





n={|x,y=1|Pbind(\freq,Pseq([104,82.5] stutter:14,99)*x,\amp,Pseq([2,1,1,2,2,1,1]/2,99),\dur,y/5)};Ptpar([0,n.(1),2,n.(2,2),6,n.(3),12,n.(3.5),32,n.(5.035,3),56,n.(8)]).play

n={|x,y=1|Pbind(\freq,Pseq([104,82.5] stutter:14,99)*x,\amp,Pseq([2,1,1,2,2,1,1]/2,99),\dur,y/5)};Ptpar([0,n.(1),2,n.(2,2),6,n.(3),12,n.(3.5),32,n.(5.04,3),56,n.(8)]).play

a=[0,1,1,2,2,2,6,3,1,12,3.5,1,32,5.04,3,56,8,1];{|i|Pbind(\lag,a[b=i*3],\freq,Pseq([104,82.5] stutter:14,99)*a[b+1],\amp,Pseq([2,1,1,2,2,1,1]/2,99),\dur,a[b+2]/5).play}!6

[0,1,1,2,2,2,6,3,1,12,3.5,1,32,5.04,3,56,8,1].clump(3).do{|x|Pbind(\freq,Pseq([104,82.5] stutter:14,99)*x[1],\amp,Pseq([2,1,1,2,2,1,1]/2,99),\dur,x[2]/5,\lag,x[0]).play}

Deleted Quarks

2014-10-04 20:34:29 supercollider

clean-up: #42

Started deleting my red quarks

It failed.


  • 141024: I did delete all my red quarks on the 4th of October (because of my 3rd October transition to green phase) but failed with the SVN commit. The error I got was Transmitting file data ...svn: E160028: Commit failed (details follow): svn: E160028: Directory '/redSys' is out of date. I saw it as a sign that they shouldn't go.
    But today I figured out that I had checked out the HTTP version and that I needed the https to be able to commit. So after the command... svn relocate https://svn.code.sf.net/p/quarks/code I can now commit changes to the quarks SVN repository again.


2014-10-03 11:53:12 supercollider

clean-up: #41

Yet another small piece of code I found in my SuperCollider extensions folder.

It's very basic and just generates a PWM signal (Pulse-Width Modulation). You could do the same thing quicker with the standard LFPulse, but sometimes it's good to roll your own just to see another approach.

Pwm {
    *ar {|freq= 100, width= 0.5|
        ^LFSaw.ar(freq)>(width* -2+1);
    *kr {|freq= 100, width= 0.5|
        ^LFSaw.kr(freq)>(width* -2+1);
//mouse controls pwm duty cycle
{Pwm.ar(300, MouseX.kr(0, 1))!2*0.2}.play
//simulating voltage
{Amplitude.ar(Pwm.ar(300, MouseX.kr(0, 1))).poll; DC.ar(0)}.play


2014-10-03 02:25:23 supercollider

clean-up: #40

Found an old extension to Wouter Snoei's nice MasterEQ class (it's in his wslib quark). My extension just takes the current setting and posts code that recreates that. It's handy for when you want to hardcode an equaliser into some piece of code and when you don't want to be dependent on wslib being installed.

Save as extMasterEQ.sc in your extensions folder.

//redFrik 120901
//post SynthDef code for current preset
//requires wslib from quarks

+MasterEQ {
    *manual {|strip= true|
        var params;
        if(eq.notNil, {
            params= eq[\frdb][0][[0, 2, 1]];
            if(params[2]!=0 or:{strip.not}, {
                "input= BLowShelf.ar(input, %, %, %);".format(*params).postln;
            params= eq[\frdb][1][[0, 2, 1]];
            if(params[2]!=0 or:{strip.not}, {
                "input= BPeakEQ.ar(input, %, %, %);".format(*params).postln;
            params= eq[\frdb][2][[0, 2, 1]];
            if(params[2]!=0 or:{strip.not}, {
                "input= BPeakEQ.ar(input, %, %, %);".format(*params).postln;
            params= eq[\frdb][3][[0, 2, 1]];
            if(params[2]!=0 or:{strip.not}, {
                "input= BPeakEQ.ar(input, %, %, %);".format(*params).postln;
            params= eq[\frdb][4][[0, 2, 1]];
            if(params[2]!=0 or:{strip.not}, {
                "input= BHiShelf.ar(input, %, %, %);".format(*params).postln;
        }, {
            "start MasterEQ first".warn;

MasterEQ.manual(false)  //keep zero gain poles

«first  …5 6 7 8 9 10 11 last»