Skip to content

Commit

Permalink
Fork for dynamically adjust vad parameters #173 (#178)
Browse files Browse the repository at this point in the history
* changes to adjust VAD parameters dynamically in web package

* changes to adjust VAD parameters dynamically in web package

* changes to adjust VAD parameters dynamically in web package

---------

Co-authored-by: Tim <[email protected]>
Co-authored-by: Ricky Samore <[email protected]>
  • Loading branch information
3 people authored Jan 7, 2025
1 parent 2caa920 commit 1d6d8b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelogs/web-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 0.0.23

* add support to change VAD parameters dynamically [#137] https://github.com/ricky0123/vad/issues/173
* add onRealSpeechStart callback - "not a misfire" event (https://github.com/ricky0123/vad/issues/67)

## 0.0.22
Expand Down
11 changes: 11 additions & 0 deletions packages/web/src/real-time-vad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ export class MicVAD {
this.audioNodeVAD.destroy()
this.audioContext.close()
}

setOptions = (options) => {
this.audioNodeVAD.setFrameProcessorOptions(options)
}
}

export class AudioNodeVAD {
Expand Down Expand Up @@ -409,4 +413,11 @@ export class AudioNodeVAD {
this.audioNode.disconnect()
this.gainNode?.disconnect()
}

setFrameProcessorOptions = (options) => {
this.frameProcessor.options = {
...this.frameProcessor.options,
...options,
}
}
}

0 comments on commit 1d6d8b2

Please sign in to comment.