@newgameplusinc/odyssey-audio-video-sdk-dev 1.0.51 â 1.0.52
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/MLNoiseSuppressor.js +22 -6
- package/dist/index.js +11 -3
- package/package.json +1 -1
|
@@ -220,22 +220,29 @@ class MLNoiseSuppressor {
|
|
|
220
220
|
return inputStream;
|
|
221
221
|
}
|
|
222
222
|
try {
|
|
223
|
-
console.log('đ¤ Setting up
|
|
223
|
+
console.log('đ¤ [ML] Setting up noise suppression pipeline...');
|
|
224
|
+
console.log('đ¤ [ML] Input stream tracks:', inputStream.getTracks().length);
|
|
224
225
|
// Create MediaStreamSource from input
|
|
225
226
|
const source = this.audioContext.createMediaStreamSource(inputStream);
|
|
227
|
+
console.log('đ¤ [ML] Created MediaStreamSource');
|
|
226
228
|
// Create destination for output
|
|
227
229
|
const destination = this.audioContext.createMediaStreamDestination();
|
|
230
|
+
console.log('đ¤ [ML] Created destination stream');
|
|
228
231
|
// Create ScriptProcessor for real-time processing
|
|
229
232
|
const bufferSize = 4096;
|
|
230
233
|
const processor = this.audioContext.createScriptProcessor(bufferSize, 1, 1);
|
|
234
|
+
console.log('đ¤ [ML] Created ScriptProcessor with buffer size:', bufferSize);
|
|
231
235
|
// Keep reference to prevent garbage collection
|
|
232
236
|
processor.keepAlive = true;
|
|
233
237
|
// Start background processing worker
|
|
234
238
|
this.startBackgroundProcessing();
|
|
239
|
+
console.log('đ¤ [ML] Background processing started');
|
|
240
|
+
let processedFrames = 0;
|
|
235
241
|
// Process audio with buffering strategy
|
|
236
242
|
processor.onaudioprocess = (event) => {
|
|
237
243
|
const inputBuffer = event.inputBuffer.getChannelData(0);
|
|
238
244
|
const outputBuffer = event.outputBuffer.getChannelData(0);
|
|
245
|
+
processedFrames++;
|
|
239
246
|
// Copy input buffer for processing
|
|
240
247
|
const bufferCopy = new Float32Array(inputBuffer);
|
|
241
248
|
this.processingQueue.push(bufferCopy);
|
|
@@ -247,20 +254,29 @@ class MLNoiseSuppressor {
|
|
|
247
254
|
if (this.outputQueue.length > 0) {
|
|
248
255
|
const processed = this.outputQueue.shift();
|
|
249
256
|
outputBuffer.set(processed);
|
|
257
|
+
// Log occasionally
|
|
258
|
+
if (processedFrames % 100 === 0) {
|
|
259
|
+
console.log(`đ¤ [ML] Processed ${processedFrames} frames, queue: ${this.processingQueue.length}/${this.outputQueue.length}`);
|
|
260
|
+
}
|
|
250
261
|
}
|
|
251
262
|
else {
|
|
252
263
|
// Pass through original audio if processing is behind
|
|
253
264
|
outputBuffer.set(inputBuffer);
|
|
265
|
+
// Log when behind
|
|
266
|
+
if (processedFrames % 100 === 0) {
|
|
267
|
+
console.log(`â ī¸ [ML] Processing behind, passing through (frame ${processedFrames})`);
|
|
268
|
+
}
|
|
254
269
|
}
|
|
255
270
|
};
|
|
256
271
|
// Connect: source -> processor -> destination
|
|
257
272
|
source.connect(processor);
|
|
258
273
|
processor.connect(destination);
|
|
259
|
-
console.log('â
ML
|
|
274
|
+
console.log('â
[ML] Pipeline connected: source -> processor -> destination');
|
|
275
|
+
console.log('â
[ML] Output stream tracks:', destination.stream.getTracks().length);
|
|
260
276
|
return destination.stream;
|
|
261
277
|
}
|
|
262
278
|
catch (error) {
|
|
263
|
-
console.error('â Failed to process MediaStream:', error);
|
|
279
|
+
console.error('â [ML] Failed to process MediaStream:', error);
|
|
264
280
|
return inputStream;
|
|
265
281
|
}
|
|
266
282
|
}
|
|
@@ -283,9 +299,6 @@ class MLNoiseSuppressor {
|
|
|
283
299
|
if (this.outputQueue.length > 5) {
|
|
284
300
|
this.outputQueue.shift();
|
|
285
301
|
}
|
|
286
|
-
this.isProcessing = false;
|
|
287
|
-
this.processingQueue = [];
|
|
288
|
-
this.outputQueue = [];
|
|
289
302
|
}
|
|
290
303
|
catch (error) {
|
|
291
304
|
// On error, pass through original
|
|
@@ -363,6 +376,9 @@ class MLNoiseSuppressor {
|
|
|
363
376
|
* Cleanup resources
|
|
364
377
|
*/
|
|
365
378
|
dispose() {
|
|
379
|
+
this.isProcessing = false;
|
|
380
|
+
this.processingQueue = [];
|
|
381
|
+
this.outputQueue = [];
|
|
366
382
|
if (this.model) {
|
|
367
383
|
this.model.dispose();
|
|
368
384
|
this.model = null;
|
package/dist/index.js
CHANGED
|
@@ -145,22 +145,30 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
145
145
|
return this.mlNoiseSuppressionEnabled && this.mlNoiseSuppressor !== null;
|
|
146
146
|
}
|
|
147
147
|
async produceTrack(track, appData) {
|
|
148
|
+
console.log(`đŦ [SDK] produceTrack called - kind: ${track.kind}, enabled: ${track.enabled}, readyState: ${track.readyState}`);
|
|
148
149
|
let processedTrack = track;
|
|
149
150
|
// Apply ML noise suppression to audio BEFORE sending to MediaSoup
|
|
150
151
|
if (track.kind === 'audio' && this.mlNoiseSuppressionEnabled && this.mlNoiseSuppressor) {
|
|
151
152
|
try {
|
|
152
|
-
console.log('đ¤ Applying ML noise suppression to audio...');
|
|
153
|
+
console.log('đ¤ [SDK] Applying ML noise suppression to audio...');
|
|
153
154
|
const inputStream = new MediaStream([track]);
|
|
155
|
+
console.log('đ¤ [SDK] Created input stream with track');
|
|
154
156
|
const cleanedStream = await this.mlNoiseSuppressor.processMediaStream(inputStream);
|
|
157
|
+
console.log('đ¤ [SDK] Got cleaned stream from ML');
|
|
155
158
|
processedTrack = cleanedStream.getAudioTracks()[0];
|
|
156
|
-
console.log(
|
|
159
|
+
console.log(`â
[SDK] ML noise suppression applied - processed track state: ${processedTrack.readyState}`);
|
|
157
160
|
}
|
|
158
161
|
catch (error) {
|
|
159
|
-
console.error('â ML noise suppression failed, using original track:', error);
|
|
162
|
+
console.error('â [SDK] ML noise suppression failed, using original track:', error);
|
|
160
163
|
processedTrack = track; // Fallback to original track
|
|
161
164
|
}
|
|
162
165
|
}
|
|
166
|
+
else {
|
|
167
|
+
console.log(`âšī¸ [SDK] Skipping ML - kind: ${track.kind}, ML enabled: ${this.mlNoiseSuppressionEnabled}`);
|
|
168
|
+
}
|
|
169
|
+
console.log(`đ¤ [SDK] Producing track to MediaSoup - kind: ${processedTrack.kind}, state: ${processedTrack.readyState}`);
|
|
163
170
|
const producer = await this.mediasoupManager.produce(processedTrack, appData);
|
|
171
|
+
console.log(`â
[SDK] Producer created - id: ${producer.id}, kind: ${producer.kind}`);
|
|
164
172
|
if (this.localParticipant) {
|
|
165
173
|
const isFirstProducer = this.localParticipant.producers.size === 0;
|
|
166
174
|
this.localParticipant.producers.set(producer.id, producer);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newgameplusinc/odyssey-audio-video-sdk-dev",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.52",
|
|
4
4
|
"description": "Odyssey Spatial Audio & Video SDK using MediaSoup for real-time communication with AI-powered noise suppression",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|