Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Wave Field Synthesis
name
code content
/* The basic principles of WFS are very simple: 1 - calculate distance from virtual source to each speaker. 2 - calculate time that sound takes to travel that distance t = d/340. 3 - calculate amplitude decay due to that distance a = 1/d 4 - delay sound by the delay time and multiply by amplitude. */ // your speaker positions p = 112.collect{ |i| Point(i.linlin(0,111,-10.0,10.0), 5) }; // now go, buy 112 speakers and play this synthdef :-) ( SynthDef(\minimalWFS,{ var excitation = Dust.ar(20) * 0.2; var in = Klank.ar(`[20.collect{ exprand(100,3000) }], excitation); var x = MouseX.kr(-20,20); var y = MouseY.kr(-30,5); //this is in meters. var max = 2 ** ( (3 * 44100).log2.roundUp(1).max(0) ); var buf = LocalBuf(max,1).clear; var dists = p.collect{ |point| Point(x,y).dist(point) }; var delayTimes = dists / 340; var amps = dists.collect{ |d| d.reciprocal.min(1.0) }; var delays = BufDelayL.ar(buf, in, delayTimes); Out.ar(0, delays * amps ) }).play )
code description
A simple synthdef for Wave Field Synthesis rendering.
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