[Flac] Re: Welcome to the "Flac" mailing list
Brian Willoughby
brianw at sounds.wa.com
Fri Nov 2 22:18:50 PDT 2007
Yes, that solution is completely valid. It works for both WAV and
AIFF files which (illegally) have an odd size. Both RIFF (wav) and
IFF (aiff) share the requirement that all blocks take up an even
number of bytes in the file, even if the data content itself is odd.
The specification states that all chunks with odd sizes must be
padded. Some software erroneously leaves the last chunk in a file
unpadded. Your solution works because it fits this special case -
and it works without modifying the chunk sizes because they are
supposed to be odd when the actual data is odd, but the chunk should
still take up an even number of bytes in the file.
This same technique will not work in any other situation, such as
adding two bytes or removing two bytes, because in these cases the
chunk sizes would need to be modified.
I'm pretty sure you can continue to use your 'sfoddfix' script for
both WAV and AIFF files which have the error of a missing pad byte.
I typically run 'ls -l' and look for odd file sizes whenever I see
FLAC errors. I have a C program which does the same thing as your
script, and it works every time.
Brian Willoughby
Sound Consulting
On Nov 2, 2007, at 20:21, Dat Head wrote:
that's why i asked the original poster if the files were odd size, i
had that issue
before with a 24 bit mono file and wrote this script to fix it:
#!/bin/sh
#
# sfoddfix - Sound File ODD size FIXer
#
# NOTE: flac v1.1.2 pukes on files that have an odd byte count, this
pads them
files=${*:-*.wav}
for file in $files
do
size=$(stat --printf='%s' $file)
if [ $(($size%2)) -ne 0 ]; then
echo "size=$size"
echo "echo -e \"\\0377\\c\" >> $file"
echo -e "\0377\c" >> $file
fi
done
More information about the Flac
mailing list