Hi folks,
I fell in love with streamlit for buiding interactive educational webapps for understanding signal processing (see my project)
I absolutely need to be able to play sounds from generated content, and saving+reading it from a file is too slow. I know several people have mentioned this problem before and there is an official request about this. I just want to bring an almost solution and see if someone else can contribute.
This ALMOST works :
import streamlit as st
from numpy import *
import scipy.io.wavfile as wav
import io
fe=10000;
t=arange(0.0,1,1/fe)
signal=asin(2pift)
bytes_wav = byte()
byte_io = io.BytesIO(bytes_wav)
wav.write(byte_io, fe, around(signal) )
st.audio(byte_io)
We DO hear sthg, which changes if you change the freq of the sine
It lasts 1 second as expected
But the sound, although sine-rleated, is corrupted, as if the format of the data was not correctly interpreted.
Strangely enough, if I remove the “around”, then the silder still lasts one second, but it is silent.
Summarizing I am this close to the solution but stucked.
Thierry