我开发的音频播放器的Android。所以我想添加播放的歌曲,即艺术家名称,时间,比特率和采样频率的细节。
我能得到艺术家名字和音乐文件的时间使用 MediaStore.Audio.Media库
。但我无法得到比特率和同一个文件的采样频率。所以,我怎么可以得到相同的?
I am developing audio player in android. So i want to add the details of the playing song i.e. Artist Name, Duration, Bit rate and sampling frequency.
I can get Artist Name and duration of a music file by using MediaStore.Audio.Media library
. But i am unable to get Bit rate and sampling frequency of the same file. So how can i get the same?
据我所知,它可以通过使用本机库完成。但不知道怎么样?所以,任何人都可以帮助我在这?
As i know, it can be done by using native library. But don't know how? So anyone can help me on this?
您可以通过将文件大小在几秒钟内音频的长度,例如,从随机AAC连接codeD M4A在接近它我库:
You can approximate it by dividing the file size by the length of the audio in seconds, for instance, from a random AAC encoded M4A in my library:
File Size: 10.3MB (87013064 bits)
Length: 5:16 (316 Seconds)
Which gives: 87013064 bits / 316 seconds = 273426.147 bits/sec or ~273kbps
Actual Bitrate: 259kbps
由于绝大多数的音频文件都有一组已知的有效比特率的水平,你可以用它来踩比特率的适当水平的显示。
Since most audio files have a known set of valid bitrate levels, you can use that to step the bit rate to the appropriate level for display.