[Flac] Re: Welcome to the "Flac" mailing list

Dat Head dathead2 at gmail.com
Fri Nov 2 20:21:21 PDT 2007


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


On 11/2/07, Brian Willoughby <brianw at sounds.wa.com> wrote:
> That's a handy command, but I'm certain it won't work 100% for the
> file in question.  The chunks in that bad file claim the extra two
> bytes are part of the file, so a wav format parser could come up
> short.  You have to edit existing data in the file in two places
> before shortening the file - truncating the file is not enough by
> itself.
>
> The real problem is that the file was stereo, but had an odd number
> of samples.  When FLAC complains about a "partial sample" it means
> there is a left channel sample without a right channel sample to go
> with it - a better term might be "partial frame" if you define a
> sample frame as a group of samples for every channel.  The fixed file
> created by SoundForge either dropped the last sample from the left
> channel, or added a zero sample to complete the right channel.
>
> The long explanation that I gave yesterday, although accurate in
> itself, did not precisely apply to the bad file in question.
>
> Brian Willoughby
> Sound Consulting
>
>
> On Nov 2, 2007, at 12:39, Dat Head wrote:
>
> dd if=$file ibs=1 count=$(($(stat --printf='%s' $file)-2)) of=$file.new
>
> of course if you run this on one of the files that doesn't have the
> extra 2 bytes
> you're gonna lose something you didn't want to
>
> On 11/1/07, Alex Brims <alex.brims at gmail.com> wrote:
> > Ok, we actually worked this out - there were 2 extra bytes doing
> > nothing at
> > the end of the files.  Opening the file in SoundForge and saving it
> > (without
> > changing it) took off the extra bytes and allowed the file to
> > convert to
> > FLAC.
> >
> > Thanks to everyone who emailed me suggestions.
> >
> > Is there a decent program for linux that could automatically take
> > these
> > bytes off, without running the risk of removing good data?  Or is
> > there a
> > way to get the flac converter to ignore this error and create the
> > file?  I'm
> > running flac 1.2.1 on Red Hat Enterprise Linux ES release 4.


More information about the Flac mailing list