Skip to content

Commit 8ad09ee

Browse files
committed
fix(voice): decode PCM16 as little-endian
1 parent 89c02c8 commit 8ad09ee

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/agents/voice/result.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ def _transform_audio_buffer(
104104
# np.int16 needs 2-byte alignment; pad odd-length chunks safely.
105105
combined_buffer += b"\x00"
106106

107-
np_array = np.frombuffer(combined_buffer, dtype=np.int16)
107+
# Provider PCM16 is little-endian regardless of host byte order. Decode it
108+
# explicitly, then normalize to native int16 before exposing it to callers.
109+
np_array = np.frombuffer(combined_buffer, dtype=np.dtype("<i2")).astype(np.int16, copy=False)
108110

109111
if output_dtype == np.int16:
110112
return np_array

0 commit comments

Comments
 (0)