Rhueue commited on
Commit
00faab9
·
1 Parent(s): 73335f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -13,10 +13,10 @@ uploaded_audio = st.file_uploader("Upload an audio file", type=["mp3", "wav"])
13
 
14
  if uploaded_audio is not None:
15
  audio_bytes = uploaded_audio.read()
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,10 +29,9 @@ if uploaded_audio is not None:
29
  channels=1
30
  )
31
 
32
- # Slow down the audio by changing the frame rate
33
  st.write("Slowing down audio...")
34
- slowed_sample_rate = int(sample_rate * 0.7)
35
- slowed_audio = reduced_audio.set_frame_rate(slowed_sample_rate)
36
 
37
  # Export the slowed audio to a file
38
  slowed_audio.export("output_audio.wav", format="wav")
 
13
 
14
  if uploaded_audio is not None:
15
  audio_bytes = uploaded_audio.read()
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
+ # Slow down the audio by resampling
33
  st.write("Slowing down audio...")
34
+ slowed_audio = reduced_audio.set_frame_rate(int(sample_rate * 0.7))
 
35
 
36
  # Export the slowed audio to a file
37
  slowed_audio.export("output_audio.wav", format="wav")