Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

16kHz sample rate does not work #52

Closed
frissonlabs opened this issue Oct 4, 2022 · 2 comments
Closed

16kHz sample rate does not work #52

frissonlabs opened this issue Oct 4, 2022 · 2 comments

Comments

@frissonlabs
Copy link

From the examples, it looks like the required sample rate is 44.1kHz or 48kHz (they both seem to generate accurate transcriptions, not sure which one is better). I tried setting 16kHz for the microphone, audio context, and recognizer, but the transcriptions were not valid at all. I thought the models work with 16kHz; is there a reason why this sample rate doesn't work? The poster of #48 mentioned having to update from 16k to 48kHz in order for the basic example to work.

@ccoreilly
Copy link
Owner

The issue is most likely that some browser will not provide media at 16kHz (they ignore the samplerate parameter) and fallback to 48kHz. However you are telling vosk when creating the recognizer that audio will be streamed at 16kHz. You are thus sending 48kHz audio to a recognizer expecting 16kHz, which is why it does not work.

@frissonlabs
Copy link
Author

frissonlabs commented Oct 6, 2022

We can’t change the sample rate of the recording device but, if I recall correctly, we can manually specify the sample rate for the audio context and the browser would automatically downsample (using the Web Audio API) the audio data. I verified that I was indeed getting 16kHz PCM audio data by inspecting the waveform of a sine wave at a fixed and known frequency.

UPDATE
The demo does indeed work with 16kHz. Nevermind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants