0

I am able to record 8 channel mic audio (32bit audio but actual content is 24bit with 8 bit padding) in below format using alsa utils (pcm_read):

t0: channel 0, channel 1, channel 2, ....., channel 8
t1: channel 0, channel 1, channel 2, ....., channel 8
t2: channel 0, channel 1, channel 2, ....., channel 8
.
.
.

I am using below code to convert 32bit audio to 24bit audio but still audio played out is gibberish.

with open("input.raw", "rb") as f:
    x = open("output.raw", "wb")
    while f.read(1) != "":
        byte = f.read(3)
        x.write(byte)
    x.close()

Can anyone give me some pointers if I am doing anything wrong?

user3053970
  • 95
  • 1
  • 10
  • 1) Are you sure you're discarding the right byte? Perhaps it's the last byte of each sample, and not the first? (2) Is `input.raw` one channel of PCM data, or multiple channels interleaved? If it's interleaved, you'll have to account for that in which bytes you discard. – Linuxios Jun 06 '18 at 17:51
  • @Linuxios: let me check again. – user3053970 Jun 07 '18 at 01:05

0 Answers0