[Tremor] Resampling while decoding

Martin Vilcans mvilcans at digital-legends.com
Tue Jun 20 08:27:45 PDT 2006


Michael Smith wrote:
> On 6/16/06, Martin Vilcans <mvilcans at digital-legends.com> wrote:
>> Hi list,
>>
>> I'm developing a game that will use Tremor for decoding Vorbis and got
>> this idea about supporting different sample rates. We'll have to support
>> several different sample rates but the Vorbis streams are at a fixed
>> frequency. We can resample the decoded samples in realtime, but I'm
>> wondering if there is a more efficient way to play back a Vorbis stream
>> at a specific sampling rate. I suspect that there might be some
>> efficient way to resample while decoding, but this might be just because
>> I don't know much of how a Vorbis stream is constructed.
>>
>> Also, perhaps it's possible to increase quality without sacrificing
>> speed. For example, if the Vorbis stream uses a rate of 44 kHz, but the
>> playback rate is 22 kHz, we'd normally decode the stream, apply a
>> high-pass filter to remove frequencies above the Nyqvist frequency and
>> resample by averaging every two samples. Instead, perhaps the decoder
>> can simply not decode the upper half of the frequency spectrum (the
>> 11-22 kHz band). That would give the same effect as applying a low-pass
>> filter to the decoded samples. Then we can do a quick resample by simply
>> removing every other sample.
>
> libvorbisfile has a way of decoding at half-rate, you could use that.
> I'm not sure if the version of vorbisfile in tremor includes that, but
> I'd imagine you could port the halfrate bits across to tremor if not.
>
> This doesn't help with doing arbitrary other sampling rates, though -
> for that, you will indeed need a resampler.
>
> Mike (a some-time vorbis hacker, also in Barcelona)
Thanks, I found that function in libvorbis (it's in the release notes, 
but not in the documentation). Unfortunately it's not available in 
Tremor. But as you're saying it can only be used to resample to half the 
frequency. Actually, that might be enough. We currently we don't know 
the specs of the hardware we'll support, so it's hard to say.

(Funny that you're in BCN as well. I guess you're a foreigner too?)


-- 
Martin Vilcans
Lead Programmer
mvilcans at digital-legends.com

Digital Legends Entertainment
C/ Aribau 112, 5-1
08036 Barcelona (Spain)
Tel : +34 93 394 17 77
Fax: +34 93 451 19 80
www.digital-legends.com <http://www.digital-legends.com>



More information about the Tremor mailing list