Update app.py
Browse files
app.py
CHANGED
@@ -102,8 +102,8 @@ 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 |
-
|
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
|
@@ -113,7 +113,7 @@ async def generate_audio_with_voice_prefix(text_segment, default_voice, rate, pi
|
|
113 |
y, sr = librosa.load(audio_path, sr=None)
|
114 |
y_stretched = librosa.effects.time_stretch(y, rate=speed_factor)
|
115 |
sf.write(audio_path, y_stretched, sr)
|
116 |
-
|
117 |
|
118 |
if audio_duration_ms > target_duration_ms and target_duration_ms > 0:
|
119 |
speed_factor = (audio_duration_ms / target_duration_ms) * speed_adjustment_factor
|
|
|
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 |
+
Offtext = """
|
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
|
|
|
113 |
y, sr = librosa.load(audio_path, sr=None)
|
114 |
y_stretched = librosa.effects.time_stretch(y, rate=speed_factor)
|
115 |
sf.write(audio_path, y_stretched, sr)
|
116 |
+
"""
|
117 |
|
118 |
if audio_duration_ms > target_duration_ms and target_duration_ms > 0:
|
119 |
speed_factor = (audio_duration_ms / target_duration_ms) * speed_adjustment_factor
|