Add sample rate to config (#8797)
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / uitest-workspaces (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2025-05-01 12:57:40 +04:00 committed by GitHub
parent 93a957275c
commit ee99e76bb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -35,7 +35,8 @@ interface Config {
DgVadEvents: boolean
DgPunctuate: boolean
DgSmartFormat: boolean
DgNoDelay: boolean
DgNoDelay: boolean,
DgSampleRate: number
}
const config: Config = (() => {
@ -59,7 +60,8 @@ const config: Config = (() => {
DgPunctuate: process.env.DG_PUNCTUATE === 'true',
DgSmartFormat: process.env.DG_SMART_FORMAT === 'true',
DgUtteranceEndMs: parseInt(process.env.DG_UTTERANCE_END_MS ?? '0'),
DgNoDelay: process.env.DG_NO_DELAY === 'true'
DgNoDelay: process.env.DG_NO_DELAY === 'true',
DgSampleRate: parseInt(process.env.DG_SAMPLE_RATE ?? '16000')
}
const missingEnv = (Object.keys(params) as Array<keyof Config>).filter((key) => params[key] === undefined)

View File

@ -167,7 +167,7 @@ export class STT implements Stt {
if (track === undefined) return
if (this.dgConnectionBySid.has(sid)) return
const stream = new AudioStream(track)
const stream = new AudioStream(track, config.DgSampleRate)
// const language = this.language ?? 'en'
const options = this.getOptions(stream)
const dgConnection = this.deepgram.listen.live(options)