audio_file = open(‘trans.mp3’, ‘rb’)
audio_bytes = audio_file.read()
st.audio(audio_bytes, format=‘audio/ogg’)
how can I autodisplay audio
audio_file = open(‘trans.mp3’, ‘rb’)
audio_bytes = audio_file.read()
st.audio(audio_bytes, format=‘audio/ogg’)
how can I autodisplay audio
Hi @lazeni,
What do you mean when you say you want to autodisplay the audio? can you attach a picture or gif of the functionality you’re looking for?
Thanks!
Marisa
Hey @lazeni,
The audio doesn’t have any functionality to autoplay after an upload. The team wanted to make sure that the user had control over when audio is played on their device.
Why were you trying to get autoplay on the uploaded file? maybe there is another way I can help you to achieve your end goal?
Happy Streamlit-ing!
Marisa
Thank you again Marissa,
my goal is just to convert a text in to audio and just repeat directly in speech
this is my code:
text_en = “this article is non compliant”
ta_tts = gTTS(text_en)
ta_tts.save(‘trans.mp3’)
audio_file = open(‘trans.mp3’, ‘rb’)
audio_bytes = audio_file.read()
st.audio(audio_bytes, format=‘audio/ogg’,start_time=0)
Hey @lazeni,
Ah, I see now why you were hoping to have the audio file play automatically. Yes, I do believe that you have the best option there, for now the user who inputs the text will have to hit the play button to hear the generated audio.
But I think this is a cool application and I created a feature request (FR) on github for you, you can see it here: link to github FR
Happy Streamlit-ing!
Marisa
Thank you so much Marisa
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.