Update app.py
Browse files
app.py
CHANGED
@@ -107,13 +107,13 @@ with st.expander("2️⃣ 🎙️ SoundDevice Party"):
|
|
107 |
if st.button("🎵 Grab Sound", key="sounddevice_1"):
|
108 |
# 🎤🌩️ Records like a storm-chasing bard! | 🎙️ sd.rec(44100) - Captures audio like thunder in a bottle!
|
109 |
fs = 44100
|
110 |
-
duration = 3
|
111 |
recording = sd.rec(int(duration * fs), samplerate=fs, channels=1, dtype='int16')
|
112 |
sd.wait()
|
113 |
file_path = f"sounddevice_rec_{datetime.now().strftime('%Y%m%d_%H%M%S')}.wav"
|
114 |
with wave.open(file_path, 'wb') as wf:
|
115 |
wf.setnchannels(1)
|
116 |
-
wf.setsampwidth(2)
|
117 |
wf.setframerate(fs)
|
118 |
wf.writeframes(recording.tobytes())
|
119 |
save_to_history("Audio", file_path)
|
|
|
107 |
if st.button("🎵 Grab Sound", key="sounddevice_1"):
|
108 |
# 🎤🌩️ Records like a storm-chasing bard! | 🎙️ sd.rec(44100) - Captures audio like thunder in a bottle!
|
109 |
fs = 44100
|
110 |
+
duration = 3
|
111 |
recording = sd.rec(int(duration * fs), samplerate=fs, channels=1, dtype='int16')
|
112 |
sd.wait()
|
113 |
file_path = f"sounddevice_rec_{datetime.now().strftime('%Y%m%d_%H%M%S')}.wav"
|
114 |
with wave.open(file_path, 'wb') as wf:
|
115 |
wf.setnchannels(1)
|
116 |
+
wf.setsampwidth(2)
|
117 |
wf.setframerate(fs)
|
118 |
wf.writeframes(recording.tobytes())
|
119 |
save_to_history("Audio", file_path)
|