[Flac-dev] FlacPak
Josh Green
jgreen at users.sourceforge.net
Thu Nov 20 01:58:03 PST 2003
On Thu, 2003-11-20 at 00:01, Curt Sampson wrote:
> On Wed, 19 Nov 2003, Josh Green wrote:
>
> > I am curious though how one would get around the problems of looping
> > with a lossy algorithm. When decoding a vorbis stream would one have
> > the same number of samples as you encoded? The problem with looping
> > arises if the loop points aren't the same sample values, resulting in
> > a click. Some sort of algorithm could be run around the loop points to
> > get them to align again, but I wouldn't know the best way to do that,
> > yet.
>
> I'd think that there is no reliable way to do that unless the lossy
> algorithm is not very lossy at all, since if the waveform changes
> enough, the loop points may be nowhere near where they were originally,
> and the loop may not even be the same length.
>
> Well, there is a reliable way: re-loop by hand, which is how any
> particularly difficult sound was originally looped anyway. But I doubt
> that every person unpacking the file wants to do that. I suppose you
> could compress, decompress, loop the decompressed sample, and then put
> those loop points back into the compressed file....
>
> cjs
Manual looping is not an option with instrument patches, since there can
be several thousands of audio clips in a single instrument file. The
only way I can see how to try and retain loops with lossy compression,
would be if the compression algorithm had the following properties:
- Same number of sample points out as put in
- No time offset introduced (which would screw up the loop positions)
If those 2 things could be ensured, then an algorithm could be run on
the decompressed audio around the start and end loop points. This
algorithm would coerce the sample amplitudes to be the same (the effect
would increase as it nears the start/end point). Or perhaps the area
around the loop points could be saved in a lossless manner, and the
lossy compressed audio coerced around them, that might be even better.
I'm sure someone has thought of this before, I wonder how Fruity Loops
does it, or do they allow loops within a sample for vorbis compressed
audio? For now though, I'm not going to dwell on it too much :) Cheers.
Josh Green
More information about the Flac-dev
mailing list