[LAU] Input to aplay to make a file instead?

Gerhard Zintel gerhard.zintel at web.de
Sun Apr 19 00:39:53 CEST 2020


Hi John,

On 18/04/2020 12:05, John Murphy wrote:
> If I simply '>' the input, which was going to aplay, to a file, it's
> done in a flash. Unplayable, but the file contains data. Could I write
> a header first somehow? Or a container format would be OK.

there are for sure "correct" ways to do it. If you want to use pure bash magic here you are:
Header of a wave file contains 44 byte. To extract it to a file use:

head -c 44 original.wav > header.bin

Now you can use your file from above (let's call it part.raw) and use:

cat header.bin part.raw > newname.wav

You should be able to play the new file. Be aware that the header is correct except for the length information. You might fix this with
wavfix (https://github.com/agfline/wavfix). Furthermore if your parts are not cut at a sample boundary (e.g. a normal wav file is stereo 16
bit per channel thus 4 byte per sample) you will get noise.

Gerhard


More information about the Linux-audio-user mailing list