@newgameplusinc/odyssey-audio-video-sdk-dev 1.0.24 → 1.0.25

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/README.md CHANGED
@@ -91,16 +91,16 @@ These layers run entirely in Web Audio, so you can ship “AirPods-style” back
91
91
  ```ts
92
92
  const sdk = new OdysseySpatialComms(serverUrl, {
93
93
  denoiser: {
94
- threshold: 0.0085,
95
- maxReduction: 0.9,
96
- hissCut: 0.55,
97
- holdMs: 230,
94
+ threshold: 0.008,
95
+ maxReduction: 0.88,
96
+ hissCut: 0.52,
97
+ holdMs: 260,
98
98
  voiceBoost: 0.65,
99
99
  voiceSensitivity: 0.33,
100
100
  voiceEnhancement: true,
101
- silenceFloor: 0.0008,
102
- silenceHoldMs: 480,
103
- silenceReleaseMs: 180,
101
+ silenceFloor: 0.00075,
102
+ silenceHoldMs: 520,
103
+ silenceReleaseMs: 160,
104
104
  },
105
105
  });
106
106
  ```
@@ -605,6 +605,7 @@ class SpatialAudioManager extends EventManager_1.EventManager {
605
605
  this.voiceEnhancement = cfg.voiceEnhancement === true;
606
606
  this.silenceFloor = this._sanitize(cfg.silenceFloor, 0.0002, 0.02, 0.00085);
607
607
  this.gateGraceSamples = Math.round(sampleRate * 0.45);
608
+ this.postSpeechHoldSamples = Math.round(sampleRate * 0.35);
608
609
  this.silenceHoldSamples = Math.max(
609
610
  8,
610
611
  Math.round(
@@ -647,6 +648,7 @@ class SpatialAudioManager extends EventManager_1.EventManager {
647
648
  isSilenced: false,
648
649
  muteGain: 1,
649
650
  graceSamplesRemaining: this.gateGraceSamples,
651
+ postSpeechHold: 0,
650
652
  };
651
653
  }
652
654
  return this.channelState[index];
@@ -743,6 +745,13 @@ class SpatialAudioManager extends EventManager_1.EventManager {
743
745
 
744
746
  state.envelope += (magnitude - state.envelope) * this.attack;
745
747
 
748
+ if (speechPresence > 0.12 || state.envelope > this.threshold * 1.1) {
749
+ state.graceSamplesRemaining = this.gateGraceSamples;
750
+ state.postSpeechHold = this.postSpeechHoldSamples;
751
+ } else if (state.postSpeechHold > 0) {
752
+ state.postSpeechHold--;
753
+ }
754
+
746
755
  if (state.envelope < this.threshold) {
747
756
  state.noise += (state.envelope - state.noise) * this.learnRate;
748
757
  state.quietSamples++;
@@ -750,14 +759,14 @@ class SpatialAudioManager extends EventManager_1.EventManager {
750
759
  state.quietSamples = 0;
751
760
  }
752
761
 
753
- if (state.graceSamplesRemaining > 0) {
762
+ if (state.graceSamplesRemaining > 0 || state.postSpeechHold > 0) {
754
763
  state.graceSamplesRemaining--;
755
764
  state.isSilenced = false;
756
765
  state.silenceSamples = 0;
757
766
  state.silenceReleaseCounter = 0;
758
767
  } else {
759
768
  const belowFloor = state.envelope < this.silenceFloor;
760
- if (belowFloor && speechPresence < 0.25) {
769
+ if (belowFloor && speechPresence < 0.15) {
761
770
  state.silenceSamples++;
762
771
  } else {
763
772
  state.silenceSamples = Math.max(0, state.silenceSamples - 3);
@@ -769,12 +778,14 @@ class SpatialAudioManager extends EventManager_1.EventManager {
769
778
  }
770
779
 
771
780
  if (state.isSilenced) {
772
- const wakeFromEnergy = state.envelope > this.silenceFloor * 1.25;
773
- const wakeFromVoice = speechPresence > 0.2;
781
+ const wakeFromEnergy = state.envelope > this.silenceFloor * 1.2;
782
+ const wakeFromVoice = speechPresence > 0.15;
774
783
  if (wakeFromEnergy || wakeFromVoice) {
775
784
  state.isSilenced = false;
776
785
  state.silenceSamples = 0;
777
786
  state.silenceReleaseCounter = 0;
787
+ state.postSpeechHold = this.postSpeechHoldSamples;
788
+ state.graceSamplesRemaining = this.gateGraceSamples;
778
789
  } else {
779
790
  state.silenceReleaseCounter++;
780
791
  if (state.silenceReleaseCounter > this.silenceReleaseSamples) {
@@ -817,8 +828,9 @@ class SpatialAudioManager extends EventManager_1.EventManager {
817
828
  const hissGain = 1 - hissRatio * (this.hissCut * (1 - 0.4 * speechPresence));
818
829
  processed = state.lpState + highComponent * hissGain;
819
830
 
820
- const muteTarget = state.isSilenced ? 0 : 1;
821
- state.muteGain += (muteTarget - state.muteGain) * 0.18;
831
+ const muteTarget = state.isSilenced ? 0.05 : 1;
832
+ const smoothing = state.isSilenced ? 0.12 : 0.42;
833
+ state.muteGain += (muteTarget - state.muteGain) * smoothing;
822
834
  processed *= state.muteGain;
823
835
 
824
836
  outChannel[i] = processed;
@@ -858,21 +870,21 @@ registerProcessor('odyssey-denoise', OdysseyDenoiseProcessor);
858
870
  };
859
871
  const denoiserDefaults = {
860
872
  enabled: true,
861
- threshold: 0.0085,
862
- noiseFloor: 0.0023,
863
- release: 0.24,
864
- attack: 0.34,
865
- holdMs: 230,
866
- maxReduction: 0.9,
867
- hissCut: 0.55,
868
- expansionRatio: 2.2,
869
- learnRate: 0.05,
873
+ threshold: 0.008,
874
+ noiseFloor: 0.002,
875
+ release: 0.22,
876
+ attack: 0.36,
877
+ holdMs: 260,
878
+ maxReduction: 0.88,
879
+ hissCut: 0.52,
880
+ expansionRatio: 2.15,
881
+ learnRate: 0.045,
870
882
  voiceBoost: 0.65,
871
883
  voiceSensitivity: 0.33,
872
884
  voiceEnhancement: false,
873
- silenceFloor: 0.0008,
874
- silenceHoldMs: 480,
875
- silenceReleaseMs: 180,
885
+ silenceFloor: 0.00075,
886
+ silenceHoldMs: 520,
887
+ silenceReleaseMs: 160,
876
888
  };
877
889
  return {
878
890
  distance: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newgameplusinc/odyssey-audio-video-sdk-dev",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "description": "Odyssey Spatial Audio & Video SDK using MediaSoup for real-time communication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",