From dd71821d4a9a1917f580c3dd7ee570d3c307e641 Mon Sep 17 00:00:00 2001 From: James Baicoianu Date: Tue, 14 Jul 2026 10:50:20 -0700 Subject: [PATCH] Add configurable panningmodel property to positional sounds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Positional sounds hard-coded panningModel = 'HRTF'. Expose it as a `panningmodel` property (default 'HRTF', so existing behavior is unchanged) and apply it both on creation and on live update, so an individual sound — e.g. a center/dialogue virtual speaker — can opt into 'equalpower' panning and avoid HRTF's presence-band coloration. Co-Authored-By: Claude Opus 4.8 (1M context) --- scripts/sound.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/sound.js b/scripts/sound.js index 89acc3f3..4e0199f3 100644 --- a/scripts/sound.js +++ b/scripts/sound.js @@ -16,6 +16,7 @@ elation.require(['janusweb.janusbase'], function() { gain: { type: 'float', default: 1.0, set: this.updateSound }, starttime: { type: 'float', default: 0.0, set: this.updateSound }, distancemodel: { type: 'string', default: 'inverse', set: this.updateSound }, + panningmodel: { type: 'string', default: 'HRTF', set: this.updateSound }, rolloff: { type: 'float', default: 1.0, set: this.updateSound }, rect: { type: 'string', set: this.updateSound }, stream: { type: 'boolean', default: false} @@ -69,7 +70,7 @@ elation.require(['janusweb.janusbase'], function() { } else { //this.audio.panner.distanceModel = 'linear'; } - this.audio.panner.panningModel = 'HRTF'; + this.audio.panner.panningModel = this.properties.panningmodel || 'HRTF'; } if (audionodes.gain) { // Route object's audio through the room's gain element @@ -194,6 +195,7 @@ elation.require(['janusweb.janusbase'], function() { this.audio.setRolloffFactor(this.rolloff); this.audio.setRefDistance(this.dist); this.audio.setDistanceModel(this.distancemodel); + this.audio.panner.panningModel = this.panningmodel || 'HRTF'; } } if (this.rect) {