question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recording Audio in the Browser Using the MediaStream

See original GitHub issue

Hi,

I’m trying to capture and to record a voice in the browser. Looks like modern browsers (at least Firefox and Chrome) don’t support recording audio/wav. Is it possible to configure vosk-server to be able to handle MIME types: audio/ogg or audio/webm too?

Thanks, Vlad

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nshmyrevcommented, Mar 12, 2021

The audio you recorded with addpipe is 44100 hz sample rate, server by default expects 8000 hz sample rate. To reconfigure the server you can send config message like this:

    await websocket.send('''{"config" : { "sample_rate" : 16000.0}}''')

as in test_words.py example.

In general it is pretty wasteful to send 44khz audio over network, you’d better resample to 8000hz on client, you can use resampler javascript library for that as in angular js demo:

https://github.com/alphacep/vosk-server/blob/1461abc592855dceb436ca8538d7766b0a877216/client-samples/angular-demo/src/assets/recorder-worker.js#L3

0reactions
zhurlikcommented, Mar 12, 2021

Hi,

I don’t think so that the problem is with sending, in my opinion the problem is in Chrome/Firefox they use the audio format that the vosk-server can not parse/read. I am attaching vosk-server-test.zip with the scripts and the readme file where I have described the scenarios that I did. Could you have a look at them maybe it will help you to understand what I mean. You can see that the wav files were recorded in the browsers don’t work, it doesn’t matter how I will send them to the vosk-server either via javascript in the browser or via the command line using python script.

Thanks, Vlad

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using the MediaStream Recording API - MDN Web Docs
The MediaStream Recording API makes it easy to record audio and/or video streams. When used with navigator.mediaDevices.
Read more >
Recording Audio With the MediaStream Recorder API
The MediaStream Recorder API makes media recording in the browser very easy. It allows capturing chunks of (audio) data from a microphone media...
Read more >
How to Record Audio Using the MediaStream API - SitePoint
How to Record Audio Using the MediaStream API ... Then go to localhost:3000 in your browser. You'll see a record button. Record Page....
Read more >
Record audio and video with MediaRecorder
The MediaRecorder API enables you to record audio and video from a web app. It's available now in Firefox and in Chrome for...
Read more >
An introduction to the MediaRecorder API - Twilio
To start with the MediaRecorder API, you need a MediaStream. You can either get one from a <video> or <audio> element or by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found