Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Cavern_Class
name
code content
Synth3{ var mInput; var mSynth; var mWin; var filter1, filter2, filter_2a, length; *new { arg xx; ^super.new.init(xx); } init { arg xx; filter1 = 2000; filter2 = 2000; filter_2a =2000; length = 0.3; Server.default.waitForBoot({fork{ Server.default.sync; this.addSynthDef.value; { this.makeGui.value; }.defer; }}); } addSynthDef { SynthDef(\testz, { arg out = 0, amp = 1, bPassF = 2000, hPassF = 3000, pan = 0, decay = 0.06, filtF = 400, amp_z =1; var z = BPF.ar(BrownNoise.ar(0.8.dup), bPassF, 0.2, mul: amp); var z2 = HPF.ar(z, hPassF, 0.2, mul: amp); var env = EnvGen.kr(Env.perc(0.01, decay), doneAction: 2); Out.ar(out, Pan2.ar(LPF.ar(z, filtF), pan, env*amp_z)); }).add; SynthDef(\testz2, { arg out = 0, amp = 1, bPassF2 = 2000, hPassF = 3000, pan = 0, decay = 0.06, filtF2 = 400, amp_z =1; var z = BPF.ar(GrayNoise.ar(1.0.dup), bPassF2, 0.2, mul: amp); var z2 = HPF.ar(z, hPassF, 0.2, mul: amp); var env = EnvGen.kr(Env.perc(0.01, decay), doneAction: 2); Out.ar(out, Pan2.ar(LPF.ar(z2, filtF2), pan, env*amp_z)); }).add; Server.default.sync; } makeGui{ QtGUI.palette = QPalette.dark; // main window (for now) mWin = Window.new("Synther1", Rect( left:20, top:20, width: 300, height: 400 ),border: true); mWin.background = Color.blue(0.3,1); mWin.layout = HLayout( VLayout( StaticText().string_("Cavern_1"), Button() .states_([ ["OFF", Color.gray(0.2), Color.green(0.8)], ["ON", Color.gray(0.8), Color.grey(0.2)] ]) .mouseDownAction_({ arg state; state.value.postln; if (state.value == 0) { mSynth = ( Pbind( \instrument, Prand([\testz,\testz2],inf), \bPassf, Pwhite(100,12000, inf), \bPassF2, Pfunc{filter2}, \decay, Pfunc{length}, \hPassf, Pwhite(100,13000, inf), \pan, Pwhite(0.0, 1, inf), \filtF, Pfunc{filter1}, \filtF2, Pwhite(80, 20000, inf), \dur, Pwhite(0.01,0.3,inf); ).play;)} { mSynth.stop; } }) .minHeight_(70) .minWidth_(70), nil ), VLayout( StaticText().string_("Filter"), Slider2D() .x_(0.05) .y_(0.05) .action_({ arg slider; filter1 = slider.y.value.linexp(0,1,300,20000,nil); filter2 = slider.x.value.linexp(0,1,30,20000,nil); }), StaticText().string_("Grain Length"), Slider(nil,Rect(0,0,50,10)) .minHeight_(20) .thumbSize_(50) .action_({ arg slider2; length = slider2.value.linexp(0,1,0.06,0.5,nil); }) ), ); mWin.front; mWin.alwaysOnTop = true; mWin.onClose_({ mSynth.stop; }) } }
code description
Experimental class - ambient cavern sounds (no effects yet). Class format is used here - needs to be saved as .sc file in the extensions and run with "Synth3.new" from the IDE. The class template comes from "mapping and visualization".
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change