Audio recorder component for streamlit
Project description
Audio Recorder for streamlit
Audio recorder component for streamlit.
It creates a button: one click to start recording, one click to stop recording.
The component's return value is a pydub AudioSegment.
To play the audio in the frontend, use st.audio(audio.export().read())
.
All pydub AudioSegment methods are available, so you can save the audio to a file with audio.export("audio.wav", format="wav")
for example.
Install it with pip:
pip install streamlit-audiorecorder
Note: This package uses pydub which uses ffmpeg, so both should be installed for this audiorecorder to work properly.
Use it:
import streamlit as st
from audiorecorder import audiorecorder
st.title("Audio Recorder")
audio = audiorecorder("Click to record", "Click to stop recording")
if not audio.empty():
# To play audio in frontend:
st.audio(audio.export().read())
# To save audio to a file, use pydub export method:
audio.export("audio.wav", format="wav")
# To get audio properties, use pydub AudioSegment properties:
st.write(f"Frame rate: {audio.frame_rate}, Frame width: {audio.frame_width}, Duration: {audio.duration_seconds} seconds")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for streamlit-audiorecorder-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dea452444b0f6ec53872085f0ad581645db76c6b87e7dbaff82a288682f17e0 |
|
MD5 | 55a5e2d4711fbbe183a717da4b7311d2 |
|
BLAKE2b-256 | bd85e9b54b7ea82f45078d2ba2267541e9177d8733fa96d03332f9b8be9577e4 |
Close
Hashes for streamlit_audiorecorder-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74111711b0dbb15b3a6cf3b4dedf5d1144323f5374354186ffa3a62d402d6dad |
|
MD5 | 566e81d8ccf814bdc95d32eabcc9e556 |
|
BLAKE2b-256 | e1f0cf6abd09da4f19eea24f723544be395a18a3e2f6f8469d4b3b7bc27322ab |