java - 有人可以解释.wav(WAVE)文件头吗?

标签 java audio header byte wav

好的,所以我试图制作一个可以处理.wav文件的程序,并且我已经看到了this question/answers,但是对于标题中的每个数据指的是什么,我并不完全确定。例如,“块”指的是什么?那是特定数量的位/字节吗?

如果有人能至少以本问题中使用的格式告诉我,除了常量String Literals和'data'数组之外,每个引用到.wav的数据还指的是什么?特别是,我特别想知道什么是“块”,以及所有 channel 的采样率,字节率,每个采样的字节和每个采样的字节有何关系?(我怀疑字节速率是采样率*每个采样的字节,但是“针对所有 channel ”呢?)

任何帮助表示赞赏。

最佳答案

仅发布链接是违反董事会规则的,所以这是我从http://www.topherlee.com/software/pcm-tut-wavformat.html中获取的表

Positions   Sample Value         Description
1 - 4       "RIFF"               Marks the file as a riff file. Characters are each 1. byte long.
5 - 8       File size (integer)  Size of the overall file - 8 bytes, in bytes (32-bit integer). Typically, you'd fill this in after creation.
9 -12       "WAVE"               File Type Header. For our purposes, it always equals "WAVE".
13-16       "fmt "               Format chunk marker. Includes trailing null
17-20       16                   Length of format data as listed above
21-22       1                    Type of format (1 is PCM) - 2 byte integer
23-24       2                    Number of Channels - 2 byte integer
25-28       44100                Sample Rate - 32 bit integer. Common values are 44100 (CD), 48000 (DAT). Sample Rate = Number of Samples per second, or Hertz.
29-32       176400               (Sample Rate * BitsPerSample * Channels) / 8.
33-34       4                    (BitsPerSample * Channels) / 8.1 - 8 bit mono2 - 8 bit stereo/16 bit mono4 - 16 bit stereo
35-36       16                   Bits per sample
37-40       "data"               "data" chunk header. Marks the beginning of the data section.
41-44       File size (data)     Size of the data section, i.e. file size - 44 bytes header.

上面给出了16位立体声源的样本值。

更新/提醒

header 整数全都以最低有效字节顺序排列,
因此两个字节 channel 信息0x01 0x00实际上是0x00001,例如单核细胞增多症。

关于java - 有人可以解释.wav(WAVE)文件头吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28137559/

相关文章:

java - Qpid JMS : Receiving Text Message leads to casting exception

c# - 如果现在认为 SOAP 比 REST 设计过度,为什么 WCF 不是?

python - 将Float32格式的数据提取为int32

css - 为什么水平滚动条远远超出了内容?

c++ - Release 中的源文件,Debug 中的头文件

java - 如何从 JAX-WS 类中提取 SOAP 头信息?

java - 无法在 Lucene+Tika 上返回带有重音符号的单词的结果

java - 什么时候在代码中捕获 RuntimeExceptions?

ios - AVAudioPlayer 问题导致应用程序崩溃

android - 用动态文件填充MediaPlayer