Java 帧率与采样率
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19589496/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
frame rate vs sample rate
提问by wendy0402
What is the difference between sample rate and frame rate? I tried to check a song and found sample rate and frame rate using java.They have same value, It makes me confuse.
采样率和帧率有什么区别?我试图检查一首歌,发现使用 java 的采样率和帧率。它们具有相同的值,这让我感到困惑。
doesn't frame consist of many sample?
框架不是由很多样本组成吗?
thank you
谢谢你
采纳答案by msam
read the documentation
阅读文档
Sample rate = number of samples / second
采样率=采样数/秒
Frame = 1 sample from each channel (PCM)
帧 = 每个通道的 1 个样本 (PCM)
Frame Size = Sample size * Channels
帧大小 = 样本大小 * 通道
Frame Rate = frames / second.
帧率 = 帧/秒。
For PCM the sample rate and the frame rate are the same since a frame consists of a a sample from each channel
对于 PCM,采样率和帧率相同,因为一帧由来自每个通道的采样组成
回答by greg-449
From: http://www.jsresources.org/faq_audio.html#frame_rate
来自:http: //www.jsresources.org/faq_audio.html#frame_rate
For PCM, A-law and μ-law data, a frame is all data that belongs to one sampling intervall. This means that the frame rate is the same as the sample rate.
For compressed formats like Ogg Vorbis, mp3 and GSM 06.10, the situation is different. A frame is a block of data as it is output by the encoder. Often, these blocks contain the information for several sampling intervalls. For instance, a mp3 frame represents about 24 ms. So the frame rate is about 40 Hz. However, the sample rate of the original is preserved even inside the frames and is correctly restored after decoding.
对于 PCM、A-law 和 μ-law 数据,一帧是属于一个采样间隔的所有数据。这意味着帧率与采样率相同。
对于像 Ogg Vorbis、mp3 和 GSM 06.10 这样的压缩格式,情况就不同了。帧是由编码器输出的数据块。通常,这些块包含几个采样间隔的信息。例如,一个 mp3 帧代表大约 24 毫秒。所以帧率大约是 40Hz。然而,即使在帧内,原始的采样率也会保留,并在解码后正确恢复。
回答by Chepe Questn
Viewing the Java Code javax.sound.sampled.AudioFormat.java
line 252
:
查看 Java 代码javax.sound.sampled.AudioFormat.java
行252
:
frameSize
((sampleSizeInBits + 7) / 8) * channels
When is Different to http://soundfile.sapp.org/doc/WaveFormat/
何时与http://soundfile.sapp.org/doc/WaveFormat/不同
BlockAlign == NumChannels * BitsPerSample/8
I can't understand Why use + 7
.
我不明白为什么使用+ 7
.