Anita-19 commited on
Commit
5a24114
Β·
verified Β·
1 Parent(s): 9731529

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -22,6 +22,17 @@ emotion_settings = {
22
  "shame": {"pitch": 0.8, "speed": 0.85},
23
  }
24
 
 
 
 
 
 
 
 
 
 
 
 
25
  # Function to process text or file input and generate audio
26
  def emotion_aware_tts_pipeline(input_text=None, file_input=None):
27
  try:
 
22
  "shame": {"pitch": 0.8, "speed": 0.85},
23
  }
24
 
25
+ import librosa
26
+ import soundfile as sf
27
+
28
+ def adjust_pitch(audio_path, pitch_factor):
29
+ # Load audio
30
+ y, sr = librosa.load(audio_path)
31
+ # Adjust pitch
32
+ y_shifted = librosa.effects.pitch_shift(y, sr, n_steps=pitch_factor)
33
+ # Save adjusted audio
34
+ sf.write(audio_path, y_shifted, sr)
35
+
36
  # Function to process text or file input and generate audio
37
  def emotion_aware_tts_pipeline(input_text=None, file_input=None):
38
  try: