如何计算,而无需使用AudioSystem帧长? [英] How to calculate FrameLength without using AudioSystem?

查看:229
本文介绍了如何计算,而无需使用AudioSystem帧长?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我移植的Java项目到Android。

I'm porting Java project to Android.

如你所知,Android的没有javax.sound包。

As you know, the Android does not have javax.sound package.

我需要计算帧长。

我的声音文件大小为283KB。和帧大小为4,帧率为44100和位示例大小为16。

My sound file size is 283KB. And frame size is 4 and frame rate is 44100 and sample size in bits is 16.

帧长度为69632时,我只是用纯Java。

The frame length was 69632 when I used just pure Java.

你知道的任何公式得到这个?

Do you know any equation to get this?

感谢您。

推荐答案

有关原始PCM数据,基本上,你必须每个样品4个字节。

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

((283 KB)*(每KB 1024字节))/(每帧4字节)==> 72448

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

但WAV可能包含大量除了原始PCM,例如,歌曲名称或歌手的信息。

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

这里了解 wav格式的一些更多的信息。您可能需要加载该文件作为原始字节来解析头部,但头部有一个predictable位置框的大小。

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.

也许别人有Android开发经验已经炮制的方法。
也许谷歌应该把Java作为一个完整的实体,并正确许可并予以实施。

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.

这篇关于如何计算,而无需使用AudioSystem帧长?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆