Joooohan / audio-recorder-streamlit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

recording stops automatically

gustavz opened this issue · comments

Hi @Joooohan , thanks for this streamlit component!
Is it intended that it automatically stops recording after a few seconds (around 3-7)?
The length seems random and it is not possible to do longer recordings.
Any idea around that issue?

Hi @gustavz, happy to see you are seeing some value in this component.

There are 3 parameters not exposed to the Python API that control when to start recording automatically and when to stop recording.

They are here: for every buffer we compute the audio energy level. If the energy level stays above the energy_threshold more than phrase_threshold then the recording starts. After that, if the energy level stays below energy_threshold longer than pause_threshold the recording automatically stops.

This fits the classic use case of starting the recording, speaking a phrase and automatically stopping when the phrase is over.

I can expose these parameters in the Python component to have more control on how to record.

Makes sense, thank you for the quick reply. And yeah it would be great if you could expose these parameters.
Any configurability of the component would be highly appreciated (like button appearance and such things).
An option to switch between auto recording like it is the default right now and an manual start stop would also be great!

I exposed the energy_threshold and pause_threshold in version 0.0.5. To have the manual start and stop behavior you can set the energy threshold to 0 so that the the recording never stops automatically. The recording can be manually stopped by clicking again on the button.

I will also add the possibility to change the appearance.

@gustavz I added the ability to customize the icon, colors and size in version 0.0.6.