Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from audiorecorder import audiorecorder
|
3 |
+
|
4 |
+
st.title("Audio Recorder")
|
5 |
+
audio = audiorecorder("Click to record", "Click to stop recording")
|
6 |
+
|
7 |
+
if not audio.empty():
|
8 |
+
# To play audio in frontend:
|
9 |
+
st.audio(audio.export().read())
|
10 |
+
|
11 |
+
# To save audio to a file, use pydub export method:
|
12 |
+
audio.export("audio.wav", format="wav")
|
13 |
+
|
14 |
+
# To get audio properties, use pydub AudioSegment properties:
|
15 |
+
st.write(f"Frame rate: {audio.frame_rate}, Frame width: {audio.frame_width}, Duration: {audio.duration_seconds} seconds")
|