Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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:
|