@tensamin/audio 0.2.2 → 0.2.3

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.
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createAudioPipeline
3
- } from "./chunk-BAUJY4Q2.mjs";
3
+ } from "./chunk-Z5F2NBMQ.mjs";
4
4
  import {
5
5
  createRemoteAudioMonitor
6
- } from "./chunk-7IKKNKM7.mjs";
6
+ } from "./chunk-VBYRPG4G.mjs";
7
7
 
8
8
  // src/livekit/integration.ts
9
9
  async function attachSpeakingDetectionToTrack(track, options = {}) {
@@ -0,0 +1,38 @@
1
+ // src/defaults.ts
2
+ var DEFAULT_SPEAKING_DETECTION_CONFIG = {
3
+ minDb: -55,
4
+ maxDb: -20,
5
+ speakOnRatio: 0.5,
6
+ speakOffRatio: 0.3,
7
+ hangoverMs: 500,
8
+ attackMs: 100,
9
+ releaseMs: 120
10
+ };
11
+ var DEFAULT_NOISE_SUPPRESSION_CONFIG = {
12
+ enabled: true,
13
+ noiseReductionLevel: 60
14
+ };
15
+ var DEFAULT_OUTPUT_GAIN_CONFIG = {
16
+ speechGain: 1,
17
+ silenceGain: 0,
18
+ gainRampTime: 0.015,
19
+ maxGainDb: 6,
20
+ smoothTransitions: true
21
+ };
22
+ var DEFAULT_LIVEKIT_SPEAKING_OPTIONS = {
23
+ noiseSuppression: DEFAULT_NOISE_SUPPRESSION_CONFIG,
24
+ speaking: DEFAULT_SPEAKING_DETECTION_CONFIG,
25
+ output: DEFAULT_OUTPUT_GAIN_CONFIG,
26
+ muteWhenSilent: false
27
+ };
28
+ var DEFAULT_REMOTE_SPEAKING_OPTIONS = {
29
+ speaking: DEFAULT_SPEAKING_DETECTION_CONFIG
30
+ };
31
+
32
+ export {
33
+ DEFAULT_SPEAKING_DETECTION_CONFIG,
34
+ DEFAULT_NOISE_SUPPRESSION_CONFIG,
35
+ DEFAULT_OUTPUT_GAIN_CONFIG,
36
+ DEFAULT_LIVEKIT_SPEAKING_OPTIONS,
37
+ DEFAULT_REMOTE_SPEAKING_OPTIONS
38
+ };
@@ -1,14 +1,18 @@
1
+ import {
2
+ createLevelDetectorNode
3
+ } from "./chunk-QNQK6QFB.mjs";
1
4
  import {
2
5
  LevelBasedVAD
3
- } from "./chunk-AQ5RVY33.mjs";
6
+ } from "./chunk-YJCIZWND.mjs";
7
+ import {
8
+ DEFAULT_REMOTE_SPEAKING_OPTIONS,
9
+ DEFAULT_SPEAKING_DETECTION_CONFIG
10
+ } from "./chunk-RYODEXAU.mjs";
4
11
  import {
5
12
  getAudioContext,
6
13
  registerPipeline,
7
14
  unregisterPipeline
8
15
  } from "./chunk-OZ7KMC4S.mjs";
9
- import {
10
- createLevelDetectorNode
11
- } from "./chunk-QNQK6QFB.mjs";
12
16
 
13
17
  // src/pipeline/remote-audio-monitor.ts
14
18
  import mitt from "mitt";
@@ -17,13 +21,9 @@ async function createRemoteAudioMonitor(sourceTrack, config = {}) {
17
21
  registerPipeline();
18
22
  const fullConfig = {
19
23
  speaking: {
20
- minDb: config.speaking?.minDb ?? -55,
21
- maxDb: config.speaking?.maxDb ?? -20,
22
- speakOnRatio: config.speaking?.speakOnRatio ?? 0.5,
23
- speakOffRatio: config.speaking?.speakOffRatio ?? 0.3,
24
- hangoverMs: config.speaking?.hangoverMs ?? 500,
25
- attackMs: config.speaking?.attackMs ?? 100,
26
- releaseMs: config.speaking?.releaseMs ?? 120
24
+ ...DEFAULT_SPEAKING_DETECTION_CONFIG,
25
+ ...DEFAULT_REMOTE_SPEAKING_OPTIONS.speaking,
26
+ ...config.speaking
27
27
  }
28
28
  };
29
29
  if (!sourceTrack || sourceTrack.kind !== "audio") {
@@ -1,3 +1,7 @@
1
+ import {
2
+ DEFAULT_SPEAKING_DETECTION_CONFIG
3
+ } from "./chunk-RYODEXAU.mjs";
4
+
1
5
  // src/vad/vad-state.ts
2
6
  var LevelBasedVAD = class {
3
7
  config;
@@ -6,13 +10,13 @@ var LevelBasedVAD = class {
6
10
  pendingSilenceSince = null;
7
11
  constructor(config) {
8
12
  this.config = {
9
- minDb: config.minDb,
10
- maxDb: config.maxDb,
11
- speakOnRatio: config.speakOnRatio ?? 0.6,
12
- speakOffRatio: config.speakOffRatio ?? 0.3,
13
- hangoverMs: config.hangoverMs ?? 350,
14
- attackMs: config.attackMs ?? 50,
15
- releaseMs: config.releaseMs ?? 120
13
+ minDb: config.minDb ?? DEFAULT_SPEAKING_DETECTION_CONFIG.minDb,
14
+ maxDb: config.maxDb ?? DEFAULT_SPEAKING_DETECTION_CONFIG.maxDb,
15
+ speakOnRatio: config.speakOnRatio ?? DEFAULT_SPEAKING_DETECTION_CONFIG.speakOnRatio,
16
+ speakOffRatio: config.speakOffRatio ?? DEFAULT_SPEAKING_DETECTION_CONFIG.speakOffRatio,
17
+ hangoverMs: config.hangoverMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.hangoverMs,
18
+ attackMs: config.attackMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.attackMs,
19
+ releaseMs: config.releaseMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.releaseMs
16
20
  };
17
21
  }
18
22
  updateConfig(config) {
@@ -1,17 +1,23 @@
1
1
  import {
2
2
  createDeepFilterNet3Node
3
3
  } from "./chunk-IS37FHDN.mjs";
4
+ import {
5
+ createLevelDetectorNode
6
+ } from "./chunk-QNQK6QFB.mjs";
4
7
  import {
5
8
  LevelBasedVAD
6
- } from "./chunk-AQ5RVY33.mjs";
9
+ } from "./chunk-YJCIZWND.mjs";
10
+ import {
11
+ DEFAULT_LIVEKIT_SPEAKING_OPTIONS,
12
+ DEFAULT_NOISE_SUPPRESSION_CONFIG,
13
+ DEFAULT_OUTPUT_GAIN_CONFIG,
14
+ DEFAULT_SPEAKING_DETECTION_CONFIG
15
+ } from "./chunk-RYODEXAU.mjs";
7
16
  import {
8
17
  getAudioContext,
9
18
  registerPipeline,
10
19
  unregisterPipeline
11
20
  } from "./chunk-OZ7KMC4S.mjs";
12
- import {
13
- createLevelDetectorNode
14
- } from "./chunk-QNQK6QFB.mjs";
15
21
 
16
22
  // src/pipeline/audio-pipeline.ts
17
23
  import mitt from "mitt";
@@ -19,31 +25,22 @@ async function createAudioPipeline(sourceTrack, config = {}) {
19
25
  const context = getAudioContext();
20
26
  registerPipeline();
21
27
  const nsConfig = {
22
- enabled: config.noiseSuppression?.enabled ?? true,
23
- noiseReductionLevel: config.noiseSuppression?.noiseReductionLevel ?? 60
28
+ ...DEFAULT_NOISE_SUPPRESSION_CONFIG,
29
+ ...config.noiseSuppression
30
+ };
31
+ const speakingConfig = {
32
+ ...DEFAULT_SPEAKING_DETECTION_CONFIG,
33
+ ...config.speaking
34
+ };
35
+ const outputConfig = {
36
+ ...DEFAULT_OUTPUT_GAIN_CONFIG,
37
+ ...config.output
24
38
  };
25
- if (config.noiseSuppression?.assetConfig) {
26
- nsConfig.assetConfig = config.noiseSuppression.assetConfig;
27
- }
28
39
  const fullConfig = {
29
40
  noiseSuppression: nsConfig,
30
- speaking: {
31
- minDb: config.speaking?.minDb ?? -55,
32
- maxDb: config.speaking?.maxDb ?? -20,
33
- speakOnRatio: config.speaking?.speakOnRatio ?? 0.5,
34
- speakOffRatio: config.speaking?.speakOffRatio ?? 0.3,
35
- hangoverMs: config.speaking?.hangoverMs ?? 500,
36
- attackMs: config.speaking?.attackMs ?? 100,
37
- releaseMs: config.speaking?.releaseMs ?? 120
38
- },
39
- output: {
40
- speechGain: config.output?.speechGain ?? 1,
41
- silenceGain: config.output?.silenceGain ?? 0,
42
- gainRampTime: config.output?.gainRampTime ?? 0.015,
43
- maxGainDb: config.output?.maxGainDb ?? 6,
44
- smoothTransitions: config.output?.smoothTransitions ?? true
45
- },
46
- muteWhenSilent: config.muteWhenSilent ?? false
41
+ speaking: speakingConfig,
42
+ output: outputConfig,
43
+ muteWhenSilent: config.muteWhenSilent ?? DEFAULT_LIVEKIT_SPEAKING_OPTIONS.muteWhenSilent ?? false
47
44
  };
48
45
  if (!sourceTrack || sourceTrack.kind !== "audio") {
49
46
  throw new Error(
@@ -0,0 +1,10 @@
1
+ import { SpeakingDetectionConfig, NoiseSuppressionConfig, OutputGainConfig, LivekitSpeakingOptions, RemoteSpeakingOptions } from './types.mjs';
2
+ import 'mitt';
3
+
4
+ declare const DEFAULT_SPEAKING_DETECTION_CONFIG: Readonly<Required<SpeakingDetectionConfig>>;
5
+ declare const DEFAULT_NOISE_SUPPRESSION_CONFIG: Readonly<NoiseSuppressionConfig>;
6
+ declare const DEFAULT_OUTPUT_GAIN_CONFIG: Readonly<Required<OutputGainConfig>>;
7
+ declare const DEFAULT_LIVEKIT_SPEAKING_OPTIONS: Readonly<LivekitSpeakingOptions>;
8
+ declare const DEFAULT_REMOTE_SPEAKING_OPTIONS: Readonly<RemoteSpeakingOptions>;
9
+
10
+ export { DEFAULT_LIVEKIT_SPEAKING_OPTIONS, DEFAULT_NOISE_SUPPRESSION_CONFIG, DEFAULT_OUTPUT_GAIN_CONFIG, DEFAULT_REMOTE_SPEAKING_OPTIONS, DEFAULT_SPEAKING_DETECTION_CONFIG };
@@ -0,0 +1,10 @@
1
+ import { SpeakingDetectionConfig, NoiseSuppressionConfig, OutputGainConfig, LivekitSpeakingOptions, RemoteSpeakingOptions } from './types.js';
2
+ import 'mitt';
3
+
4
+ declare const DEFAULT_SPEAKING_DETECTION_CONFIG: Readonly<Required<SpeakingDetectionConfig>>;
5
+ declare const DEFAULT_NOISE_SUPPRESSION_CONFIG: Readonly<NoiseSuppressionConfig>;
6
+ declare const DEFAULT_OUTPUT_GAIN_CONFIG: Readonly<Required<OutputGainConfig>>;
7
+ declare const DEFAULT_LIVEKIT_SPEAKING_OPTIONS: Readonly<LivekitSpeakingOptions>;
8
+ declare const DEFAULT_REMOTE_SPEAKING_OPTIONS: Readonly<RemoteSpeakingOptions>;
9
+
10
+ export { DEFAULT_LIVEKIT_SPEAKING_OPTIONS, DEFAULT_NOISE_SUPPRESSION_CONFIG, DEFAULT_OUTPUT_GAIN_CONFIG, DEFAULT_REMOTE_SPEAKING_OPTIONS, DEFAULT_SPEAKING_DETECTION_CONFIG };
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/defaults.ts
21
+ var defaults_exports = {};
22
+ __export(defaults_exports, {
23
+ DEFAULT_LIVEKIT_SPEAKING_OPTIONS: () => DEFAULT_LIVEKIT_SPEAKING_OPTIONS,
24
+ DEFAULT_NOISE_SUPPRESSION_CONFIG: () => DEFAULT_NOISE_SUPPRESSION_CONFIG,
25
+ DEFAULT_OUTPUT_GAIN_CONFIG: () => DEFAULT_OUTPUT_GAIN_CONFIG,
26
+ DEFAULT_REMOTE_SPEAKING_OPTIONS: () => DEFAULT_REMOTE_SPEAKING_OPTIONS,
27
+ DEFAULT_SPEAKING_DETECTION_CONFIG: () => DEFAULT_SPEAKING_DETECTION_CONFIG
28
+ });
29
+ module.exports = __toCommonJS(defaults_exports);
30
+ var DEFAULT_SPEAKING_DETECTION_CONFIG = {
31
+ minDb: -55,
32
+ maxDb: -20,
33
+ speakOnRatio: 0.5,
34
+ speakOffRatio: 0.3,
35
+ hangoverMs: 500,
36
+ attackMs: 100,
37
+ releaseMs: 120
38
+ };
39
+ var DEFAULT_NOISE_SUPPRESSION_CONFIG = {
40
+ enabled: true,
41
+ noiseReductionLevel: 60
42
+ };
43
+ var DEFAULT_OUTPUT_GAIN_CONFIG = {
44
+ speechGain: 1,
45
+ silenceGain: 0,
46
+ gainRampTime: 0.015,
47
+ maxGainDb: 6,
48
+ smoothTransitions: true
49
+ };
50
+ var DEFAULT_LIVEKIT_SPEAKING_OPTIONS = {
51
+ noiseSuppression: DEFAULT_NOISE_SUPPRESSION_CONFIG,
52
+ speaking: DEFAULT_SPEAKING_DETECTION_CONFIG,
53
+ output: DEFAULT_OUTPUT_GAIN_CONFIG,
54
+ muteWhenSilent: false
55
+ };
56
+ var DEFAULT_REMOTE_SPEAKING_OPTIONS = {
57
+ speaking: DEFAULT_SPEAKING_DETECTION_CONFIG
58
+ };
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ DEFAULT_LIVEKIT_SPEAKING_OPTIONS,
62
+ DEFAULT_NOISE_SUPPRESSION_CONFIG,
63
+ DEFAULT_OUTPUT_GAIN_CONFIG,
64
+ DEFAULT_REMOTE_SPEAKING_OPTIONS,
65
+ DEFAULT_SPEAKING_DETECTION_CONFIG
66
+ });
@@ -0,0 +1,14 @@
1
+ import {
2
+ DEFAULT_LIVEKIT_SPEAKING_OPTIONS,
3
+ DEFAULT_NOISE_SUPPRESSION_CONFIG,
4
+ DEFAULT_OUTPUT_GAIN_CONFIG,
5
+ DEFAULT_REMOTE_SPEAKING_OPTIONS,
6
+ DEFAULT_SPEAKING_DETECTION_CONFIG
7
+ } from "./chunk-RYODEXAU.mjs";
8
+ export {
9
+ DEFAULT_LIVEKIT_SPEAKING_OPTIONS,
10
+ DEFAULT_NOISE_SUPPRESSION_CONFIG,
11
+ DEFAULT_OUTPUT_GAIN_CONFIG,
12
+ DEFAULT_REMOTE_SPEAKING_OPTIONS,
13
+ DEFAULT_SPEAKING_DETECTION_CONFIG
14
+ };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { AudioPipelineHandle, LivekitSpeakingOptions, NoiseSuppressionConfig, OutputGainConfig, RemoteSpeakingOptions, SpeakingController, SpeakingDetectionConfig, SpeakingEvents, SpeakingState } from './types.mjs';
2
+ export { DEFAULT_LIVEKIT_SPEAKING_OPTIONS, DEFAULT_NOISE_SUPPRESSION_CONFIG, DEFAULT_OUTPUT_GAIN_CONFIG, DEFAULT_REMOTE_SPEAKING_OPTIONS, DEFAULT_SPEAKING_DETECTION_CONFIG } from './defaults.mjs';
2
3
  export { attachSpeakingDetectionToRemoteTrack, attachSpeakingDetectionToTrack } from './livekit/integration.mjs';
3
4
  import 'mitt';
4
5
  import 'livekit-client';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { AudioPipelineHandle, LivekitSpeakingOptions, NoiseSuppressionConfig, OutputGainConfig, RemoteSpeakingOptions, SpeakingController, SpeakingDetectionConfig, SpeakingEvents, SpeakingState } from './types.js';
2
+ export { DEFAULT_LIVEKIT_SPEAKING_OPTIONS, DEFAULT_NOISE_SUPPRESSION_CONFIG, DEFAULT_OUTPUT_GAIN_CONFIG, DEFAULT_REMOTE_SPEAKING_OPTIONS, DEFAULT_SPEAKING_DETECTION_CONFIG } from './defaults.js';
2
3
  export { attachSpeakingDetectionToRemoteTrack, attachSpeakingDetectionToTrack } from './livekit/integration.js';
3
4
  import 'mitt';
4
5
  import 'livekit-client';
package/dist/index.js CHANGED
@@ -30,11 +30,47 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ DEFAULT_LIVEKIT_SPEAKING_OPTIONS: () => DEFAULT_LIVEKIT_SPEAKING_OPTIONS,
34
+ DEFAULT_NOISE_SUPPRESSION_CONFIG: () => DEFAULT_NOISE_SUPPRESSION_CONFIG,
35
+ DEFAULT_OUTPUT_GAIN_CONFIG: () => DEFAULT_OUTPUT_GAIN_CONFIG,
36
+ DEFAULT_REMOTE_SPEAKING_OPTIONS: () => DEFAULT_REMOTE_SPEAKING_OPTIONS,
37
+ DEFAULT_SPEAKING_DETECTION_CONFIG: () => DEFAULT_SPEAKING_DETECTION_CONFIG,
33
38
  attachSpeakingDetectionToRemoteTrack: () => attachSpeakingDetectionToRemoteTrack,
34
39
  attachSpeakingDetectionToTrack: () => attachSpeakingDetectionToTrack
35
40
  });
36
41
  module.exports = __toCommonJS(index_exports);
37
42
 
43
+ // src/defaults.ts
44
+ var DEFAULT_SPEAKING_DETECTION_CONFIG = {
45
+ minDb: -55,
46
+ maxDb: -20,
47
+ speakOnRatio: 0.5,
48
+ speakOffRatio: 0.3,
49
+ hangoverMs: 500,
50
+ attackMs: 100,
51
+ releaseMs: 120
52
+ };
53
+ var DEFAULT_NOISE_SUPPRESSION_CONFIG = {
54
+ enabled: true,
55
+ noiseReductionLevel: 60
56
+ };
57
+ var DEFAULT_OUTPUT_GAIN_CONFIG = {
58
+ speechGain: 1,
59
+ silenceGain: 0,
60
+ gainRampTime: 0.015,
61
+ maxGainDb: 6,
62
+ smoothTransitions: true
63
+ };
64
+ var DEFAULT_LIVEKIT_SPEAKING_OPTIONS = {
65
+ noiseSuppression: DEFAULT_NOISE_SUPPRESSION_CONFIG,
66
+ speaking: DEFAULT_SPEAKING_DETECTION_CONFIG,
67
+ output: DEFAULT_OUTPUT_GAIN_CONFIG,
68
+ muteWhenSilent: false
69
+ };
70
+ var DEFAULT_REMOTE_SPEAKING_OPTIONS = {
71
+ speaking: DEFAULT_SPEAKING_DETECTION_CONFIG
72
+ };
73
+
38
74
  // src/pipeline/audio-pipeline.ts
39
75
  var import_mitt = __toESM(require("mitt"));
40
76
 
@@ -165,13 +201,13 @@ var LevelBasedVAD = class {
165
201
  pendingSilenceSince = null;
166
202
  constructor(config) {
167
203
  this.config = {
168
- minDb: config.minDb,
169
- maxDb: config.maxDb,
170
- speakOnRatio: config.speakOnRatio ?? 0.6,
171
- speakOffRatio: config.speakOffRatio ?? 0.3,
172
- hangoverMs: config.hangoverMs ?? 350,
173
- attackMs: config.attackMs ?? 50,
174
- releaseMs: config.releaseMs ?? 120
204
+ minDb: config.minDb ?? DEFAULT_SPEAKING_DETECTION_CONFIG.minDb,
205
+ maxDb: config.maxDb ?? DEFAULT_SPEAKING_DETECTION_CONFIG.maxDb,
206
+ speakOnRatio: config.speakOnRatio ?? DEFAULT_SPEAKING_DETECTION_CONFIG.speakOnRatio,
207
+ speakOffRatio: config.speakOffRatio ?? DEFAULT_SPEAKING_DETECTION_CONFIG.speakOffRatio,
208
+ hangoverMs: config.hangoverMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.hangoverMs,
209
+ attackMs: config.attackMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.attackMs,
210
+ releaseMs: config.releaseMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.releaseMs
175
211
  };
176
212
  }
177
213
  updateConfig(config) {
@@ -233,31 +269,22 @@ async function createAudioPipeline(sourceTrack, config = {}) {
233
269
  const context = getAudioContext();
234
270
  registerPipeline();
235
271
  const nsConfig = {
236
- enabled: config.noiseSuppression?.enabled ?? true,
237
- noiseReductionLevel: config.noiseSuppression?.noiseReductionLevel ?? 60
272
+ ...DEFAULT_NOISE_SUPPRESSION_CONFIG,
273
+ ...config.noiseSuppression
274
+ };
275
+ const speakingConfig = {
276
+ ...DEFAULT_SPEAKING_DETECTION_CONFIG,
277
+ ...config.speaking
278
+ };
279
+ const outputConfig = {
280
+ ...DEFAULT_OUTPUT_GAIN_CONFIG,
281
+ ...config.output
238
282
  };
239
- if (config.noiseSuppression?.assetConfig) {
240
- nsConfig.assetConfig = config.noiseSuppression.assetConfig;
241
- }
242
283
  const fullConfig = {
243
284
  noiseSuppression: nsConfig,
244
- speaking: {
245
- minDb: config.speaking?.minDb ?? -55,
246
- maxDb: config.speaking?.maxDb ?? -20,
247
- speakOnRatio: config.speaking?.speakOnRatio ?? 0.5,
248
- speakOffRatio: config.speaking?.speakOffRatio ?? 0.3,
249
- hangoverMs: config.speaking?.hangoverMs ?? 500,
250
- attackMs: config.speaking?.attackMs ?? 100,
251
- releaseMs: config.speaking?.releaseMs ?? 120
252
- },
253
- output: {
254
- speechGain: config.output?.speechGain ?? 1,
255
- silenceGain: config.output?.silenceGain ?? 0,
256
- gainRampTime: config.output?.gainRampTime ?? 0.015,
257
- maxGainDb: config.output?.maxGainDb ?? 6,
258
- smoothTransitions: config.output?.smoothTransitions ?? true
259
- },
260
- muteWhenSilent: config.muteWhenSilent ?? false
285
+ speaking: speakingConfig,
286
+ output: outputConfig,
287
+ muteWhenSilent: config.muteWhenSilent ?? DEFAULT_LIVEKIT_SPEAKING_OPTIONS.muteWhenSilent ?? false
261
288
  };
262
289
  if (!sourceTrack || sourceTrack.kind !== "audio") {
263
290
  throw new Error(
@@ -394,13 +421,9 @@ async function createRemoteAudioMonitor(sourceTrack, config = {}) {
394
421
  registerPipeline();
395
422
  const fullConfig = {
396
423
  speaking: {
397
- minDb: config.speaking?.minDb ?? -55,
398
- maxDb: config.speaking?.maxDb ?? -20,
399
- speakOnRatio: config.speaking?.speakOnRatio ?? 0.5,
400
- speakOffRatio: config.speaking?.speakOffRatio ?? 0.3,
401
- hangoverMs: config.speaking?.hangoverMs ?? 500,
402
- attackMs: config.speaking?.attackMs ?? 100,
403
- releaseMs: config.speaking?.releaseMs ?? 120
424
+ ...DEFAULT_SPEAKING_DETECTION_CONFIG,
425
+ ...DEFAULT_REMOTE_SPEAKING_OPTIONS.speaking,
426
+ ...config.speaking
404
427
  }
405
428
  };
406
429
  if (!sourceTrack || sourceTrack.kind !== "audio") {
@@ -583,6 +606,11 @@ async function attachSpeakingDetectionToRemoteTrack(track, options = {}) {
583
606
  }
584
607
  // Annotate the CommonJS export names for ESM import in node:
585
608
  0 && (module.exports = {
609
+ DEFAULT_LIVEKIT_SPEAKING_OPTIONS,
610
+ DEFAULT_NOISE_SUPPRESSION_CONFIG,
611
+ DEFAULT_OUTPUT_GAIN_CONFIG,
612
+ DEFAULT_REMOTE_SPEAKING_OPTIONS,
613
+ DEFAULT_SPEAKING_DETECTION_CONFIG,
586
614
  attachSpeakingDetectionToRemoteTrack,
587
615
  attachSpeakingDetectionToTrack
588
616
  });
package/dist/index.mjs CHANGED
@@ -2,14 +2,26 @@ import "./chunk-WBQAMGXK.mjs";
2
2
  import {
3
3
  attachSpeakingDetectionToRemoteTrack,
4
4
  attachSpeakingDetectionToTrack
5
- } from "./chunk-YQPL2O7D.mjs";
6
- import "./chunk-BAUJY4Q2.mjs";
5
+ } from "./chunk-HN7ME2OF.mjs";
6
+ import "./chunk-Z5F2NBMQ.mjs";
7
7
  import "./chunk-IS37FHDN.mjs";
8
- import "./chunk-7IKKNKM7.mjs";
9
- import "./chunk-AQ5RVY33.mjs";
10
- import "./chunk-OZ7KMC4S.mjs";
8
+ import "./chunk-VBYRPG4G.mjs";
11
9
  import "./chunk-QNQK6QFB.mjs";
10
+ import "./chunk-YJCIZWND.mjs";
11
+ import {
12
+ DEFAULT_LIVEKIT_SPEAKING_OPTIONS,
13
+ DEFAULT_NOISE_SUPPRESSION_CONFIG,
14
+ DEFAULT_OUTPUT_GAIN_CONFIG,
15
+ DEFAULT_REMOTE_SPEAKING_OPTIONS,
16
+ DEFAULT_SPEAKING_DETECTION_CONFIG
17
+ } from "./chunk-RYODEXAU.mjs";
18
+ import "./chunk-OZ7KMC4S.mjs";
12
19
  export {
20
+ DEFAULT_LIVEKIT_SPEAKING_OPTIONS,
21
+ DEFAULT_NOISE_SUPPRESSION_CONFIG,
22
+ DEFAULT_OUTPUT_GAIN_CONFIG,
23
+ DEFAULT_REMOTE_SPEAKING_OPTIONS,
24
+ DEFAULT_SPEAKING_DETECTION_CONFIG,
13
25
  attachSpeakingDetectionToRemoteTrack,
14
26
  attachSpeakingDetectionToTrack
15
27
  };
@@ -1,5 +1,5 @@
1
- import { LivekitSpeakingOptions, SpeakingController, RemoteSpeakingOptions } from '../types.mjs';
2
1
  import { LocalAudioTrack, RemoteAudioTrack } from 'livekit-client';
2
+ import { LivekitSpeakingOptions, SpeakingController, RemoteSpeakingOptions } from '../types.mjs';
3
3
  import 'mitt';
4
4
 
5
5
  declare function attachSpeakingDetectionToTrack(track: LocalAudioTrack, options?: LivekitSpeakingOptions): Promise<SpeakingController>;
@@ -1,5 +1,5 @@
1
- import { LivekitSpeakingOptions, SpeakingController, RemoteSpeakingOptions } from '../types.js';
2
1
  import { LocalAudioTrack, RemoteAudioTrack } from 'livekit-client';
2
+ import { LivekitSpeakingOptions, SpeakingController, RemoteSpeakingOptions } from '../types.js';
3
3
  import 'mitt';
4
4
 
5
5
  declare function attachSpeakingDetectionToTrack(track: LocalAudioTrack, options?: LivekitSpeakingOptions): Promise<SpeakingController>;
@@ -157,6 +157,37 @@ async function createLevelDetectorNode(context, onLevel, options) {
157
157
  };
158
158
  }
159
159
 
160
+ // src/defaults.ts
161
+ var DEFAULT_SPEAKING_DETECTION_CONFIG = {
162
+ minDb: -55,
163
+ maxDb: -20,
164
+ speakOnRatio: 0.5,
165
+ speakOffRatio: 0.3,
166
+ hangoverMs: 500,
167
+ attackMs: 100,
168
+ releaseMs: 120
169
+ };
170
+ var DEFAULT_NOISE_SUPPRESSION_CONFIG = {
171
+ enabled: true,
172
+ noiseReductionLevel: 60
173
+ };
174
+ var DEFAULT_OUTPUT_GAIN_CONFIG = {
175
+ speechGain: 1,
176
+ silenceGain: 0,
177
+ gainRampTime: 0.015,
178
+ maxGainDb: 6,
179
+ smoothTransitions: true
180
+ };
181
+ var DEFAULT_LIVEKIT_SPEAKING_OPTIONS = {
182
+ noiseSuppression: DEFAULT_NOISE_SUPPRESSION_CONFIG,
183
+ speaking: DEFAULT_SPEAKING_DETECTION_CONFIG,
184
+ output: DEFAULT_OUTPUT_GAIN_CONFIG,
185
+ muteWhenSilent: false
186
+ };
187
+ var DEFAULT_REMOTE_SPEAKING_OPTIONS = {
188
+ speaking: DEFAULT_SPEAKING_DETECTION_CONFIG
189
+ };
190
+
160
191
  // src/vad/vad-state.ts
161
192
  var LevelBasedVAD = class {
162
193
  config;
@@ -165,13 +196,13 @@ var LevelBasedVAD = class {
165
196
  pendingSilenceSince = null;
166
197
  constructor(config) {
167
198
  this.config = {
168
- minDb: config.minDb,
169
- maxDb: config.maxDb,
170
- speakOnRatio: config.speakOnRatio ?? 0.6,
171
- speakOffRatio: config.speakOffRatio ?? 0.3,
172
- hangoverMs: config.hangoverMs ?? 350,
173
- attackMs: config.attackMs ?? 50,
174
- releaseMs: config.releaseMs ?? 120
199
+ minDb: config.minDb ?? DEFAULT_SPEAKING_DETECTION_CONFIG.minDb,
200
+ maxDb: config.maxDb ?? DEFAULT_SPEAKING_DETECTION_CONFIG.maxDb,
201
+ speakOnRatio: config.speakOnRatio ?? DEFAULT_SPEAKING_DETECTION_CONFIG.speakOnRatio,
202
+ speakOffRatio: config.speakOffRatio ?? DEFAULT_SPEAKING_DETECTION_CONFIG.speakOffRatio,
203
+ hangoverMs: config.hangoverMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.hangoverMs,
204
+ attackMs: config.attackMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.attackMs,
205
+ releaseMs: config.releaseMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.releaseMs
175
206
  };
176
207
  }
177
208
  updateConfig(config) {
@@ -233,31 +264,22 @@ async function createAudioPipeline(sourceTrack, config = {}) {
233
264
  const context = getAudioContext();
234
265
  registerPipeline();
235
266
  const nsConfig = {
236
- enabled: config.noiseSuppression?.enabled ?? true,
237
- noiseReductionLevel: config.noiseSuppression?.noiseReductionLevel ?? 60
267
+ ...DEFAULT_NOISE_SUPPRESSION_CONFIG,
268
+ ...config.noiseSuppression
269
+ };
270
+ const speakingConfig = {
271
+ ...DEFAULT_SPEAKING_DETECTION_CONFIG,
272
+ ...config.speaking
273
+ };
274
+ const outputConfig = {
275
+ ...DEFAULT_OUTPUT_GAIN_CONFIG,
276
+ ...config.output
238
277
  };
239
- if (config.noiseSuppression?.assetConfig) {
240
- nsConfig.assetConfig = config.noiseSuppression.assetConfig;
241
- }
242
278
  const fullConfig = {
243
279
  noiseSuppression: nsConfig,
244
- speaking: {
245
- minDb: config.speaking?.minDb ?? -55,
246
- maxDb: config.speaking?.maxDb ?? -20,
247
- speakOnRatio: config.speaking?.speakOnRatio ?? 0.5,
248
- speakOffRatio: config.speaking?.speakOffRatio ?? 0.3,
249
- hangoverMs: config.speaking?.hangoverMs ?? 500,
250
- attackMs: config.speaking?.attackMs ?? 100,
251
- releaseMs: config.speaking?.releaseMs ?? 120
252
- },
253
- output: {
254
- speechGain: config.output?.speechGain ?? 1,
255
- silenceGain: config.output?.silenceGain ?? 0,
256
- gainRampTime: config.output?.gainRampTime ?? 0.015,
257
- maxGainDb: config.output?.maxGainDb ?? 6,
258
- smoothTransitions: config.output?.smoothTransitions ?? true
259
- },
260
- muteWhenSilent: config.muteWhenSilent ?? false
280
+ speaking: speakingConfig,
281
+ output: outputConfig,
282
+ muteWhenSilent: config.muteWhenSilent ?? DEFAULT_LIVEKIT_SPEAKING_OPTIONS.muteWhenSilent ?? false
261
283
  };
262
284
  if (!sourceTrack || sourceTrack.kind !== "audio") {
263
285
  throw new Error(
@@ -394,13 +416,9 @@ async function createRemoteAudioMonitor(sourceTrack, config = {}) {
394
416
  registerPipeline();
395
417
  const fullConfig = {
396
418
  speaking: {
397
- minDb: config.speaking?.minDb ?? -55,
398
- maxDb: config.speaking?.maxDb ?? -20,
399
- speakOnRatio: config.speaking?.speakOnRatio ?? 0.5,
400
- speakOffRatio: config.speaking?.speakOffRatio ?? 0.3,
401
- hangoverMs: config.speaking?.hangoverMs ?? 500,
402
- attackMs: config.speaking?.attackMs ?? 100,
403
- releaseMs: config.speaking?.releaseMs ?? 120
419
+ ...DEFAULT_SPEAKING_DETECTION_CONFIG,
420
+ ...DEFAULT_REMOTE_SPEAKING_OPTIONS.speaking,
421
+ ...config.speaking
404
422
  }
405
423
  };
406
424
  if (!sourceTrack || sourceTrack.kind !== "audio") {
@@ -1,13 +1,14 @@
1
1
  import {
2
2
  attachSpeakingDetectionToRemoteTrack,
3
3
  attachSpeakingDetectionToTrack
4
- } from "../chunk-YQPL2O7D.mjs";
5
- import "../chunk-BAUJY4Q2.mjs";
4
+ } from "../chunk-HN7ME2OF.mjs";
5
+ import "../chunk-Z5F2NBMQ.mjs";
6
6
  import "../chunk-IS37FHDN.mjs";
7
- import "../chunk-7IKKNKM7.mjs";
8
- import "../chunk-AQ5RVY33.mjs";
9
- import "../chunk-OZ7KMC4S.mjs";
7
+ import "../chunk-VBYRPG4G.mjs";
10
8
  import "../chunk-QNQK6QFB.mjs";
9
+ import "../chunk-YJCIZWND.mjs";
10
+ import "../chunk-RYODEXAU.mjs";
11
+ import "../chunk-OZ7KMC4S.mjs";
11
12
  export {
12
13
  attachSpeakingDetectionToRemoteTrack,
13
14
  attachSpeakingDetectionToTrack
@@ -154,6 +154,34 @@ async function createLevelDetectorNode(context, onLevel, options) {
154
154
  };
155
155
  }
156
156
 
157
+ // src/defaults.ts
158
+ var DEFAULT_SPEAKING_DETECTION_CONFIG = {
159
+ minDb: -55,
160
+ maxDb: -20,
161
+ speakOnRatio: 0.5,
162
+ speakOffRatio: 0.3,
163
+ hangoverMs: 500,
164
+ attackMs: 100,
165
+ releaseMs: 120
166
+ };
167
+ var DEFAULT_NOISE_SUPPRESSION_CONFIG = {
168
+ enabled: true,
169
+ noiseReductionLevel: 60
170
+ };
171
+ var DEFAULT_OUTPUT_GAIN_CONFIG = {
172
+ speechGain: 1,
173
+ silenceGain: 0,
174
+ gainRampTime: 0.015,
175
+ maxGainDb: 6,
176
+ smoothTransitions: true
177
+ };
178
+ var DEFAULT_LIVEKIT_SPEAKING_OPTIONS = {
179
+ noiseSuppression: DEFAULT_NOISE_SUPPRESSION_CONFIG,
180
+ speaking: DEFAULT_SPEAKING_DETECTION_CONFIG,
181
+ output: DEFAULT_OUTPUT_GAIN_CONFIG,
182
+ muteWhenSilent: false
183
+ };
184
+
157
185
  // src/vad/vad-state.ts
158
186
  var LevelBasedVAD = class {
159
187
  config;
@@ -162,13 +190,13 @@ var LevelBasedVAD = class {
162
190
  pendingSilenceSince = null;
163
191
  constructor(config) {
164
192
  this.config = {
165
- minDb: config.minDb,
166
- maxDb: config.maxDb,
167
- speakOnRatio: config.speakOnRatio ?? 0.6,
168
- speakOffRatio: config.speakOffRatio ?? 0.3,
169
- hangoverMs: config.hangoverMs ?? 350,
170
- attackMs: config.attackMs ?? 50,
171
- releaseMs: config.releaseMs ?? 120
193
+ minDb: config.minDb ?? DEFAULT_SPEAKING_DETECTION_CONFIG.minDb,
194
+ maxDb: config.maxDb ?? DEFAULT_SPEAKING_DETECTION_CONFIG.maxDb,
195
+ speakOnRatio: config.speakOnRatio ?? DEFAULT_SPEAKING_DETECTION_CONFIG.speakOnRatio,
196
+ speakOffRatio: config.speakOffRatio ?? DEFAULT_SPEAKING_DETECTION_CONFIG.speakOffRatio,
197
+ hangoverMs: config.hangoverMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.hangoverMs,
198
+ attackMs: config.attackMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.attackMs,
199
+ releaseMs: config.releaseMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.releaseMs
172
200
  };
173
201
  }
174
202
  updateConfig(config) {
@@ -230,31 +258,22 @@ async function createAudioPipeline(sourceTrack, config = {}) {
230
258
  const context = getAudioContext();
231
259
  registerPipeline();
232
260
  const nsConfig = {
233
- enabled: config.noiseSuppression?.enabled ?? true,
234
- noiseReductionLevel: config.noiseSuppression?.noiseReductionLevel ?? 60
261
+ ...DEFAULT_NOISE_SUPPRESSION_CONFIG,
262
+ ...config.noiseSuppression
263
+ };
264
+ const speakingConfig = {
265
+ ...DEFAULT_SPEAKING_DETECTION_CONFIG,
266
+ ...config.speaking
267
+ };
268
+ const outputConfig = {
269
+ ...DEFAULT_OUTPUT_GAIN_CONFIG,
270
+ ...config.output
235
271
  };
236
- if (config.noiseSuppression?.assetConfig) {
237
- nsConfig.assetConfig = config.noiseSuppression.assetConfig;
238
- }
239
272
  const fullConfig = {
240
273
  noiseSuppression: nsConfig,
241
- speaking: {
242
- minDb: config.speaking?.minDb ?? -55,
243
- maxDb: config.speaking?.maxDb ?? -20,
244
- speakOnRatio: config.speaking?.speakOnRatio ?? 0.5,
245
- speakOffRatio: config.speaking?.speakOffRatio ?? 0.3,
246
- hangoverMs: config.speaking?.hangoverMs ?? 500,
247
- attackMs: config.speaking?.attackMs ?? 100,
248
- releaseMs: config.speaking?.releaseMs ?? 120
249
- },
250
- output: {
251
- speechGain: config.output?.speechGain ?? 1,
252
- silenceGain: config.output?.silenceGain ?? 0,
253
- gainRampTime: config.output?.gainRampTime ?? 0.015,
254
- maxGainDb: config.output?.maxGainDb ?? 6,
255
- smoothTransitions: config.output?.smoothTransitions ?? true
256
- },
257
- muteWhenSilent: config.muteWhenSilent ?? false
274
+ speaking: speakingConfig,
275
+ output: outputConfig,
276
+ muteWhenSilent: config.muteWhenSilent ?? DEFAULT_LIVEKIT_SPEAKING_OPTIONS.muteWhenSilent ?? false
258
277
  };
259
278
  if (!sourceTrack || sourceTrack.kind !== "audio") {
260
279
  throw new Error(
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  createAudioPipeline
3
- } from "../chunk-BAUJY4Q2.mjs";
3
+ } from "../chunk-Z5F2NBMQ.mjs";
4
4
  import "../chunk-IS37FHDN.mjs";
5
- import "../chunk-AQ5RVY33.mjs";
6
- import "../chunk-OZ7KMC4S.mjs";
7
5
  import "../chunk-QNQK6QFB.mjs";
6
+ import "../chunk-YJCIZWND.mjs";
7
+ import "../chunk-RYODEXAU.mjs";
8
+ import "../chunk-OZ7KMC4S.mjs";
8
9
  export {
9
10
  createAudioPipeline
10
11
  };
@@ -124,6 +124,20 @@ async function createLevelDetectorNode(context, onLevel, options) {
124
124
  };
125
125
  }
126
126
 
127
+ // src/defaults.ts
128
+ var DEFAULT_SPEAKING_DETECTION_CONFIG = {
129
+ minDb: -55,
130
+ maxDb: -20,
131
+ speakOnRatio: 0.5,
132
+ speakOffRatio: 0.3,
133
+ hangoverMs: 500,
134
+ attackMs: 100,
135
+ releaseMs: 120
136
+ };
137
+ var DEFAULT_REMOTE_SPEAKING_OPTIONS = {
138
+ speaking: DEFAULT_SPEAKING_DETECTION_CONFIG
139
+ };
140
+
127
141
  // src/vad/vad-state.ts
128
142
  var LevelBasedVAD = class {
129
143
  config;
@@ -132,13 +146,13 @@ var LevelBasedVAD = class {
132
146
  pendingSilenceSince = null;
133
147
  constructor(config) {
134
148
  this.config = {
135
- minDb: config.minDb,
136
- maxDb: config.maxDb,
137
- speakOnRatio: config.speakOnRatio ?? 0.6,
138
- speakOffRatio: config.speakOffRatio ?? 0.3,
139
- hangoverMs: config.hangoverMs ?? 350,
140
- attackMs: config.attackMs ?? 50,
141
- releaseMs: config.releaseMs ?? 120
149
+ minDb: config.minDb ?? DEFAULT_SPEAKING_DETECTION_CONFIG.minDb,
150
+ maxDb: config.maxDb ?? DEFAULT_SPEAKING_DETECTION_CONFIG.maxDb,
151
+ speakOnRatio: config.speakOnRatio ?? DEFAULT_SPEAKING_DETECTION_CONFIG.speakOnRatio,
152
+ speakOffRatio: config.speakOffRatio ?? DEFAULT_SPEAKING_DETECTION_CONFIG.speakOffRatio,
153
+ hangoverMs: config.hangoverMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.hangoverMs,
154
+ attackMs: config.attackMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.attackMs,
155
+ releaseMs: config.releaseMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.releaseMs
142
156
  };
143
157
  }
144
158
  updateConfig(config) {
@@ -201,13 +215,9 @@ async function createRemoteAudioMonitor(sourceTrack, config = {}) {
201
215
  registerPipeline();
202
216
  const fullConfig = {
203
217
  speaking: {
204
- minDb: config.speaking?.minDb ?? -55,
205
- maxDb: config.speaking?.maxDb ?? -20,
206
- speakOnRatio: config.speaking?.speakOnRatio ?? 0.5,
207
- speakOffRatio: config.speaking?.speakOffRatio ?? 0.3,
208
- hangoverMs: config.speaking?.hangoverMs ?? 500,
209
- attackMs: config.speaking?.attackMs ?? 100,
210
- releaseMs: config.speaking?.releaseMs ?? 120
218
+ ...DEFAULT_SPEAKING_DETECTION_CONFIG,
219
+ ...DEFAULT_REMOTE_SPEAKING_OPTIONS.speaking,
220
+ ...config.speaking
211
221
  }
212
222
  };
213
223
  if (!sourceTrack || sourceTrack.kind !== "audio") {
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  createRemoteAudioMonitor
3
- } from "../chunk-7IKKNKM7.mjs";
4
- import "../chunk-AQ5RVY33.mjs";
5
- import "../chunk-OZ7KMC4S.mjs";
3
+ } from "../chunk-VBYRPG4G.mjs";
6
4
  import "../chunk-QNQK6QFB.mjs";
5
+ import "../chunk-YJCIZWND.mjs";
6
+ import "../chunk-RYODEXAU.mjs";
7
+ import "../chunk-OZ7KMC4S.mjs";
7
8
  export {
8
9
  createRemoteAudioMonitor
9
10
  };
@@ -23,6 +23,19 @@ __export(vad_state_exports, {
23
23
  LevelBasedVAD: () => LevelBasedVAD
24
24
  });
25
25
  module.exports = __toCommonJS(vad_state_exports);
26
+
27
+ // src/defaults.ts
28
+ var DEFAULT_SPEAKING_DETECTION_CONFIG = {
29
+ minDb: -55,
30
+ maxDb: -20,
31
+ speakOnRatio: 0.5,
32
+ speakOffRatio: 0.3,
33
+ hangoverMs: 500,
34
+ attackMs: 100,
35
+ releaseMs: 120
36
+ };
37
+
38
+ // src/vad/vad-state.ts
26
39
  var LevelBasedVAD = class {
27
40
  config;
28
41
  speaking = false;
@@ -30,13 +43,13 @@ var LevelBasedVAD = class {
30
43
  pendingSilenceSince = null;
31
44
  constructor(config) {
32
45
  this.config = {
33
- minDb: config.minDb,
34
- maxDb: config.maxDb,
35
- speakOnRatio: config.speakOnRatio ?? 0.6,
36
- speakOffRatio: config.speakOffRatio ?? 0.3,
37
- hangoverMs: config.hangoverMs ?? 350,
38
- attackMs: config.attackMs ?? 50,
39
- releaseMs: config.releaseMs ?? 120
46
+ minDb: config.minDb ?? DEFAULT_SPEAKING_DETECTION_CONFIG.minDb,
47
+ maxDb: config.maxDb ?? DEFAULT_SPEAKING_DETECTION_CONFIG.maxDb,
48
+ speakOnRatio: config.speakOnRatio ?? DEFAULT_SPEAKING_DETECTION_CONFIG.speakOnRatio,
49
+ speakOffRatio: config.speakOffRatio ?? DEFAULT_SPEAKING_DETECTION_CONFIG.speakOffRatio,
50
+ hangoverMs: config.hangoverMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.hangoverMs,
51
+ attackMs: config.attackMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.attackMs,
52
+ releaseMs: config.releaseMs ?? DEFAULT_SPEAKING_DETECTION_CONFIG.releaseMs
40
53
  };
41
54
  }
42
55
  updateConfig(config) {
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  LevelBasedVAD
3
- } from "../chunk-AQ5RVY33.mjs";
3
+ } from "../chunk-YJCIZWND.mjs";
4
+ import "../chunk-RYODEXAU.mjs";
4
5
  export {
5
6
  LevelBasedVAD
6
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tensamin/audio",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "author": {
5
5
  "email": "aloisianer@proton.me",
6
6
  "name": "Alois"