Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ if uploaded_audio is not None:
|
|
16 |
|
17 |
# Convert audio file to numpy array
|
18 |
audio, sample_rate = sf.read(io.BytesIO(audio_bytes))
|
19 |
-
|
20 |
# Apply noise reduction
|
21 |
st.write("Applying noise reduction...")
|
22 |
reduced_audio_data = nr.reduce_noise(y=audio, sr=sample_rate)
|
@@ -29,9 +29,12 @@ if uploaded_audio is not None:
|
|
29 |
channels=1
|
30 |
)
|
31 |
|
32 |
-
#
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
35 |
|
36 |
# Export the slowed audio to a file
|
37 |
slowed_audio.export("output_audio.wav", format="wav")
|
|
|
16 |
|
17 |
# Convert audio file to numpy array
|
18 |
audio, sample_rate = sf.read(io.BytesIO(audio_bytes))
|
19 |
+
|
20 |
# Apply noise reduction
|
21 |
st.write("Applying noise reduction...")
|
22 |
reduced_audio_data = nr.reduce_noise(y=audio, sr=sample_rate)
|
|
|
29 |
channels=1
|
30 |
)
|
31 |
|
32 |
+
# Save the reduced audio as a 16-bit wave file
|
33 |
+
reduced_audio.export("reduced_audio.wav", format="wav")
|
34 |
+
|
35 |
+
# Load the 16-bit wave file and slow it down
|
36 |
+
slowed_audio = AudioSegment.from_wav("reduced_audio.wav")
|
37 |
+
slowed_audio = slowed_audio.speedup(playback_speed=0.7)
|
38 |
|
39 |
# Export the slowed audio to a file
|
40 |
slowed_audio.export("output_audio.wav", format="wav")
|