Re: Music decompression and resampling
- From: "cr88192" <cr88192@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 19 Apr 2006 05:43:22 +1000
"Stefan Monnier" <monnier@xxxxxxxxxxxxxxxx> wrote in message
news:jwvlku4m9y2.fsf-monnier+comp.compression@xxxxxxxxxx
dunno, not having tried it.Faced with the need to resample (from 44.1 to 48 KHz) some music thatI doubt it personally.
I have in lossy compressed form (Ogg and MP3 in this case), I started to
wonder whether it wouldn't be better to do the resampling as part of the
decompression rather than as a separate step.
also, you are doing upsampling, which is fairly easy to implement and
fairly
cheap using linear interpolation.
Linear interpolation from 44.1 to 48KHz results is really poor
sound quality. And I'm not anal-retentive about my sound quality (I use
a crappy old $100 stereo with a $10 USB soundcard and the aliasing
introduced by linear upsampling is very noticeable).
in my case I had usually gotten acceptable results, eg, using linear
interpolation between, eg, 8kHz and 11kHz...
then again, in my case I often wasn't worrying too much about quality (in
these cases often introducing much more destructive algos as well...).
"Stefan Monnier" <monnier@xxxxxxxxxxxxxxxx> wrote in message
news:jwvfykcm9p1.fsf-monnier+comp.compression@xxxxxxxxxx
ok, in that case, the changes needed for fixed point are fairly minor (I hadnow, I am using floats, but this is not a big deal anymore (floats are
fast enough, the gains of fixed point likely being fairly minor here).
I'm decompressing&resampling on an embedded 125MHz MIPS processor without
FPU support, where the difference is very noticeable (the standard Vorbis
decompressor cannot do the job in real-time, whereas the Tremor
decompressor
that uses fixed-point only needs 40% CPU to keep up).
just assumed here you were working on a typical desktop processor, so
yeah...).
looking around, seems like most of the links for interpolation lead to
highly mathy answers (as it was for prediction), so I am lazy and more
likely to beat against the problem manually. the problem though I think is
making the interpolator "fast enough" when going above linear interpolation.
trial and error, got a working-seeming quadratic interpolator:
x=0.25;
k=(c-(2*b-a));
f=(0.125*(1.0-4*(x-0.5)*(x-0.5)));
g=b*(1-x) + c*x - k*f;
for samples a, b, and c, where:
x is a value between b and c;
k is a linear error for predicting c;
f is a curve effecting the weight of k in the result (note, the 0.125 was
trial and errored out as well, and may have something to do with "slope" for
all I know, then again, it may be a constant, the actual slope being
contained entirely in k);
g is the prediction (a modified linear prediction, f*k gives the predicted
error).
cubic could be similar, but maybe more complex, I don't know...
a guess: the cubic variety (a, b, c, d, between b and c) would likely
consist of adding another linear predictor going backwards (predicting b
from c and d), and offsetting by another error, but I don't know here...
Stefan
.
- References:
- Music decompression and resampling
- From: Stefan Monnier
- Re: Music decompression and resampling
- From: cr88192
- Re: Music decompression and resampling
- From: Stefan Monnier
- Music decompression and resampling
- Prev by Date: Re: Please, PLEASE, hold your questions/comments/elsewhat til the end. Thank you. :)
- Next by Date: Re: Generation of first context for a code block in JPEG2000 MQ-Decoder
- Previous by thread: Re: Music decompression and resampling
- Next by thread: Re: Music decompression and resampling
- Index(es):
Relevant Pages
|