File size: 919 Bytes
1b95475
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import streamlit as st
from pydub import AudioSegment
import io

# Define a Streamlit app
st.title("Audio Speed Reduction App")

# Upload the input audio file
uploaded_audio = st.file_uploader("Upload an audio file", type=["mp3", "wav", "ogg", "flac", "wma", "m4a"])

if uploaded_audio is not None:
    audio_bytes = uploaded_audio.read()

    # Convert audio file to AudioSegment
    audio = AudioSegment.from_file(io.BytesIO(audio_bytes))

    # Slow down the audio by changing the playback speed
    st.write("Slowing down audio...")
    slowed_audio = audio.speedup(playback_speed=0.5)

    # Convert the slowed audio to bytes
    slowed_audio_bytes = slowed_audio.export(format="wav").read()

    # Provide a link to download the processed audio
    st.audio(slowed_audio_bytes, format="audio/wav")

# Run the Streamlit app
if __name__ == "__main__":
    st.write("Upload an audio file to apply speed reduction.")