Skip to main content

Topic: Resampler plugin (Read 305840 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • lvqcl
  • [*][*][*][*][*]
  • Developer
Resampler plugin
Reply #350
After resampling is done SOX rounds the result back to 16 bits (in the current implementation of foobar filter).


It doesn't: it receives 32-bit float and outputs 32-bit float. Then fb2k output plugin reduces bit depth if necessary.

  • xnor
  • [*][*][*][*][*]
  • Developer
Resampler plugin
Reply #351
I don't agree. [..] Then you suggest to change it back to 32 bits using the output filter. There you go: you have your quantization errors.

This is not a matter of (dis)agreement though. The internal format is 32 bit floating point in foobar2000 and plugins usually receive, process* and output 32 bit data except for some output plugins.
*) Processing is sometimes done using 64 bit floating point.

As I said, quantization is done as late as possible in order to not introduce unnecessary errors.

Quote
ASIO will output the stream going out of the player directly. In this case 16 bits. No way to change it.

The ASIO output plugin should choose the highest available bit depth (32 bit floating point or signed integer if available, if not 24 bit signed integer and so on..).
"I hear it when I see it."

  • tedsmith
  • [*][*][*]
Resampler plugin
Reply #352
After resampling is done SOX rounds the result back to 16 bits (in the current implementation of foobar filter).
...
ASIO will output the stream going out of the player directly. In this case 16 bits. No way to change it.
And if you don't believe the author of the plugin, using your example of resampling 44.1/16 to 88.2 via ASIO my DAC reports 88.2/24 bits: i.e. the low bits are changing.

  • Sober5
  • [*]
Resampler plugin
Reply #353
Ok, ok! Thanks for the additional info!

However, my previous DAC reported 16 bits when played via foobar even though it supported 24 bits (in all modes: KS, ASIO, wasapi). I didn't use any plugins at that time. And with no plugins (and not using volume control), 16 bit output was indeed the best option.

Unfortunately, my new DAC doesn't report anything, so I assumed ASIO feeds it also with 16 bits. I'll try to find a way to check what bit depth is on the output (analyze USB traffic?). Maybe when a plugin is enabled the output switches automatically to higher bit depth?

  • xnor
  • [*][*][*][*][*]
  • Developer
Resampler plugin
Reply #354
Without plugins you're automatically using Direct Sound. The format is configured in the Windows sound control panel (right click sound tray icon -> playback devices) -> properties of the playback device -> advanced -> default format.

If you resample to 96 kHz for example you should set this to a format with matching sampling rate, for example to "24 bit, 96000 Hz". That way the Windows audio engine will not resample (again).
  • Last Edit: 19 November, 2013, 11:56:30 AM by xnor
"I hear it when I see it."

  • Sober5
  • [*]
Resampler plugin
Reply #355
"Without plugins" I ment without DSP plugins. As I said, the output was set to either KS, ASIO, wasapi. All gave 16 bits on output for 16 bit files.
  • Last Edit: 19 November, 2013, 12:03:24 PM by Sober5

  • xnor
  • [*][*][*][*][*]
  • Developer
Resampler plugin
Reply #356
"Without plugins" I ment without DSP plugins. As I said, the output was set to either KS, ASIO, wasapi. All gave 16 bits on output for 16 bit files.


KS and WASAPI plugins allow you to set the output bit depth. If you set it to 16 bit it's going to be 16 bit.
ASIO, as I said before, should choose the highest supported bit depth automatically.
"I hear it when I see it."

  • Sober5
  • [*]
Resampler plugin
Reply #357
KS and WASAPI plugins allow you to set the output bit depth. If you set it to 16 bit it's going to be 16 bit.


That for sure, when set to 16 bit it will output 16 bit. However KS when set to 24 bit worked for me based on the input file bit depth. For 16 bit files: 16 bit, for 24 bit files: 24 bit. That's fine as this plugin is ment to give you bit-perfect playback. I will try to find a way how to verify if this is the same when DSP plugin is enabled and get back to you. I'm thinking of trying http://www.usblyzer.com/ ...
  • Last Edit: 19 November, 2013, 06:23:45 PM by Sober5

  • tedsmith
  • [*][*][*]
Resampler plugin
Reply #358
I will try to find a way how to verify if this is the same when DSP plugin is enabled and get back to you.  I'm thinking of trying http://www.usblyzer.com/
FWIW On my system using KS and a 44.1/16 track I see 16 bits changing at the DAC, when resampling to 88.2 I see 24 bits changing at 88.2k at the DAC.
When I tried USBlyzer (for another reason) I was annoyed that the only USB audio decoders they support are for USB Audio 1.0.  But raw packets should be find for your purpose.

  • Sober5
  • [*]
Resampler plugin
Reply #359
Thanks! So it seems the output plugins are intelligent as I hoped them to be

  • Zippy7
  • [*]
Resampler plugin
Reply #360
@lvqcl: With the normal version of the SoX resampler v0.83, when the target sample rate is 192kHz, and the playback file is 192kHz, is the SoX resampler's output bit-exact with the SoX resampler's input?  I am not concerned with a buffering delay, only quantization errors.

  • lvqcl
  • [*][*][*][*][*]
  • Developer
Resampler plugin
Reply #361
when the target sample rate is 192kHz, and the playback file is 192kHz

There's no processing, no buffering, nothing.

Also, you can compare input and output files with foo_bitcompare plugin.

  • Zippy7
  • [*]
Resampler plugin
Reply #362
Thanks lvqcl.  Well done!

I have a feature request for increased flexibility.  My external DAC supports a maximum sample rate of 192 kHz.  I would like to upsample 44k & 48k by a factor of 4, 88k & 96k by a factor of 2, and not convert 176k & 192k.  I tried your SoX resampler v0.8.3 mod2 and configured it to upsample by 4 only 44k, 48k, 88k & 96k.  foobar2000 then threw an error for 88k & 96k because my output device does not support the 4X sample rate.  I see two ways to solve this:
a) SoX resampler recognizes the maximum supported sample rate of the output device and reduces the upsample factor from 4 to 2 to 1 as needed.
b) The mod2 version uses a semicolon-separated list of I/O sample rates to convert.  My example would be 44100;176400;48000;192000;88200;176200;96000;192000

  • xnor
  • [*][*][*][*][*]
  • Developer
Resampler plugin
Reply #363
Why don't you just only resample 88.2 kHz or 96 kHz by 2x, and with another instance resample only 44.1 kHz or 48 kHz by 4x?
  • Last Edit: 24 November, 2013, 04:13:40 PM by xnor
"I hear it when I see it."

  • Glenda
  • [*][*]
Resampler plugin
Reply #364
Is there any way to use insert command lines like this which has can allow the use of Foobar to replace the digital filter of a DAC:

rate -v -M -b 87.5 38200 dither -S



Why wouldn't the sox plugin accept SOX command lines,  should be the easiest thing to implement into foobar.  I guess we are all just waiting on a 64 bit Foobar at this point anway.

  • xnor
  • [*][*][*][*][*]
  • Developer
Resampler plugin
Reply #365
rate -v -M -b 87.5 38200 dither -S
Why wouldn't the sox plugin accept SOX command lines,  should be the easiest thing to implement into foobar.  I guess we are all just waiting on a 64 bit Foobar at this point anway.


I don't think that makes sense, since this plugin only does resampling (rate effect) and nothing else.

-v = very high quality = "Best" in the plugin
-M = minimum phase = 0% phase response in the plugin
-b = bandwidth ... closest you can get with the plugin is 90%, maybe this can be decreased to 80% in an update (or the lowest sox allows)?
  • Last Edit: 25 November, 2013, 10:40:03 AM by xnor
"I hear it when I see it."

  • lvqcl
  • [*][*][*][*][*]
  • Developer
Resampler plugin
Reply #366
Why wouldn't the sox plugin accept SOX command lines

It's not a SoX plugin, it contains only resampling routines from SoX utility and nothing else.

should be the easiest thing to implement into foobar.

O rly? 

  • Zippy7
  • [*]
Resampler plugin
Reply #367
Why don't you just only resample 88.2 kHz or 96 kHz by 2x, and with another instance resample only 44.1 kHz or 48 kHz by 4x?

@xnor: Thanks for the clever idea.  I tried your idea, and it worked.

@lvqcl: I hope you will keep my ideas in mind for your next update.  Would be nice to achieve more flexibility with just one instance.

  • Glenda
  • [*][*]
Resampler plugin
Reply #368
Is there any way to use insert command lines like this which has can allow the use of Foobar to replace the digital filter of a DAC:

rate -v -M -b 87.5 38200 dither -S



Why wouldn't the sox plugin accept SOX command lines,  should be the easiest thing to implement into foobar.  I guess we are all just waiting on a 64 bit Foobar at this point anway.



Should be but isn't, the foobar plugin is about as watered down about bad as some mac app from the 90's. 

Foobar severely needs a good resampler like Syngalist or the mac program that comes with the Izotope 64bit SRC,  but I guess as mentioned in an
earlier post we probably need a 64 bit core Foobar before any of that will happen.

Lets hope that happens because the future of computer audio is to move the everything from the digital filter prior to the computer.  I know this forum is stuck in thinking
all over-sampling is the same,  but I've' ABX's and found the digital filter one of the most important influences on sound.  And wha ta better way to
handle it than with x86 vs some proprietary fpga.

  • Glenda
  • [*][*]
Resampler plugin
Reply #369
Sorry for the grammar I got caught off correcting it.  My main point is the spirit of foobar and its success has been customization.  We've buried our
heads in the sand while people resort to non-oversamplng DAC's and expensive priority programmed fpga's because the old SIW chips and the penny-pinching oversampler on dac chip just can't technically compete with what a modern PC can do,  and in the spirit of Foobar make it customizable,  pick your algoritm you settings.  Whether it sounds better is not the argument its
piched on dac chip filter just can't give the end user SOTA,  and ultimately the the aility to build a very simple DAC with the number crutching done by the computer.

But again a good first start with be a modern SOX plugin that accepts command lines with no bandwidth limitations (could least get Meridian apodizing.)

  • xnor
  • [*][*][*][*][*]
  • Developer
Resampler plugin
Reply #370
Foobar severely needs a good resampler like Syngalist or the mac program that comes with the Izotope 64bit SRC,  but I guess as mentioned in an
earlier post we probably need a 64 bit core Foobar before any of that will happen.

SoX is a very good resampler.
No, you don't need a 64 bit core to do 64 bit processing, but depending on the algorithm and requirements you might be fine with 32 bit floats or even ints.

I know this forum is stuck in thinking
all over-sampling is the same,  but I've' ABX's and found the digital filter one of the most important influences on sound.

What filters? What test setup? Please provide details.

But again a good first start with be a modern SOX plugin that accepts command lines with no bandwidth limitations (could least get Meridian apodizing.)

Why do you need command line options?
Why would you want an apodizing filter that doesn't suppress images?
"I hear it when I see it."

  • wottha
  • [*]
Resampler plugin
Reply #371
Thank you lvqcl for making such a great FB2K component.

One question though.  At src.infinitewave.ca, all three of the following seem to be the same:

foo_dsp_resampler
Audacity 2.0.3
SoX 14.4 High Quality

(except the artifacts in the Sox 14.4 Sweep, but that doesn't seem quite right). 

So I guess they're all using the SoX default settings? (Quality Best, Passband 95%, Phase Linear 50%)?

What settings in foo_dsp_resampler are equivalent to:
SoX 14.4 VHQ Linear Phase (at infinitewave)

Would that be Quality Best, Passband 99%, Phase Linear 50%?

Is the only downside of Passband at 99% the speed of processing?  Because it's plenty fast for me.  Much faster than many commercial resamplers and those included in many daw programs.

Thanks.
  • Last Edit: 07 September, 2014, 06:33:32 PM by wottha

  • lvqcl
  • [*][*][*][*][*]
  • Developer
Resampler plugin
Reply #372
So I guess they're all using the SoX default settings? (Quality Best, Passband 95%, Phase Linear 50%)?

Yes, it seems so.

What settings in foo_dsp_resampler are equivalent to:
SoX 14.4 VHQ Linear Phase (at infinitewave)

Would that be Quality Best, Passband 99%, Phase Linear 50%?

AFAIK yes.

Is the only downside of Passband at 99% the speed of processing?  Because it's plenty fast for me.  Much faster than many commercial resamplers and those included in many daw programs.

Sharper filter means longer ringing. Compare Afconvert (Normal) with Afconvert (Bats):

VS

Different people prefer different filters, but if both input and output samplerates are high enough (say, 44.1 kHz or higher) then it doesn't matter much.

  • wottha
  • [*]
Resampler plugin
Reply #373
Sharper filter means longer ringing. Compare Afconvert (Normal) with Afconvert (Bats):

Thank you for the explanation about the longer ringing.

Maybe it's more common to show the default settings at infinitewave now, but for purposes of appearances relative to the "ideal", seems like maybe 99% Passband would look "better" there, instead of or in addition to the default.

Also, just an observation, but with SoX it seems like the settings 99% Passband, 50% Phase (linear), Aliasing enabled, would probably look more like Weiss Saracon than any other SRC there, given how the SoX High Quality (95% ?) Aliasing enabled looks.

Thank you again lvqcl.

EDIT:  afaik Weiss Saracon shown at infinitewave is the one and only src setting available in Saracon.  there are no optional parameter settings. (afaik)
  • Last Edit: 09 September, 2014, 03:45:52 PM by wottha

  • gevorg
  • [*]
Resampler plugin
Reply #374
I just have a feature suggestion for this already excellent plugin.

Add the ability to upsample based on specified input sample rate, such as:

44.1KHz & 48KHz = Upsample x4
88.2KHz & 96KHz = Upsample x2
176.4KHz & 192KHz = No change, leave as-is