Is st.audio_input working?

Hi,

I am using Streamlit (v1.45.1) locally. I tried a simple command below:

tst_audio = st.audio_input(label='Rec Audio:')

After stopping the audio record, it takes forever to save the file, if it eventually does. I tried using a callback too. It could be a possible bug?

Cheers

I tried it locally with 1.45.1 and this worked fine for me:

from pathlib import Path

import streamlit as st

audio_value = st.audio_input("Record a voice message")

if audio_value:
    st.audio(audio_value)
    audio_path = Path("audio.wav")
    audio_path.write_bytes(audio_value.read())

    st.write("Audio saved to audio.wav")

Hi @blackary

Thanks for responding.

For some reason, this doesn’t work on my setup… I reinstalled Streamlit and rebooted too. Maybe, I am doing something wrong…

Here’s the video wherein I copy-pasted your code in tst.py and ran it. It accepts the voice input but gets into an infinite loop when you stop recording, to save.

5_20_2025_-1_42_09-PM-Screen-Untitled-video

Cheers

I think this might be a problem with Brave. I can’t exactly repro your issue, but I do see some weirdness in Brave:

  • Chrome or Safari or Firefox (all on Mac): when I record 3s of audio, it uploads very quickly (< 1s)
  • Brave (on Mac): when I record 3s of audio, it takes 16s to upload

I didn’t see any errors in the JS console, though, so it’s hard to tell from a quick investigation what could be happening.

I know this doesn’t solve your issue, but I just wanted to post more info here for future reference :wink:

Thank you @thiago , for your help and support.

I ran the program using Edge and it worked flawlessly; Brave still doesn’t save audio.

Therefore, there may be other browser specific issues with Brave - strange, it never happened earlier.

Thanks once again.

Cheers