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

Downloading audio file to a server location #19

Open
creme17 opened this issue Feb 12, 2024 · 1 comment
Open

Downloading audio file to a server location #19

creme17 opened this issue Feb 12, 2024 · 1 comment

Comments

@creme17
Copy link

creme17 commented Feb 12, 2024

Hello!

I love this app, thank you so much for developing. It's very easy to use however I'm trying to save down the audio file to a server location once the stop button is pressed, which works, but takes an extremely long time to once the audio recording is longer than a couple of seconds (though downloading the file locally to my machine works well). Does anyone know of a potential workaround that would speed up the processing, ie leveraging or compressing the audio? Would appreciate any insights!

@rushi-the-neural-arch
Copy link

yes you can save it in this way once you stop the recording -

 import tempfile
 from st_audiorec import st_audiorec

wav_audio_data = st_audiorec()

if wav_audio_data is not None:
       st.audio(wav_audio_data, format='audio/wav')

with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as temp_file:
        temp_file.write(wav_audio_data)
        temp_file_path = temp_file.name
        st.success(f"Audio saved to {temp_file_path}")

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