yasserrmd commited on
Commit
59ab165
·
verified ·
1 Parent(s): ef1844a

Update generate_audio_edgetts.py

Browse files
Files changed (1) hide show
  1. generate_audio_edgetts.py +2 -1
generate_audio_edgetts.py CHANGED
@@ -49,7 +49,8 @@ class EdgeTTSGenerator:
49
  communicator = edge_tts.Communicate(text, voice_name)
50
  audio_bytes = b""
51
  async for chunk in communicator.stream():
52
- audio_bytes += chunk
 
53
  return audio_bytes
54
 
55
  def save_audio(self, audio_data):
 
49
  communicator = edge_tts.Communicate(text, voice_name)
50
  audio_bytes = b""
51
  async for chunk in communicator.stream():
52
+ if "data" in chunk: # Check if 'data' exists in chunk
53
+ audio_bytes += chunk["data"] # Concatenate only the audio data
54
  return audio_bytes
55
 
56
  def save_audio(self, audio_data):