|
09-02-2013, 12:26 PM
|
#1
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
r8brain-free-src resampler
I have an example in my Git repository (in WDL/IPlug/Example/Convo) showing you how to use WDL's fast (zero-latency) convolution engine to apply an IR wave file to the audio signal. This example resamples the IR to the target sample rate using linear interpolation, which isn't too bad, but it certainly isn't high quality.
So I have now added the option the use WDL's LGPL resampler, or to use the new r8brain-free-src resampler by Aleksey Vaneev of Voxengo. I think the latter is slightly slower than WDL for fractional resampling factors, but faster than WDL for "power of 2" factors. The quality of r8brain should be better than WDL's resampler, and it is MIT licensed, so you can use it in closed-source projects.
Anyway, both resamplers are way better than linear interpolation, so I guess I now have a proper convolution example plug-in (and proper resampling or IRs in ComboV and F).
The relevant commits are on my 'next' branch, look for IPlugConvo.
|
|
|
09-02-2013, 12:44 PM
|
#2
|
Human being with feelings
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
|
Nice, thanks for sharing.
Do you think this code is also suitable for real-time oversampling to reduce aliasing, as in your IPlugDistortion example?
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
|
|
|
09-02-2013, 12:57 PM
|
#3
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
Well, I don't really know, but I don't think so, because it introduces latency (just like WDL's resampler does). However, there has been some talk about using it for oscillators in a soft synth (but I guess there latency is not much of a problem). And Aleksey has just finished adding a minimum-phase filters, so perhaps that will reduce latency.
|
|
|
09-02-2013, 01:26 PM
|
#4
|
Human being with feelings
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
|
Quote:
Originally Posted by Tale
Well, I don't really know, but I don't think so, because it introduces latency (just like WDL's resampler does). However, there has been some talk about using it for oscillators in a soft synth (but I guess there latency is not much of a problem). And Aleksey has just finished adding a minimum-phase filters, so perhaps that will reduce latency.
|
Well, I figure a small amount of latency (say, 64 samples) may be a price worth paying for avoiding anti-aliasing at great quality. Also, imho low latency is at least as important for oscillators, i.e. for instrument plug-ins, as it is for effects.
I'll grab your next repo and try to experiment a bit with it myself in any case.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
|
|
|
09-02-2013, 03:31 PM
|
#5
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
Quote:
Originally Posted by Banned
Also, imho low latency is at least as important for oscillators, i.e. for instrument plug-ins, as it is for effects.
|
Sure, but what I meant was that with an oscillator you can easily compensate for latency, you just add it to the phase so it is slightly ahead of "real" time.
Quote:
Originally Posted by Banned
I'll grab your next repo and try to experiment a bit with it myself in any case.
|
Note that r8brain-free-src itself is not part of my repository, you can download it from here:
https://code.google.com/p/r8brain-free-src/
And if you just want to have a quick look at how I use it, the code I have posted here is very similar to the code in my repository:
http://www.kvraudio.com/forum/viewto...468902#5468902
|
|
|
09-05-2013, 01:37 PM
|
#6
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
Quote:
Originally Posted by Banned
Well, I figure a small amount of latency (say, 64 samples) may be a price worth paying for avoiding anti-aliasing at great quality.
|
I have just done a quick reimplementation of the anti-alias filter in IPlugDistortion using two r8brain minimum-phase CDSPResampler<> objects (one for up, and one for downsampling), and with only 2x oversampling I got 1032 samples latency. It sounded pretty good, probably sightly (but inaudibly?) better than the Bessel filter with 8x oversampling. With r8brain it performed slightly worse, although there is probably room for optimization in my implementation.
Last edited by Tale; 09-05-2013 at 03:24 PM.
Reason: Typo
|
|
|
09-05-2013, 05:15 PM
|
#7
|
Human being with feelings
Join Date: May 2012
Location: PA, USA
Posts: 356
|
Quote:
Originally Posted by Tale
I have just done a quick reimplementation of the anti-alias filter in IPlugDistortion using two r8brain minimum-phase CDSPResampler<> objects (one for up, and one for downsampling), and with only 2x oversampling I got 1032 samples latency. It sounded pretty good, probably sightly (but inaudibly?) better than the Bessel filter with 8x oversampling. With r8brain it performed slightly worse, although there is probably room for optimization in my implementation.
|
That is great. I was thinking about trying it out for oversampling. Were you using it to up- and down-sample? I was wondering if zero stuffing would work for the upsampling, and then only needing to use r8brain on the downsample conversion and filtering.
|
|
|
09-06-2013, 12:36 AM
|
#8
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
Quote:
Originally Posted by random_id
Were you using it to up- and down-sample?
|
Yes.
Quote:
Originally Posted by random_id
I was wondering if zero stuffing would work for the upsampling, and then only needing to use r8brain on the downsample conversion and filtering.
|
Er... I dunno.
EDIT: I have tried it, and yeah, zero stuffing (and scaling accordingly) for upsampling, and then only using r8brain for downsampling works well. Latency is now down to 520 samples, and CPU usage is down to 55%.
Last edited by Tale; 09-06-2013 at 01:17 AM.
Reason: Tried zero stuffing upsampling
|
|
|
09-06-2013, 06:33 AM
|
#9
|
Human being with feelings
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
|
Quote:
Originally Posted by Tale
I have just done a quick reimplementation of the anti-alias filter in IPlugDistortion using two r8brain minimum-phase CDSPResampler<> objects (one for up, and one for downsampling), and with only 2x oversampling I got 1032 samples latency. It sounded pretty good, probably sightly (but inaudibly?) better than the Bessel filter with 8x oversampling. With r8brain it performed slightly worse, although there is probably room for optimization in my implementation.
|
Hey, cool. Will check it out when I have some spare time to mess with this stuff.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
|
|
|
09-06-2013, 02:45 PM
|
#10
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
I have just added a new (temporary) branch, 'iplug-distortion', to my WDL.git repository. This branch contains both versions (up/down and zero-stuff/down) of my r8brain oversampled IPlug distortion example. Note that both work only with the latest version (v0.9) of r8brain-free-src.
|
|
|
09-14-2013, 09:29 AM
|
#11
|
Human being with feelings
Join Date: Aug 2010
Location: Utrecht, The Netherlands
Posts: 12
|
Hello Tale,
I have been experimenting with the convolution engine and the example plugin.
I am really curious if the convolution engine is being used in any free or commercial plugins, because I have found that it returns way out-of-range values from the engine to the ProcessDoubleReplacing() function in the IPlugExample.
In this test I use a 200msec IR from a real hall recording (I recently created a huge library from the Teldex Studio in Berlin). convo values up to 12.0f are returned to the nFrame loop.
And this is not due to the changes I made in a copy of the plugin example, it also happens in your IPlugExample (convo values in the range of 1.4f).
The demo is in mono mode with a very sparse IR, hence the difference in the convo values.
I also found with the VC 2010 debugger that at some point the engine switches to mono mode, while I have expanded the example to work in stereo with a stereo IR file. I can overrule this problem with one statement change in the convoengine.cpp file.
I am using the OL next branch but have just also checked your next branch (no differences in the engine).
The code looks like so detailed, that it gives the impression it should really do with it is supposed to do: optimized partioned convolution.
But why can it return values outside of the -1.0 to 1.0 range?
Is this code also used in (a) Reaper plugin(s)?
Has anyone else ever mentioned something like this? Is it used in any product that you are aware of?
Cheers!
Peter
|
|
|
09-14-2013, 12:10 PM
|
#12
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
I am using ConvoEngine in Combo Model V & F (both free), where you can switch it on/off using the Cab switch. Although I am using it to process two channels, the IRs I use are mono.
Note that the engine itself does not amplify the signal. However, the IR might. Note also that if the IR is in a different sample rate than the host, then you need to resample as well as scale it.
|
|
|
10-25-2017, 11:31 PM
|
#13
|
Human being with feelings
Join Date: Jul 2006
Location: Cowtown
Posts: 1,562
|
Quote:
Originally Posted by Tale
I have just done a quick reimplementation of the anti-alias filter in IPlugDistortion using two r8brain minimum-phase CDSPResampler<> objects (one for up, and one for downsampling), and with only 2x oversampling I got 1032 samples latency. It sounded pretty good, probably sightly (but inaudibly?) better than the Bessel filter with 8x oversampling. With r8brain it performed slightly worse, although there is probably room for optimization in my implementation.
|
I know that this is thread necro-ing on a large scale, but...how did you arrive at that latency value? I'm messing around with it and calculating based on getInLenBeforeOutStart(0) for my upsampling and downsampling filters...it's closer than doing nothing, but it's not even close to nulling out with a non-oversampled polarity-inverted identical signal.
|
|
|
10-26-2017, 12:55 AM
|
#14
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
Quote:
Originally Posted by sstillwell
I know that this is thread necro-ing on a large scale, but...how did you arrive at that latency value? I'm messing around with it and calculating based on getInLenBeforeOutStart(0) for my upsampling and downsampling filters...it's closer than doing nothing, but it's not even close to nulling out with a non-oversampled polarity-inverted identical signal.
|
I don't remember that after all this time!
That being said, apparently the 'iplug-distortion' branch is still in my repository. Do note that there was a problem with it I think (it seems to be missing an upsample filter for starters).
Anyway, maybe I used getLatency(), but I think I just measured it.
BTW, you should be able to get less latency than the 1032 I originally got, see this:
http://www.kvraudio.com/forum/viewto...513959#5513959
|
|
|
10-26-2017, 08:13 AM
|
#15
|
Human being with feelings
Join Date: Jul 2006
Location: Cowtown
Posts: 1,562
|
Quote:
Originally Posted by Tale
I don't remember that after all this time!
That being said, apparently the 'iplug-distortion' branch is still in my repository. Do note that there was a problem with it I think (it seems to be missing an upsample filter for starters).
Anyway, maybe I used getLatency(), but I think I just measured it.
BTW, you should be able to get less latency than the 1032 I originally got, see this:
http://www.kvraudio.com/forum/viewto...513959#5513959
|
I think that may only be on your local repo - it doesn't appear to be on github.
|
|
|
10-26-2017, 09:02 AM
|
#16
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
Quote:
Originally Posted by sstillwell
I think that may only be on your local repo - it doesn't appear to be on github.
|
Oops... Yeah, I only push my master/next branches to GitHub, but it should still be in my original repo:
https://www.taletn.com/WDL.git
|
|
|
10-26-2017, 10:52 AM
|
#17
|
Human being with feelings
Join Date: Jul 2006
Location: Cowtown
Posts: 1,562
|
Hah, I just rendered one with oversampling, one without, then just measured it by hand and set it in the code. I tried several different ways of pulling it out of the Resampler object and it just didn't get close. Now it nulls to -137 dBFS or so.
|
|
|
10-26-2017, 03:18 PM
|
#18
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
I've had good results with HIIR, which is nowadays licensed under the DWTFYWPL
http://ldesoras.free.fr/prod.html
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 11:12 AM.
|