The streamlit docs ( https://docs.streamlit.io/en/stable/api.html#streamlit.audio ) state that streamlit.audio
can take a numpy ndarray
containing raw sample data and display an audio player. I tried this as follows on a local host:
import streamlit as st
import soundfile
data, sr = soundfile.read('test.wav')
st.audio(data)
It successfully displays an audio player and throws no errors, however there is no available sound.
Am I doing anything wrong or are the docs incorrect?
Is your code correct? It appears you unpack data
and sr
to variables, but then you pass audio
to the np.array
function. Where does audio
come from, or should that be data
instead?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.