Skip to content Skip to sidebar Skip to footer

How To Calculate Framelength Without Using Audiosystem?

I'm porting Java project to Android. As you know, the Android does not have javax.sound package. I need to calculate frameLength. My sound file size is 283KB. And frame size is 4

Solution 1:

For the raw PCM data, basically, you have 4 bytes per sample.

((283 KB) * (1024 bytes per KB)) / (4 bytes per frame) ==> 72448

But a wav can include a lot besides the raw PCM, e.g., song title or artist info.

Here's some more info about wav format. You might have to load the file as raw bytes to parse the header, but the header has the frame size in a predictable location.

Maybe someone else with Android experience has already concocted a method. Maybe Google should treat Java as an intact entity and properly license and implement it.

Post a Comment for "How To Calculate Framelength Without Using Audiosystem?"