关于 Java Sound API 的采样率和帧速率大小的问题
我继承了一些使用Java的SourceDataLine Sound API的代码。
下面是他们如何设置 AudioFormat 对象。帧速率和采样率设置为相同似乎很奇怪。这有什么意义吗?另外,拥有 20000000 帧速率或采样率有什么意义吗?我们的耳朵不是最高可达20000吗?
AudioFormat af = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 20000000, 16, 1, 2, 20000000, true);
I inherited some code that uses Java's SourceDataLine Sound API.
Below is how they setup the AudioFormat object. It seems strange that the frame-rate and sample-rate were set to be the same. Does that make any sense? Also, is there any point to have a 20000000 frame rate or sample rate? Don't our ears top out at like 20000?
AudioFormat af = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 20000000, 16, 1, 2, 20000000, true);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果流以 PCM 格式编码且未压缩,则一帧包含每个通道的一个时间索引的样本。如果流被压缩,则一帧包含每个通道的样本,但针对一个或多个时间索引。帧的具体结构取决于压缩类型。
查看 AudioFormat 类定义以了解更多详细信息:
http://download.oracle.com/javase /6/docs/api/javax/sound/sampled/AudioFormat.html
大多数声音系统认为人耳的最高频率为 22KHz,这就是为什么您得到的采样频率为 44KHz(根据 Niquist 规则)。
If the stream is encoded in PCM format and is not compressed, a frame contains the samples for each channel, for one time index. If the stream is compressed, a frame contains the samples for each channel, but for one or more time indexes. The exact structure of the frame depends on the compression type.
Check out AudioFormat class definition for more details:
http://download.oracle.com/javase/6/docs/api/javax/sound/sampled/AudioFormat.html
Most sound systems consider the top frequency for the human ear 22KHz, that's why you get the sampling frequency 44KHz (according to the Niquist rule).