Update app.py
Browse files
app.py
CHANGED
@@ -49,6 +49,7 @@ async def generate_audio_with_voice_prefix(text_segment, default_voice, rate, pi
|
|
49 |
current_rate = rate
|
50 |
current_pitch = pitch
|
51 |
processed_text = text_segment.strip()
|
|
|
52 |
voice_map = {
|
53 |
"1F": "en-GB-SoniaNeural",
|
54 |
"2M": "en-GB-RyanNeural",
|
@@ -102,11 +103,11 @@ async def generate_audio_with_voice_prefix(text_segment, default_voice, rate, pi
|
|
102 |
if target_duration_ms is not None and os.path.exists(audio_path):
|
103 |
audio = AudioSegment.from_mp3(audio_path)
|
104 |
audio_duration_ms = len(audio)
|
105 |
-
print(f"Generated audio duration: {audio_duration_ms}ms, Target duration: {target_duration_ms}ms") # Debug
|
106 |
|
107 |
if audio_duration_ms > target_duration_ms and target_duration_ms > 0:
|
108 |
speed_factor = (audio_duration_ms / target_duration_ms) * speed_adjustment_factor
|
109 |
-
print(f"Speed factor (after user adjustment): {speed_factor}") # Debug
|
110 |
if speed_factor > 0:
|
111 |
if speed_factor <1.0:
|
112 |
speed_factor = 1.0
|
|
|
49 |
current_rate = rate
|
50 |
current_pitch = pitch
|
51 |
processed_text = text_segment.strip()
|
52 |
+
print(f"Processing this text segment: {processed_text}") # Debug
|
53 |
voice_map = {
|
54 |
"1F": "en-GB-SoniaNeural",
|
55 |
"2M": "en-GB-RyanNeural",
|
|
|
103 |
if target_duration_ms is not None and os.path.exists(audio_path):
|
104 |
audio = AudioSegment.from_mp3(audio_path)
|
105 |
audio_duration_ms = len(audio)
|
106 |
+
#print(f"Generated audio duration: {audio_duration_ms}ms, Target duration: {target_duration_ms}ms") # Debug
|
107 |
|
108 |
if audio_duration_ms > target_duration_ms and target_duration_ms > 0:
|
109 |
speed_factor = (audio_duration_ms / target_duration_ms) * speed_adjustment_factor
|
110 |
+
#print(f"Speed factor (after user adjustment): {speed_factor}") # Debug
|
111 |
if speed_factor > 0:
|
112 |
if speed_factor <1.0:
|
113 |
speed_factor = 1.0
|