Skip to content

Commit

Permalink
Fix for conversion of 8-bit audio
Browse files Browse the repository at this point in the history
  • Loading branch information
Schevv committed Jul 31, 2024
1 parent e61742f commit 294c949
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wyoming/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ def convert(self, chunk: AudioChunk) -> AudioChunk:

if (self.width is not None) and (chunk.width != self.width):
# Convert sample width
if chunk.width == 1:
audio_bytes = audioop.bias(audio_bytes, 1, -128)
audio_bytes = audioop.lin2lin(audio_bytes, chunk.width, self.width)
if self.width == 1:
audio_bytes = audioop.bias(audio_bytes, 1, 128)
width = self.width

channels = chunk.channels
Expand Down

0 comments on commit 294c949

Please sign in to comment.