Re: Input to aplay to make a file instead?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Sat, Apr 18, 2020 at 5:49 PM Gerhard Zintel <gerhard.zintel@xxxxxx> wrote:

One further remark. The wave header has two length information at byte offset 5 and 41
(see http://www.topherlee.com/software/pcm-tut-wavformat.html). You can use dd like described
here (https://unix.stackexchange.com/questions/214820/patching-a-binary-with-dd) to patch
the created file newname.wav afterwards to inject the correct length information.

being pedantic just for the sake of it ....

WAV is a subformat of the RIFF file format, which uses a set of "chunks" with a 4 byte ID and a 4 byte length for each chunk.

Although it is conventional for the various chunks to come in a fairly standard order (RIFF .. WAV .. FMT), nothing about the standard requires this, and the correct way to parse any RIFF file (and hence any WAV file) is chunk by chunk. Making assumptions about byte offsets will work in the majority of cases, but will break in some.

In addition, the length information at byte 5 (which actually is constant, since that's the outermost RIFF chunk, is the length of the entire file, not the WAV data length.

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
https://lists.linuxaudio.org/listinfo/linux-audio-user

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux