Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: sonic focal depth
name
code content
/* sonic focal depth Ten layers of sound, all constantly running, yet only one is in "sharp focus" at any time. Move the mouse up and down to control the focal depth. by Dan Stowell 2012-05-14, after a chat w Simon Katan. You'll need the PV_MagSmooth ugen which is in sc3-plugins. */ s.boot ~nlayers = 10; ~basefreqs = ~nlayers.collect{|x| (x * 7 + 60).midicps}; ~fftbufs = ~nlayers.collect{ Buffer.alloc(s, 2048) }; ( x = { var layers, position, trig, ampenv, freqenv, layerpos, smoothfactor, ampfactor; position = MouseY.kr(0, 1); /* Create sounds - each layer must have spectral variation in it */ layers = ~basefreqs.collect{ |basefreq| trig = Dust.ar(10); ampenv = Decay2.ar(trig, 0.0001, 0.2); freqenv = Decay.ar(trig, 0.1).linexp(0,1,1,1.5); SinOsc.ar(freqenv * basefreq, 0, ampenv); }; /* Now apply focal effect - least smoothing (0) when the mouse is at the same "position" as a layer */ layers = layers.collect{|son, i| layerpos = i / (~nlayers - 1); // 0 to 1 smoothfactor = 1 - (layerpos - position).abs.linexp(0,1, 1, 0.0005); ampfactor = (layerpos - position).abs.linlin(0,1, 1, 0.9); IFFT(PV_MagSmooth(FFT(~fftbufs[i], son), smoothfactor)) * ampfactor * AmpCompA.ir(~basefreqs[i], ~basefreqs[3]) }; layers.mean.dup }.play; ) x.free
code description
Ten layers of sound, all constantly running, yet only one is in "sharp focus" at any time. Move the mouse up and down to control the focal depth. by Dan Stowell 2012-05-14, after a chat w Simon Katan. You'll need the PV_MagSmooth ugen which is in sc3-plugins.
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