Skip to content

Commit 294c949

Browse files
committed
Fix for conversion of 8-bit audio
1 parent e61742f commit 294c949

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

wyoming/audio.py

+4
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,11 @@ def convert(self, chunk: AudioChunk) -> AudioChunk:
163163

164164
if (self.width is not None) and (chunk.width != self.width):
165165
# Convert sample width
166+
if chunk.width == 1:
167+
audio_bytes = audioop.bias(audio_bytes, 1, -128)
166168
audio_bytes = audioop.lin2lin(audio_bytes, chunk.width, self.width)
169+
if self.width == 1:
170+
audio_bytes = audioop.bias(audio_bytes, 1, 128)
167171
width = self.width
168172

169173
channels = chunk.channels

0 commit comments

Comments
 (0)