-
Notifications
You must be signed in to change notification settings - Fork 16
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
MediaStream
linked to a MediaRecorder
without an AudioContext in between results in a runaway recording
#404
Comments
MediaRecorder
not working properly with MediaStream
from get_user_media_sync
Thanks for the report. This is very interesting since you are combining the MediaDevices API and the MediaRecorder API, without an AudioContext in between. This is of course fine on the web, but not something we have really accounted for in our implementation - which main focus is the Web Audio API. Tacking an AudioContext in between makes it work:
You might wonder what's happening in your example and why it produces a large wav with garbage. The AudioContext in our library is responsible for timing of the render quantums to produce e.g. 48000 samples per second. We have taken some shortcuts in implementing the MediaStream API that results in them supplying samples on demand, instead of having an internal clock themselves. When you hook the mic directly to the recorder, the recorders polls for samples continuously. The stream is trying to provide them ASAP, and inserting silent frames whenever the underlying source (mic in this case) cannot provide them. Since there is no AudioContext clock to tame the recorder polling, the result is a giant wav file (the faster your computer, the larger the file). The noise is because it is mixing true signal with silent gaps. In any case this is something we need to address. For now remember to actually use the Web Audio API when using our library :) NB: the |
MediaRecorder
not working properly with MediaStream
from get_user_media_sync
MediaStream
linked to a MediaRecorder
without an AudioContext in between results in a runaway recording
Hi there,
thank you for your work on this great library!
I want to use this library for a Uni Project where I do live transcription and analyze spoken sentences with an LLM.
Somehow recording the mic doesn't seem to work.
This code produces an 11 Minute .wav file that blasts your ears away with garbage:
Is there something obvious that I am missing? The example for
get_user_media_sync
for the docs works without any problems and I can hear myself clearly and without any latency.I am using Linux with PipeWire.
Kind Regards,
David
The text was updated successfully, but these errors were encountered: