0
0

How to find the bitrate of a mp3 file with fmod (VBR and CBR)?

  • You must to post comments
0
0

You may use FMOD_Sound_GetLength (FMOD_TIMEUNIT_RAWBYTES / FMOD_TIMEUNIT_MS * 8000)

  • You must to post comments
0
0

Tanks, i’ll try! 😉

  • You must to post comments
0
0

This works! Now, that means 8000?

Thanks.

  • You must to post comments
0
0

think it was
8 for rawBYTES to rawbit
and
1000 for MS to Seconds (to reverse the effect of dividing through MS / 1000)
thus making Bps (bytes per second)

for KBps, multiply with 8 instead of 8000

  • You must to post comments
0
0

In a loop:

[code:i7y1u09q]uint posMs = 0;
uint posBit = 0;
uint diffBits = 0;
uint difTime = 0;
uint bitRate = 0;

pChannel.getPosition(ref posMs, FMOD.TIMEUNIT.MS);

if (count_bitrateCycles > 8)
{
pChannel.getPosition(ref posBit, FMOD.TIMEUNIT.RAWBYTES);

diffBits = posBit - position_lastPCMbytes;
difTime = posMs - position_lastMs;
bitRate = diffBits / difTime * 8;

position_lastPCMbytes = posBit;
position_lastMs = posMs;
count_bitrateCycles = 0;

}
pOsd.osd_update_time(posMs, bitRate);

count_bitrateCycles++;
if (player_state != PlayerState.play)
{
position_lastPCMbytes = 0;
position_lastMs = 0;
count_bitrateCycles = 0;
}[/code:i7y1u09q]

Testing with an mp3 file of 192kbps CBR this varies between 170 and 192kbps. The idea is to get the results periodically like does winamp.

Why not shows 192kbps fixed?

I tried taking the sample RAWBYTES before the TIMEUNIT.MS and still equal.

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.