Spaces:
Paused
Paused
up34
Browse files- __pycache__/app.cpython-312.pyc +0 -0
- app.py +3 -1
__pycache__/app.cpython-312.pyc
CHANGED
Binary files a/__pycache__/app.cpython-312.pyc and b/__pycache__/app.cpython-312.pyc differ
|
|
app.py
CHANGED
@@ -65,8 +65,10 @@ async def websocket_tts(websocket: WebSocket):
|
|
65 |
if data_offset == -1:
|
66 |
raise ValueError("No 'data' chunk found in WAV file")
|
67 |
header_end = data_offset + 8 # 'data' + size (4 bytes)
|
68 |
-
wav_header = wav_data[:header_end]
|
69 |
pcm_data = wav_data[header_end:]
|
|
|
|
|
70 |
# Send header + first PCM chunk
|
71 |
first_chunk = pcm_data[:chunk_size]
|
72 |
audio_b64 = base64.b64encode(wav_header + first_chunk).decode("ascii")
|
|
|
65 |
if data_offset == -1:
|
66 |
raise ValueError("No 'data' chunk found in WAV file")
|
67 |
header_end = data_offset + 8 # 'data' + size (4 bytes)
|
68 |
+
wav_header = bytearray(wav_data[:header_end])
|
69 |
pcm_data = wav_data[header_end:]
|
70 |
+
# Patch header: set data length to 0xFFFFFFFF (unknown/streaming)
|
71 |
+
wav_header[data_offset+4:data_offset+8] = (0xFFFFFFFF).to_bytes(4, 'little')
|
72 |
# Send header + first PCM chunk
|
73 |
first_chunk = pcm_data[:chunk_size]
|
74 |
audio_b64 = base64.b64encode(wav_header + first_chunk).decode("ascii")
|