home/ atoms/ sc-spatialization-distance-model

Multichannel reverb mix modulated by source-to-speaker distance models sound spatialization in SuperCollider

Chapter 14 shows a pragmatic distance-based spatialisation model: six reverb sends are mixed with wet amount proportional to the distance from the virtual source position to each speaker. Nearby speakers get less reverb (dry) while far speakers get more (wet), simulating acoustic distance. The source moves through a 2D plane; Point.dist() computes Euclidean distance. This is a simple alternative to VBAP or ambisonics — it works well for room-scale installations with discrete speaker arrays.

Examples

~updateLocation = { |newpos| ~src = newpos; y.do { |reverb, i| reverb.set(\mix, ~spec.unmap(~src.dist(~speakers.at(i)))) } }; ~updateLocation.value(Point.new(1, 0.5));

Assessment

Implement the 6-speaker distance model and move the source along a circular path. Describe the perceptual effect when the source passes directly in front of one speaker. Extend to 3D by adding height.

“// the mix gets more wet, the further the source is from the speaker: it.set( \mix, ~spec.unmap( ~src.dist( ~speakers.at(i) ) ).postln );”
corpus · the-supercollider-book-official-code-examples-scbookcode-gpl · chunk 47