@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.
@@ -220,22 +220,29 @@ class MLNoiseSuppressor {
220
220
  return inputStream;
221
221
  }
222
222
  try {
223
- console.log('🎤 Setting up ML noise suppression pipeline...');
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 noise suppression pipeline connected with buffering');
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('✅ ML noise suppression applied');
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.51",
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",