Author Topic: How to stop BASS_ChannelGetData clipping at 1  (Read 378 times)

stevenmmm

  • Posts: 131
According to the documentation BASS_ChannelGetData doesnt clip the results, but when testing against files that i know have a peak above 1 (using foobar) the peak never exceeds 1. The peak is accurate when it is < 1.
Is there some extra step I am missing?

BASS_STREAM_DECODE = &H200000
BASS_SAMPLE_FLOAT = &H100
BASS_DATA_FLOAT = &H40000000
handle = BASS_StreamCreateFile(False, filename, 0, 0, BASSFlag.BASS_STREAM_DECODE Or BASSFlag.BASS_SAMPLE_FLOAT)
While Bass.BASS_ChannelIsActive(handle) <> BASSActive.BASS_ACTIVE_STOPPED
    BASS_ChannelGetData(handle, buffer, (65536 Or BASSData.BASS_DATA_FLOAT)

Ian @ un4seen

  • Administrator
  • Posts: 25612
Re: How to stop BASS_ChannelGetData clipping at 1
« Reply #1 on: 26 Oct '23 - 12:48 »
You don't need the BASS_DATA_FLOAT flag in the BASS_ChannelGetData call if the stream is already floating-point (BASS_SAMPLE_FLOAT), but it won't do any harm. Please upload a file that you're having the problem with to have a look at here:

   ftp.un4seen.com/incoming/

stevenmmm

  • Posts: 131
Re: How to stop BASS_ChannelGetData clipping at 1
« Reply #2 on: 26 Oct '23 - 21:23 »
I found the reason. I happens when the default windows decoder is used for aac files. Using bass_aac solves the problem.