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.post1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67885c771db2ba283d60c32fc5c31eb3a8179674e211d7661d95fad7b2311a27 |
|
MD5 | f3c896207d6c6c59529f1bf982cfb1fa |
|
BLAKE2b-256 | 78fb99b410f8cf88adbad04c280c03680eb3b82ac21ff343f3a72a85d03c2278 |
Close
Hashes for streamlit_audiorecorder-0.0.3.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a644cb9d2bb74bd6a4e247e4728ad4b08fd52af74fdf1f7a7698e55eab3ec22 |
|
MD5 | 74fdc76a179a9110f7ef0ad277dd9a8b |
|
BLAKE2b-256 | 9630870bc5dc8ac0bcd3496ef48e50351965d91b83b3a5ebd381535ac1fda419 |