Author Topic: Recognizing MP3 length looks wrong in new version of BASS  (Read 235 times)


  • Posts: 11
Hi all,

I faced with a problem while my application trying to recognize the length of the audio. I find that sometimes the lengths are differs from the stored version of the audio length, which checked by old version of BASS.

We have some applications which based on BASS version and newer applications are based on

I also checked these files in another applications like Ocenaudio, Audacity, Audition 3. Almost every application gives different length for these files.
The interesting thing there is only some milliseconds differences between old and new BASS recognized length (11-12-13ms). The old BASS values are totally the same as Ocenaudio recognizes that, but as i know it's not based on BASS.

Is it possible that the new version of BASS calculates the lengths on a wrong way? As i saw all of the audio which affected are in MP3 format. It doesn't matter if i use the 64bit or 32bit version of BASS, the result is always the same.

The audio file lengths are looks like these (old version/new version) in milliseconds:

I tried to get the audio length on the next way:
Code: [Select]
// Tried with this one too: | BASSFlag.BASS_STREAM_PRESCAN
int createdHandle = Bass.BASS_StreamCreateFile(audioFile, 0, 0, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE);

double length = Math.Round(1000 * Bass.BASS_ChannelBytes2Seconds(createdHandle, Bass.BASS_ChannelGetLength(createdHandle, BASSMode.BASS_POS_BYTES)));

If you need it i can send some files which i found problematic.

I hope someone can help me.

Ian @ un4seen

  • Administrator
  • Posts: 20667
To confirm what the file's length actually is, please try converting it to WAV using the pre-compiled WRITEWAV.EXE example included in the BASS package (C\BIN folder) and then compare the length of that with what BASS_ChannelGetLength says. If it doesn't match, please upload an affected file to have a look at here:

Note if you need to get the exact length (not just an estimate) of an MP3 file, you should include the BASS_STREAM_PRESCAN flag in the BASS_StreamCreateFile call, which tells it to pre-scan the file for the length (and seek points).