@newgameplusinc/odyssey-audio-video-sdk-dev 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SpatialAudioManager.js +19 -2
- package/dist/index.js +13 -0
- package/package.json +1 -1
|
@@ -65,6 +65,16 @@ class SpatialAudioManager extends EventManager_1.EventManager {
|
|
|
65
65
|
const panner = this.audioContext.createPanner();
|
|
66
66
|
const analyser = this.audioContext.createAnalyser();
|
|
67
67
|
const gain = this.audioContext.createGain();
|
|
68
|
+
// Create BiquadFilter nodes for static/noise reduction
|
|
69
|
+
// Based on: https://tagdiwalaviral.medium.com/struggles-of-noise-reduction-in-rtc-part-2-2526f8179442
|
|
70
|
+
const highpassFilter = this.audioContext.createBiquadFilter();
|
|
71
|
+
highpassFilter.type = "highpass";
|
|
72
|
+
highpassFilter.frequency.value = 85; // Conservative value to preserve male voice depth
|
|
73
|
+
highpassFilter.Q.value = 1.0; // Quality factor
|
|
74
|
+
const lowpassFilter = this.audioContext.createBiquadFilter();
|
|
75
|
+
lowpassFilter.type = "lowpass";
|
|
76
|
+
lowpassFilter.frequency.value = 7500; // Below 8kHz to avoid flat/muffled sound
|
|
77
|
+
lowpassFilter.Q.value = 1.0; // Quality factor
|
|
68
78
|
// Configure Panner for realistic 3D spatial audio
|
|
69
79
|
panner.panningModel = "HRTF"; // Head-Related Transfer Function for realistic 3D
|
|
70
80
|
panner.distanceModel = "inverse"; // Natural distance falloff
|
|
@@ -78,12 +88,17 @@ class SpatialAudioManager extends EventManager_1.EventManager {
|
|
|
78
88
|
gain.gain.value = 1.0;
|
|
79
89
|
if (bypassSpatialization) {
|
|
80
90
|
console.log(`🔊 TESTING: Connecting audio directly to destination (bypassing spatial audio) for ${participantId}`);
|
|
81
|
-
source.connect(
|
|
91
|
+
source.connect(highpassFilter);
|
|
92
|
+
highpassFilter.connect(lowpassFilter);
|
|
93
|
+
lowpassFilter.connect(analyser);
|
|
82
94
|
analyser.connect(this.masterGainNode);
|
|
83
95
|
}
|
|
84
96
|
else {
|
|
85
97
|
// Standard spatialized path with full audio chain
|
|
86
|
-
source
|
|
98
|
+
// Audio Chain: source -> filters -> panner -> analyser -> gain -> masterGain -> compressor -> destination
|
|
99
|
+
source.connect(highpassFilter);
|
|
100
|
+
highpassFilter.connect(lowpassFilter);
|
|
101
|
+
lowpassFilter.connect(panner);
|
|
87
102
|
panner.connect(analyser);
|
|
88
103
|
analyser.connect(gain);
|
|
89
104
|
gain.connect(this.masterGainNode);
|
|
@@ -93,6 +108,8 @@ class SpatialAudioManager extends EventManager_1.EventManager {
|
|
|
93
108
|
panner,
|
|
94
109
|
analyser,
|
|
95
110
|
gain,
|
|
111
|
+
highpassFilter,
|
|
112
|
+
lowpassFilter,
|
|
96
113
|
stream,
|
|
97
114
|
});
|
|
98
115
|
console.log(`🎧 Spatial audio setup complete for ${participantId}:`, {
|
package/dist/index.js
CHANGED
|
@@ -125,7 +125,20 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
125
125
|
return this.spatialAudioManager.getAudioContextState();
|
|
126
126
|
}
|
|
127
127
|
async produceTrack(track) {
|
|
128
|
+
console.log("🎤 SDK: produceTrack called:", {
|
|
129
|
+
kind: track.kind,
|
|
130
|
+
trackId: track.id,
|
|
131
|
+
enabled: track.enabled,
|
|
132
|
+
muted: track.muted,
|
|
133
|
+
readyState: track.readyState,
|
|
134
|
+
localParticipantId: this.localParticipant?.participantId
|
|
135
|
+
});
|
|
128
136
|
const producer = await this.mediasoupManager.produce(track);
|
|
137
|
+
console.log("✅ SDK: Producer created:", {
|
|
138
|
+
producerId: producer.id,
|
|
139
|
+
kind: track.kind,
|
|
140
|
+
localParticipantId: this.localParticipant?.participantId
|
|
141
|
+
});
|
|
129
142
|
if (this.localParticipant) {
|
|
130
143
|
const isFirstProducer = this.localParticipant.producers.size === 0;
|
|
131
144
|
this.localParticipant.producers.set(producer.id, producer);
|
package/package.json
CHANGED