Rhueue commited on
Commit
1b95475
1 Parent(s): b35cede

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from pydub import AudioSegment
3
+ import io
4
+
5
+ # Define a Streamlit app
6
+ st.title("Audio Speed Reduction App")
7
+
8
+ # Upload the input audio file
9
+ uploaded_audio = st.file_uploader("Upload an audio file", type=["mp3", "wav", "ogg", "flac", "wma", "m4a"])
10
+
11
+ if uploaded_audio is not None:
12
+ audio_bytes = uploaded_audio.read()
13
+
14
+ # Convert audio file to AudioSegment
15
+ audio = AudioSegment.from_file(io.BytesIO(audio_bytes))
16
+
17
+ # Slow down the audio by changing the playback speed
18
+ st.write("Slowing down audio...")
19
+ slowed_audio = audio.speedup(playback_speed=0.5)
20
+
21
+ # Convert the slowed audio to bytes
22
+ slowed_audio_bytes = slowed_audio.export(format="wav").read()
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__":
29
+ st.write("Upload an audio file to apply speed reduction.")