Dsp Module wav impulse problem

Hi all, first of all i want to say that i’m total Noob so if i ask something silly for you forgive me :stuck_out_tongue: i’m enjoying geeking with the dsp module plugin project, and i’m trying to apply my wav impulse as cabinet impulses, so here in this line of PluginProcessor.cpp there is this:

if (type == 0)
convolution.loadImpulseResponse (BinaryData::Impulse1_wav, BinaryData::Impulse1_wavSize, false, true, maxSize);
convolution.loadImpulseResponse (BinaryData::Impulse2_wav, BinaryData::Impulse2_wavSize, false, true, maxSize);

and so far the demo work great with the default impulse in the project, i read in the API documentation that the function convolution.loadImpulseResponse have an alternative way, that accept as first parameter a wav file location from your hard drive, and the type of the first parameter is Juce::File, so i added my custom impulse files in the working directory and did this:

juce::File IRfile;

if (type == 0)

convolution.loadImpulseResponse(IRfile.getCurrentWorkingDirectory().getChildFile(“MyImpulse.wav”), false,true,maxSize);

convolution.loadImpulseResponse(IRfile.getCurrentWorkingDirectory().getChildFile(“MyImpulse2.wav”), false, true, maxSize);

seems working, it build without errors, but when i load the plugin no effect applied by the cabinet, can someone explain what am i doing wrong and show me how should be used the function?
thx in advance

Hello !

Difficult to know what is wrong in your approach without more details. Have you tried to debug your plug-in to see with breakpoints what happens inside after you try to load the impulse response ?

Hi IvanC, first of all the Dsp module is fantastic, said this basically i’m keeping the module project exactly as it his and it work with the 2 default impulses the guitar cab and the old tape impulse, basically in PluginProcessor.cpp in Line 272 there is the function convolution.loadImpulseResponse (BinaryData::Impulse1_wav, BinaryData::Impulse1_wavSize, false, true, maxSize);

instead of the first 2 parameters BinaryData::Impulse1_wav, BinaryData::Impulse1_wavSize i’m using a Juce::File type variable named IRfile and setting in it the path in my hard disk of my wav impulse, so the function is like this:
convolution.loadImpulseResponse(IRfile.getCurrentWorkingDirectory().getChildFile(“MyImpulse.wav”), false,true,maxSize);
where IRfile.getCurrentWorkingDirectory().getChildFile(“MyImpulse.wav”) return for example “C:\impulse\myimpulse.wav” i want to know if the approach is correct but something is wrong, or if to use custom impulses there is more to do than just that, sorry again if my knowledge is limited, and thx for your answer

I have just tried to replace the line 272 with convolution.loadImpulseResponse(File("c:/impulses/cabinets/Vintage44K.wav"), false, true, maxSize); on my Windows computer and it works.

I suspect that your IRfile.getCurrentWorkingDirectory().getChildFile(“MyImpulse.wav”) returns a File object that doesn’t exist. Could you try directly something like File("C:\impulse\myimpulse.wav") instead to see what happens ?

Anyway, you should really use the debugger to find out where something is wrong in the loading process :wink:

1 Like

If you try that, then use double backslashes on windows please: :wink:


But I also suspect that you use the File object wrong:

a) getCurrentWorkingDirectory() is a static method, it will not change the IRfile (same goes for getSpecialLocation)
b) if you start from a debugger, the current working directory might not be what you expect it to be, as it can be set in the project, and the defaults are not always obvious - hence I would start trying with a obvious, I use Desktop for instance

File iirFile = File::getSpecialLocation (File::userDesktopDirectory ).getChildFile(“MyImpulse.wav”);
DBG ("File \"" << iirFile.getFullPathName() << "\" exists? " << iirFile.existsAsFile());

Good luck!


Sorry for the delay, i had to take some sleep, so i tried to put the directory manually and it worked in this format File(“c:/impulses/cabinets/MyImpulse.wav”) and this File(“c:\impulses\cabinets\MyImpulse.wav”) so probably yes there was something to matter with my file object, but debugging i’m almost sure that it was returning the correct path, i will do some other try on that, thx both IvanC and daniel, you made my day and sorry for my noobness :smiley:
just as a curiosity, i noticed that activating the cab is a little cpu consuming in my pc, is there an option to set the quality of the filter?

First, on Windows you can improve a little the CPU load if you use Intel MKL FFT instead of JUCE default one. Second, the size parameter in the demo is set at 8192 I think by default. You can reduce the CPU load of the plug-in by setting a lower value instead as well :wink:

Just don’t use relative paths nor trust the working directory is ever what you expect it to be.

If you need to form a path to something you can’t or don’t want to ask the user explicitly about, you can usually form the correct absolute paths with the help of the File class.

@IvanC thx, the filesize helped a lot, now i’ll look into Intel MKL FFT, but already changing the filesize made the cpu usage down, thx a lot for your patience

@Xenakios thx for your advice, i’ll probably just set a default directory that contain all the impulses, the working directory was anyway just for test purpose but probably was not the simplest way to go for a simple test, still i will test it more to figure out what exactly was wrong in my variable

Just to give an update about the Cpu usage of the convolution, it’s fantastic, i was testing in debug mode and i didn’t know that the difference would be that much, building in release mode as final release the cpu consumation is not even 1% against 4% in debug mode, so thx again for the help

You’re welcome :wink:

In general in my experience, algorithms heavily optimized with SIMD instructions tend to be quite expensive in CPU in Debug mode, compared to their standard counterparts ! But of course, in Release mode, we see easily their efficiency.