Linear Resampling for Winamp or Foobar
Aug 25, 2007 at 2:48 PM Thread Starter Post #1 of 74

b0dhi

Headphoneus Supremus
Joined
Oct 12, 2005
Posts
2,070
Likes
23
Does anyone know a linear interpolation resampler for Winamp or Foobar2000?

I found one for Foobar (Secret Rabbit Code), but it crashes when I play FLACs
frown.gif
Any help would be very much appreciated.

Before someone asks, yes, it must be a linear interpolation resampler. I'm running it at 192Khz so essentially I'm using my Juli@'s DAC as a non-oversampling type DAC. Square wave response is excellent, and the music is so much more dynamic. I can't wait to hear FLACs with it...

Thanks in advance for any suggestions.
 
Aug 25, 2007 at 3:21 PM Post #3 of 74
Both Foobar and SRC are the latest versions, I downloaded them today.

It doesn't work when the resampling rate is higher than 96000 (any algorithm), and only when playing FLACs. It works fine for MP3s at any sampling rate.

At 96Khz the CPU usage is only 2% in linear mode, so it can't be lack of grunt.

EDIT: I really have to say I'm amazed at the difference it has made to the sound, I wasn't expecting anything like this. That is...when it isn't crashing
frown.gif
 
Aug 25, 2007 at 5:58 PM Post #5 of 74
In terms of common "distortion" measurements, yes, it's one of the worst. However, because I'm using it to oversample 44.1Khz to 192Khz, the output at the DAC is virtually exactly the same as the music data. The other methods produce only sine waves at higher (10Khz+) frequencies, and what should be square waves are not sharp and have lots of ringing. OTOH, linear interpolation gives you grainy treble because that's exactly what's in the music data, but oh well...

If anyone does find one for Winamp or Foobar please let me know.
 
Aug 26, 2007 at 1:09 PM Post #7 of 74
It's a limitation of the 44.1Khz sampling rate. No matter what the music sounded like originally, at high frequencies all instruments are sampled as jagged edges, and above about 10Khz, as 'triangles'. Most upsampling techniques convert these jagged edges into smooth sine waves, which sounds nice and measures well, but the lower frequencies lose dynamics, texture and timing. The ear can detect timing differences of as little as 2 microseconds.

I've been measuring the output of my soundcard's DAC (Juli@) with various upsampling algorithms at 192Khz. Linear upsampling is by far the most accurate one (in terms of being identical to the input data), but as a side-effect, you have no choice but to hear how poor 44.1Khz sampling is for higher frequencies.

My ideal algorithm would resample a 5Khz square wave with a perfectly sharp edge and no ringing, but a 15Khz wave as a smooth sine wave. None of the algorithms I tried did this.

The real problem is that 44.1Khz sampling is so crap
tongue.gif
 
Aug 26, 2007 at 1:52 PM Post #9 of 74
Quote:

Originally Posted by b0dhi /img/forum/go_quote.gif
It's a limitation of the 44.1Khz sampling rate. No matter what the music sounded like originally, at high frequencies all instruments are sampled as jagged edges, and above about 10Khz, as 'triangles'.


Ie., it doesn't have enough resolution.
 
Aug 26, 2007 at 3:11 PM Post #10 of 74
I found no problem with 44.1kHz, its warmer than higher sampling rate i.e 96kHz (this is as high as my soundcard DAC goes). And even worse, the Linear Interpolator sounds the worse, lacking background detail (muffled) while the Best Sinc Interpolator is a bit bright. Using Secret Rabbit Code. If it sounds OK to you its fine, but not me
 
Aug 26, 2007 at 3:12 PM Post #11 of 74
Quote:

Originally Posted by b0dhi /img/forum/go_quote.gif
Ie., it doesn't have enough resolution.


I don't think that's the case. Maybe I misunderstand what you exactly mean but as far as I understand audio everything regarding frequencies is about sine waves. If you filter frequencies digitally you have to do it in the frequency domain, where everything is represented as sine waves. And even if your digital sample has a perfect square wave in it, your speakers or headphones would not play it as that, because it's impossible for the diaphragm to move in zero time from one position to another.

I may have found a flaw in your assumptions about the linear filtering. Compare it to an image resampler. If you have an image with a square or rectangle in it, you will preserve its sharp edges best with a nearest neighbor filtering algorithm. Therefore you might think that it produces the best quality because a bilinear or bicubic filter produces blurry edges. But take a different shape like a circle or a triangle and you will see distortions that don't occur with more sophisticated filters. So, unless your music only consists of square waves a linear filter will give you the worst overall results.
 
Aug 26, 2007 at 4:51 PM Post #12 of 74
Yes, theoretically all periodic waves can be represented as sine waves. That doesn't mean everything can be represented by sine waves with a frequency less than 22050Hz.

The square wave can only be represented perfectly with an infinite number of sine waves. 44.1Khz simply does not have anywhere near enough resolution to represent a square wave at any frequency accurately. However, using a NOS DAC (or upsampling to 192Khz using linear filtering), you can get excellent square wave response. While a headphone diaphragm can't move instantly, good ones can move very fast - fast enough that the "blurring" around the edges created by Sinc and similar upsampling algorithms is audible.

Again - I realise and admit that it measures poorly - but I'll be damned if it doesn't sound great to me
smily_headphones1.gif
(except the treble sounds harsh...
tongue.gif
)

So yes, enough masticating the fat, back to finding a linear resampler, hmm?
 
Aug 26, 2007 at 11:10 PM Post #13 of 74
Why is square wave response so important to you? I just did some tests as mentioned before. Your are right that a linear resampler will give you upsampled square waves that are as sharp as the original ones whereas other resamplers like SSRC or PPHS (or SRC "best sinc") will produce sine waves that only mimic the former square form. But then I did the test with a sine sweep and noticed heavy artifacts in the whole frequency spectrum.

Now I ask you what's more important: Having perfectly sharp square waves or not having artifacts all over? Also take into consideration that no normal music will have these perfect square waves. Only a digital synthesizer can produce these and the record will only retain them in their perfect state if the signal remains digital during the whole mastering process and if no filters are applied to it. Furthermore I'm pretty sure that professional music isn't produced in 44.1 kHz but in higher rates like 96 kHz or even 192 kHz. So at least at the very end of the production a resampler will be used, and guess what, I don't think it's a linear one. So the chance that you have perfect square waves in your material is near zero.
 
Aug 27, 2007 at 8:13 AM Post #14 of 74
A silly question, Bodhi... Is the resampling plugin set to output in 24/32-bit or only 16? What's the DAC's native sampling mode? 192/24?

What is the F2000's output plugin? KS, ASIO?

And have you tried 24-bit FLAC?
 
Aug 27, 2007 at 8:29 AM Post #15 of 74
Hancoque, what artifacts are you talking about, and what upsampling rate did you use?

Seidhepriest, I appreciate the response. The bit depth in the "Output" menu is set to 16bit. My card is capable of 192Khz/24bit but Foobar doesn't seem to work in 24/32bit mode (works fine in Winamp).

I've tried DS, KS and ASIO, all with the same problem. I wish I had 24bit FLACs to test. I'm thinking of just writing the plugin myself but it's possible that the bug is in Secret Rabbit Code itself. I don't know :/
 

Users who are viewing this thread

Back
Top