Anita-19 commited on
Commit
98275cd
·
verified ·
1 Parent(s): 3443149

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +11 -0
main.py CHANGED
@@ -263,6 +263,17 @@ def adjust_pitch(audio_path, pitch_factor):
263
  # Save adjusted audio
264
  sf.write(audio_path, y_shifted, sr)
265
 
 
 
 
 
 
 
 
 
 
 
 
266
  """Set up the Gradio interface"""
267
 
268
  import gradio as gr
 
263
  # Save adjusted audio
264
  sf.write(audio_path, y_shifted, sr)
265
 
266
+ def adjust_speed(audio_path, speed_factor):
267
+ # Load the audio file
268
+ y, sr = librosa.load(audio_path)
269
+
270
+ # Adjust the speed (this alters the duration of the audio)
271
+ y_speeded = librosa.effects.time_stretch(y, speed_factor)
272
+
273
+ # Save the adjusted audio
274
+ sf.write(audio_path, y_speeded, sr)
275
+
276
+
277
  """Set up the Gradio interface"""
278
 
279
  import gradio as gr