0

I am trying to load an audio file (via PySoundFile) and have it return a buffer of bytes. But current dtype's are ['float32', 'float64', 'int16', 'int32']

I need it as bytes to use with pocketsphinx: decoder.process_raw

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Shamoon
  • 41,293
  • 91
  • 306
  • 570

1 Answers1

0
audio_data = self.SOUND_FILE.read(sample_frames, dtype='int16')
audio_bytes = audio_data.tobytes()
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Shamoon
  • 41,293
  • 91
  • 306
  • 570