Impossible to record user voice (with sounddevice)

I tried to record the user voice of my app with soundevice:

 audio_input = sd.rec(frames=int(sampling_rate * duration), samplerate=sampling_rate, channels=1)

It works on my computer, but not on the cloud. Here is the message I received:

File "/home/user/.local/lib/python3.10/site-packages/", line 71, in <module>
    raise OSError('PortAudio library not found')

I tried also to use PyAudio, without success…

What should I do ? (Is there a way to import PortAudio…)

This approach will fundamentally not work on streamlit cloud, because you don’t have access to the clients audio hardware from the hosted streamlit application.

Thank you Franky1, but can you help to sort it out, i.e. “record user voice” ?

You will need a custom streamlit component, that can record audio via the webbrowser api.
Possible options:

Thank you

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.