0

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?

user32882
  • 5,094
  • 5
  • 43
  • 82

1 Answers1

0

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?

Randy Zwitch
  • 1,994
  • 1
  • 11
  • 19