Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from pydub import AudioSegment
|
|
|
3 |
import io
|
4 |
|
5 |
# Define a Streamlit app
|
@@ -14,15 +15,13 @@ if uploaded_audio is not None:
|
|
14 |
# Convert audio file to AudioSegment
|
15 |
audio = AudioSegment.from_file(io.BytesIO(audio_bytes))
|
16 |
|
17 |
-
# Slow down the audio
|
18 |
st.write("Slowing down audio...")
|
19 |
-
|
|
|
20 |
|
21 |
-
#
|
22 |
-
|
23 |
-
|
24 |
-
# Provide a link to download the processed audio
|
25 |
-
st.audio(slowed_audio_bytes, format="audio/wav")
|
26 |
|
27 |
# Run the Streamlit app
|
28 |
if __name__ == "__main__":
|
|
|
1 |
import streamlit as st
|
2 |
from pydub import AudioSegment
|
3 |
+
from pydub.playback import _play_with_simpleaudio as play_sound
|
4 |
import io
|
5 |
|
6 |
# Define a Streamlit app
|
|
|
15 |
# Convert audio file to AudioSegment
|
16 |
audio = AudioSegment.from_file(io.BytesIO(audio_bytes))
|
17 |
|
18 |
+
# Slow down the audio using the speed_change_ratio
|
19 |
st.write("Slowing down audio...")
|
20 |
+
speed_change_ratio = 0.7
|
21 |
+
slowed_audio = audio.speedup(playback_speed=1/speed_change_ratio)
|
22 |
|
23 |
+
# Play the slowed down audio
|
24 |
+
play_sound(slowed_audio)
|
|
|
|
|
|
|
25 |
|
26 |
# Run the Streamlit app
|
27 |
if __name__ == "__main__":
|