How can I replace the IR (SetImpulse() method) without transients and other artifacts in the audio stream when the plugin is running?
For example, in some convolvers, such as the Fruity Convolver, changes are not accompanied by crackling or clicking sounds.
Does anyone have any ideas about this or better open source examples? I will be glad to finally close this difficult topic.
I haven’t used the ConvoEngine but the first thing I would do here would be to take a look at the rendered waveform to see what is causing the clicking/crackling. For example, does the waveform a) have gaps at the transitions or b) is it continuous but with jumps (discontinuities)? If you have gaps, check the code and make sure you are not clearing the audio buffers when the new IR is loaded. I have LP filters that do not click or pop when the IR changes and I managed that by loading the new IR without clearing any buffers.
It also matters where/when you load the new IR. For example, I found that changing my LP IR in OnParameterChange() caused clicks and pops but when I set a flag and changed the IR at the end of ProcessBlock() - outside the For loop - it works smoothly without any clicks or pops. Not sure why (and haven’t cared to look into it) but it works.
If you had two convolvers running you could crossfade between the two but minus that inefficiency you might be able to get away with a short fade out/back in upon IR load - especially if applied at a zero crossing.
Again, take a look at the rendered waveform and see how you could get from one IR to the other smoothly - and then get creative. Modifying ConvoEngine in some way may not be the best/easiest solution.
you could have a look at the approach taken in NAM:
essentially:
- “stage” a new instance of your convolver on the main thread with the newly loaded impulse in response to a UI click. You can also use a 2nd thread to load the file in order not to hang the UI
- when loading is done set an atomic boolean to true to signal that it’s ready to swap
- on the audio thread in processBlock() check the boolean (at the top of the method) if it is true, swap in the new convolver and set the boolean to false
Thank you to Oli! I will try to compile this example of NeuralAmpModeler.
I tried to build NAM from source code. However, I did not find the use of WDL_ConvolutionEngine there. Is convolution implemented there using other methods?
It doesn’t use the WDL convolution engine, But the principal of loading the IR is the same
Yes, I believe that convolution is implemented using the Eigen library. And besides, it does not support IR in stereo mode.