Sat, 08 Mar 2008
Progress on the Rabbit.
For over three years now, I have been working on (on and off, but mostly off) a new algorithm for doing audio sample rate conversion in Secret Rabbit Code. The idea for the new algorithm has been rattling around in my head for most of that time, but the problem was always the implementation. While I am making progress it has been slow.
However, a public comparison between a large collection of converters showed that while the conversion quality of Secret Rabbit Code was good, it was nowhere near state of the art.
In order to see if I could get Secret Rabbit Code closer to state of the art quickly, I decided to revisit the existing converter during the xmas/new-year break.
The existing converter had a set of digital filters whose coefficients were generated by a small program written in GNU Octave. My first task was to convert that program to Ocaml which has become my favourite language for technical computing. I then spent quite a bit of time finding and analyzing where the filter design program was loosing precision and finding work arounds. Finally, I spent even more time looking at how the different filter design parameters interact with one another and with the conversion algorithm itself.
Fortunately, all this work has paid off. The result is new versions of the SRC_SINC_MEDIUM_QUALITY and SRC_SINC_BEST_QUALITY converters. The old versions of these converters have been renamed to SRC_OLD_SINC_MEDIUM_QUALITY and SRC_OLD_SINC_BEST_QUALITY. The old versions will be removed once the new versions have been fully validated.
So far, the new converters seem to have significantly improved signal to noise ratio as can be seen from the following to spectrograms (using the methodology described here). It should be obvious from these plots that the new versions of the converters have significantly less artifacts (the purple and blue bits) than the old converters.
Obviously, conversion quality is not the only criterion to evaluate sample rate converters; conversion speed can also be important in some situations. In my preliminary testing, the updated Best SINC converter runs up to 25% slower than the old one. The new best converter also uses significantly more memory than the old one. Storage of filter coefficients has gone up by a factor of 20, which is now over a megabyte for best quality converter alone.
In the tables below I've listed the SNR, throughput speeds and bandwidths as measured by the test suite (the snr_bw_test and throughput_test programs) distributed with the code for a couple of different CPU types.
1.1 GHz Intel Pentium M (32 bit) with 2048 KB cache
Converter Name | SNR | Throughput | Bandwidth |
---|---|---|---|
SRC_OLD_SINC_MEDIUM_QUALITY | |||
SRC_SINC_MEDIUM_QUALITY | |||
SRC_OLD_SINC_BEST_QUALITY | |||
SRC_SINC_BEST_QUALITY |
|
1.8 GHz AMD Opteron 265 (64 bit) with 1024 KB cache
Converter Name | SNR | Throughput | Bandwidth |
---|---|---|---|
SRC_OLD_SINC_MEDIUM_QUALITY | |||
SRC_SINC_MEDIUM_QUALITY | |||
SRC_OLD_SINC_BEST_QUALITY | |||
SRC_SINC_BEST_QUALITY |
|
1.86GHz Intel Core Duo (32 bit) with 2048 KB cache
Converter Name | SNR | Throughput | Bandwidth |
---|---|---|---|
SRC_OLD_SINC_MEDIUM_QUALITY | |||
SRC_SINC_MEDIUM_QUALITY | |||
SRC_OLD_SINC_BEST_QUALITY | |||
SRC_SINC_BEST_QUALITY |
|
A pre-release containing these updated converters is available for download here. Once they have been tested a little more widely I intend to replace the old versions of the converters with the new, higher specification ones.
Anybody who wants to discuss this further should join the SRC mailing list and discuss it there.
Finally, once a version of Secret Rabbit Code with these new converters has been officially released I can get back to the new converter algorithm which should at least match the what I have here in terms of quality but run significantly faster and use at least an order of magnitude less RAM.
Posted at: 14:50 | Category: CodeHacking/SecretRabbitCode | Permalink