Closed anurag-desp closed 1 year ago
That's the thing buddy, no such file is being created. The audio_recorder
function simply "records"(not sure how its done) the audio for the given sample rate, start and end thresholds etc. and converts this recording into a stream of bytes. This stream of bytes is then directly sent to audio
function of streamlit
. To store this audio in a separate audio file, you can simply write these bytes to a .wav file.
# A simple sample code. NOT sure about the security though :(
from audio_recorder_streamlit import audio_recorder
import streamlit as st
audio_bytes = audio_recorder()
if audio_bytes:
with open ("temp_audio_file.wav", mode="wb") as recorded_data:
recorded_data.write(audio_bytes)
st.audio(audio_bytes, format="audio/wav")
Is there any way to have a text input to define the name of the saved .wav file?
Please share how did you resolve the issue? I cannot seem to understand where the audio file is stored when I replay it in the browser. It certainly is not saved to my Python directory. Is it stored in the cache? The must be a way to store is securely somewhere, e.g. what if the audio has confidential data? I want to record and save it locally or in a database. Is it possible?