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.
One further remark. The wave header has two length information at byte offset 5 and 41
(see
). You can use dd like
described
here (
) to
patch
the created file newname.wav afterwards to inject the correct length information.
The length information has to be in binary representation. You could use the method
described here
(
)
to get the 4 byte representation of file newname.wav
A lot of shell magic but it seems to work.