Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Resampler plugin (Read 500166 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Resampler plugin

Reply #575
Would you please add one more configuration setting, which do upsample 4x for [0, 48]kHz and 2x for (48, 96]kHz source.

Thanks.

You can do this with SoX_resampler_mod.

Just add 2 resamplers to DSP chain. First makes 4x upsampling and passes 64000,88200,96000 unmodified. Second makes 2x upsampling and passes 128000,176400,192000 unmodified.

Wouldn't it be simpler do resample 44100,48000,64000,88200,96000,128000,176400,192000 to "UP to 352k/384k"?
And if I want it in two steps I would put
1st 44100,48000,64000,88200,96000,128000 to "UP to 176k/192k"
2nd 176400,192000 to "UP to 352k/384k"

What is the benefit of going into the up-sampling in two steps and not straight forward?
I am still playing with this plugin as I am not 100% sure I can hear any difference in audio so may it all be just placebo. :-)

Re: Resampler plugin

Reply #576
Do I understand correctly that in the case of SoX, the following settings are optimal for downsampling?

• Join our efforts to make Helix MP3 encoder great again
• Opus complexity & qAAC dependence on Apple is an aberration from Vorbis & Musepack breakthroughs
• Let's pray that D. Bryant improve WavPack hybrid, C. Helmrich update FSLAC, M. van Beurden teach FLAC to handle non-audio data

Re: Resampler plugin

Reply #577
@seventhstart, I use the settings you mentioned.

Of course, I'd like to better understand things like
a) minimum vs linear phase in the resampler and
b) TPDF with highpass vs noise-shaped dithering.

The knowledge about sound that travels from article to article is often a set of slang words like a ringing artifact — a rare expert tries to build a bridge to the common people with the help of vernacular language and clearer metaphors (think Carl Sagan, a popularizer of astronomy).

But no doubt, our current conversion setup produces good results.

• Join our efforts to make Helix MP3 encoder great again
• Opus complexity & qAAC dependence on Apple is an aberration from Vorbis & Musepack breakthroughs
• Let's pray that D. Bryant improve WavPack hybrid, C. Helmrich update FSLAC, M. van Beurden teach FLAC to handle non-audio data

Re: Resampler plugin

Reply #578
@lvqcl Please add “Upsample x8” to your SoX Resampler (mod) plugin. This will be useful for true peak scanning.
• Join our efforts to make Helix MP3 encoder great again
• Opus complexity & qAAC dependence on Apple is an aberration from Vorbis & Musepack breakthroughs
• Let's pray that D. Bryant improve WavPack hybrid, C. Helmrich update FSLAC, M. van Beurden teach FLAC to handle non-audio data

Re: Resampler plugin

Reply #579
Of course, I'd like to better understand things like
a) minimum vs linear phase in the resampler and
b) TPDF with highpass vs noise-shaped dithering.

Ken Pohlmann's 'Principals of Digital Audio' has all the answers you seek, required reading for anyone serious about digital audio. Could do with another update though, a lot changed in the last decade!

https://www.amazon.com/Principles-Digital-Audio-Sixth-Video/dp/0071663460/ref=sr_1_2?crid=1CXRFT0P6IMNT

Re: Resampler plugin

Reply #580
@darkflame23 Thank you for the recommendation. I got the 6th edition of that book from Library Genesis and my head was about to explode on the very first page after reading the following paragraph: “Sound is propagated by air molecules through successive displacements that correspond to the original disturbance. In other words, air molecules colliding one against the next propagate the energy disturbance away from the source. Sound transmission thus consists of local disturbances propagating from one region to another. The local displacement of air molecules occurs in the direction in which the disturbance is travel­ing; thus, sound undergoes a longitudinal form of transmission”. On the second page, it was joined by the imperial units of measurement (miles, feets, pounds, Fahrenheit, etc), which I cannot imagine, and on the third I was overwhelmed with logarithms and negative powers in fractions. In my opinion, this approach may tell someone something, but it will not make the sound field more accessible to a wider range of readers.
• Join our efforts to make Helix MP3 encoder great again
• Opus complexity & qAAC dependence on Apple is an aberration from Vorbis & Musepack breakthroughs
• Let's pray that D. Bryant improve WavPack hybrid, C. Helmrich update FSLAC, M. van Beurden teach FLAC to handle non-audio data


Re: Resampler plugin

Reply #582
Of course, I'd like to better understand
So, what is stopping you from doing this?

I indicated the reason immediately after the fragment you quoted.

Quote
The knowledge about sound that travels from article to article is often a set of slang words like a ringing artifact — a rare expert tries to build a bridge to the common people with the help of vernacular language and clearer metaphors (think Carl Sagan, a popularizer of astronomy).

Are you aware of the sound field popularizers like Carl Sagan? You have to look for them in the daytime with a flashlight. For example, here's a practical question: why Foobar2000 uses dither with noise-shaping (Shibata profile, I guess), which saturates the high-frequency region, if MP3 encoders often cuts off above 16 kHz? Alas, it's off-topic right here, but I hope you understand that pushing complex math formulas to answer this question is an overkill. Many professionals lack the ability to communicate using accessible analogies like packaging cheese, as if they were afraid that by answering in an accessible way they would lose the mysterious aura of professionalism that allows them to feel superior.
• Join our efforts to make Helix MP3 encoder great again
• Opus complexity & qAAC dependence on Apple is an aberration from Vorbis & Musepack breakthroughs
• Let's pray that D. Bryant improve WavPack hybrid, C. Helmrich update FSLAC, M. van Beurden teach FLAC to handle non-audio data

Re: Resampler plugin

Reply #583
So, what is stopping why Foobar2000 uses dither with noise-shaping (Shibata profile, I guess), which saturates the high-frequency region, if MP3 encoders often cuts off above 16 kHz?
hi
sorry my poor enlish , my mp3 audio songs are in  lame 320kb or v0 and they  don't cuts off above 16kHz , they do show in foobar even 20kHz
does foobar2000 use always noise-shaping ? could be disabled?
thanks

Re: Resampler plugin

Reply #584
@francesco, English is not my first language as well. LAME settings that you use barely cut the high frequencies, but not everyone uses these settings or even LAME. For example, I also use Helix MP3 encoder, which pays less attention to the high frequencies by default, because they are at the limit of hearing for most people. Also, look at the spectrogram of AAC-compressed music on YouTube — you can clearly see the shelf. Foobar2000 dither options are available at Output page of its Converter, it does not use dither by default, but when it does, you get dither with noise-shaping.

• Join our efforts to make Helix MP3 encoder great again
• Opus complexity & qAAC dependence on Apple is an aberration from Vorbis & Musepack breakthroughs
• Let's pray that D. Bryant improve WavPack hybrid, C. Helmrich update FSLAC, M. van Beurden teach FLAC to handle non-audio data

Re: Resampler plugin

Reply #585
Was just trying to be helpful. I found it an incredibly informative text, and there's a reason it's the standard reference text on a lot of digital audio graduate courses. If you wanna really grok this stuff I'm afraid there's often no simplification possible.

Re: Resampler plugin

Reply #586
I indicated the reason immediately after the fragment you quoted.
This is not the reason, this is an excuse. Ever heard about self-education?

As for dither/noises-haping have you seen my answer here - https://hydrogenaud.io/index.php/topic,108321.msg1035196.html#msg1035196 ? No need to be "expert" to convert and listen. Easy reading about noise-shaping with comparison and samples - http://audio.rightmark.org/lukin/dither/dither.htm

Re: Resampler plugin

Reply #587
...and about ringing.
Let me be your Carl Sagan  :D
Take single impulse with samplerate 8 kHz and resample it to 44100 kHz wit SoX command line tool using extreme bandwidth 99.7 and highest quality (-v). Because source samplerate is very low and bandwidth is extremely high (the higher bandwidth is, the longer ringing is, and bandwidth above 99 is not recommended to use at all in SoX) the ringing will be audible and very long. Also, the higher "quality" setting is, the longer ringing is (what a "surprise"!).
To go to full size image: Right click on picture->Open image (Open image in new tab) ans so on.
Original impulse spectrogram:


Resampled to 44100 with linear phase (-p 50) and -v -b 99.7:
What you can see on the sides of the main "column" is those infamous ringing artefacts.


Resampled to 44100 with intermediate phase (-p 25) and -v -b 99.7:


Resampled to 44100 with minimum phase (-p 0) and -v -b 99.7:


Resampled to 44100 with maximum phase (-p 100) and -v -b 99.7:


Resampled to 44100 with all other default settings (default quality, -b 95, linear phase):


Archive with files - https://www.dropbox.com/scl/fi/ql6juavjcee5uage6ybp5/Infamous-ringing.zip?rlkey=vub9as0n2vrudnxwv3kzl4lb8&dl=1
If you have good quality DAC, amp, headphones, you will be able to hear what differences are. DSPs better be be disabled.
Note: some DACs can switch output off on digital silence making noise on switch, making it hard to hear impulse itself. If this is your case, use some DSP that can add noise to signal, for example - https://foobar.hyv.fi/?view=foo_dsp_mdadither (Smart Dither DSP is NOT suitable in this case, because it doesn't touch digital silence).

Re: Resampler plugin

Reply #588
Since lvqcl still hasn't released a 64-bit version I wanted to see if I can improve the quick conversion I did earlier.
Here's a new build that supports both 32-bit and 64-bit foobar2000 versions, dark mode is supported and now fast mode works also on 64-bit variant.

I also added options to resample only chosen samplerates or to resample everything else but the chosen samplerates, so it should allow doing everything mod and mod2 versions did in one file. I didn't see sources for lvqcl's mod variants so this is my custom implementation.

Re: Resampler plugin

Reply #589
Thnx Case :)

Re: Resampler plugin

Reply #590
Great, thank you!  :)
.halverhahn

Re: Resampler plugin

Reply #591
Hi Case
thanks a lot for the 64bit!
and about
Quote
I also added options to resample only chosen samplerates or to resample everything else but the chosen samplerates, so it should allow doing everything mod and mod2 versions did in one file. I didn't see sources for lvqcl's mod variants so this is my custom implementation.
and should it work even on foobar 32bit with some addons without any issues?
 O:)

Re: Resampler plugin

Reply #592
I'm not 100% certain what you mean. The new option to exclude/include individual samplerates or rate ranges is present in both 32-bit and 64-bit versions. Unless there is a bug somewhere it should work fine and the same in all supported foobar2000 versions.

The special framerate exclusion/inclusion is only there in manually configured resampler. If an addon, like foo_truepeak requests a resampler the exclusions have no effect. Addons will always be able to get the resampling they ask for. And the component name is "Resampler (SoX)" so it's compatible with original lvqcl's component - anything asking for a resampler by that name will still work.

Re: Resampler plugin

Reply #593
Since lvqcl still hasn't released a 64-bit version I wanted to see if I can improve the quick conversion I did earlier.
Here's a new build that supports both 32-bit and 64-bit foobar2000 versions, dark mode is supported and now fast mode works also on 64-bit variant.

I also added options to resample only chosen samplerates or to resample everything else but the chosen samplerates, so it should allow doing everything mod and mod2 versions did in one file. I didn't see sources for lvqcl's mod variants so this is my custom implementation.

Thanks for this, working great in latest FB2K 32bit on Win 11. How do you switch Fast mode on or off, and what does it do?

Re: Resampler plugin

Reply #594
Oh sorry, I don't know what I was thinking when writing that. What I meant with "fast mode" was the "normal" quality mode.

Re: Resampler plugin

Reply #595
ardftsrc filter have superior quality & speed compared to sox resamplers.
Please remove my account from this forum.

Re: Resampler plugin

Reply #596
Thanks Case for this much needed project.

Question:  when using the exclude/include sample rates box, what is the protocol for entering multiple rates?  Are they separated by commas or semicolons, and is a space required?  For example, for a "resample ONLY" entry I have used:

22050,88200

Ivqcl sometimes used a semicolon instead (22050;88200), and in your SRC Resampler you use commas with spaces (22050, 88200).

Re: Resampler plugin

Reply #597
ardftsrc filter have superior quality & speed compared to sox resamplers.
Only mention of that I can find with internet search is a single line in librempeg changelog. If it is as good as you claim and has good license, it would make for a great component. I assume you have no interest to write one?

Question:  when using the exclude/include sample rates box, what is the protocol for entering multiple rates?  Are they separated by commas or semicolons, and is a space required?  For example, for a "resample ONLY" entry I have used:

22050,88200

Ivqcl sometimes used a semicolon instead (22050;88200), and in your SRC Resampler you use commas with spaces (22050, 88200).
Spaces are not needed after the separators. Actually the code currently doesn't really skip them well, so it's best to avoid them. Entries can be separated with comma or semicolon, whichever one prefers. Note that ranges are also supported, you can for example specify 0-44100 to mean all rates up-to and including 44100.

Re: Resampler plugin

Reply #598
ardftsrc filter have superior quality & speed compared to sox resamplers.
I compiled librempeg, I think there is a bug in the code as it keeps insisting on using CLAP audio stuff even though documentation claims it doesn't do dependencies by default.
Anyway, with default settings and commandline
Code: [Select]
ffmpeg -i source.wav -af "ardftsrc=48000" -acodec pcm_f32le out.wav
my binary was slower than existing ffmpeg with '-af "aresample=48000:resampler=soxr"'. And it produced worse quality and the file length changed.

Re: Resampler plugin

Reply #599
no proofs for your questionable claims. Use atrim=start=0 if you  want to trim initial padding.
Please remove my account from this forum.