Author Topic: questions about decoding 24bit audio  (Read 132 times)


  • Posts: 5
questions about decoding 24bit audio
« on: 23 Nov '20 - 16:07 »
Hi all,

I am testing BASS for decoding 24bit FLACs. I think it is working but I want to ensure I am doing the right thing

I have noticed that Bass has decoded 2 bytes per channel sample. Is BASS converting the stream from 24 bit to 16bits automatically?

In that case, for a stereo file, BASS_ChannelGetData would work the same way for 16 or 24 bit ?
Code: [Select]
    int c = BASS_ChannelGetData(chan, stereoData, numBytes*2|BASS_DATA_FLOAT);
Thanks everybody!

PS: BASS is so great :-)


Ian @ un4seen

  • Administrator
  • Posts: 23311
Re: questions about decoding 24bit audio
« Reply #1 on: 24 Nov '20 - 14:47 »
By default, BASS/BASSFLAC will indeed convert a 24-bit file's data to 16-bit. You can prevent that happening by using the BASS_SAMPLE_FLOAT flag when creating the stream, eg. in a BASS_StreamCreateFile call.

Note using the BASS_DATA_FLOAT flag with BASS_ChannelGetData won't be enough to retain 24-bit quality. The file's data will have already been converted to 16-bit by the FLAC decoder at that point (if the BASS_SAMPLE_FLOAT flag wasn't used).