Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -22,17 +22,6 @@ emotion_settings = {
|
|
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:
|
@@ -52,10 +41,6 @@ def emotion_aware_tts_pipeline(input_text=None, file_input=None):
|
|
52 |
speed = settings["speed"]
|
53 |
pitch = settings["pitch"]
|
54 |
|
55 |
-
if speed > 1.0:
|
56 |
-
input_text = input_text.replace(" ", ". ") # Faster speech simulation
|
57 |
-
elif speed < 1.0:
|
58 |
-
input_text = input_text.replace(" ", "... ") # Slower speech simulation
|
59 |
|
60 |
# Generate audio
|
61 |
audio_path = "output.wav"
|
|
|
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:
|
|
|
41 |
speed = settings["speed"]
|
42 |
pitch = settings["pitch"]
|
43 |
|
|
|
|
|
|
|
|
|
44 |
|
45 |
# Generate audio
|
46 |
audio_path = "output.wav"
|