bcci commited on
Commit
b452b41
·
verified ·
1 Parent(s): b7b660a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -249,14 +249,17 @@ def tts_full(text: str, voice: str = "af_heart", speed: float = 1.0, format: str
249
  speed=np.ones(1, dtype=np.float32),
250
  ))[0]
251
 
 
 
252
  # Write the concatenated audio to an in-memory WAV or Opus file.
253
  sample_rate = 24000
254
 
255
  # Normalize audio data to the range [-1.0, 1.0]
256
- audio_normalized = audio / np.max(np.abs(audio))
257
 
258
  # Scale to 16-bit integer range
259
- audio_scaled = np.int16(audio_normalized * 32767)
 
260
 
261
  if np.any(audio_scaled < -32768) or np.any(audio_scaled > 32767):
262
  raise ValueError("Scaled audio data is outside the valid range for 16-bit WAV files.")
 
249
  speed=np.ones(1, dtype=np.float32),
250
  ))[0]
251
 
252
+ print(audio)
253
+
254
  # Write the concatenated audio to an in-memory WAV or Opus file.
255
  sample_rate = 24000
256
 
257
  # Normalize audio data to the range [-1.0, 1.0]
258
+ # audio_normalized = audio / np.max(np.abs(audio))
259
 
260
  # Scale to 16-bit integer range
261
+ audio_scaled = np.int16(audio * 32767)
262
+ print(audio_scaled)
263
 
264
  if np.any(audio_scaled < -32768) or np.any(audio_scaled > 32767):
265
  raise ValueError("Scaled audio data is outside the valid range for 16-bit WAV files.")