Anita-19 commited on
Commit
55daaba
·
verified ·
1 Parent(s): b8e71c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
1
  """Set up the Gradio interface"""
2
 
3
  import gradio as gr
 
1
+ import librosa
2
+ import soundfile as sf
3
+
4
+ def adjust_pitch(audio_path, pitch_factor):
5
+ # Load audio
6
+ y, sr = librosa.load(audio_path)
7
+ # Adjust pitch
8
+ y_shifted = librosa.effects.pitch_shift(y, sr, n_steps=pitch_factor)
9
+ # Save adjusted audio
10
+ sf.write(audio_path, y_shifted, sr)
11
+
12
  """Set up the Gradio interface"""
13
 
14
  import gradio as gr