开发者

How can I get duration of AudioInputStream?

I want to get duraction of an AudioInputStream (in microseconds). How can I easily do that? I found how can I get duration of an audio file:, but can开发者_开发百科't do that, because of encapsulation. The only object I see is the instance of an AudioInputStream class.


getFrameLength() returns the stream length in frames, getFormat().getFrameRate() will give you the number of frames per second.

long durationInMillis = 1000 * getFrameLength() / getFormat().getFrameRate();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜