|
01-25-2018, 12:56 PM
|
#1
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Convert wav to .h (ConvoEngine)
Hello,
Still i can't use convolution plugin.
I found this info...
"Ah OK... You have to copy-paste the the extractor code in a temporary CPP source file (e.g. extract.cpp), compile it, and then run it from the command line, and redirect its output to ir.h (i.e. extract ir.wav > ir.h)."
But i can't do that.
Can you give me some tips?
Thanks.
|
|
|
01-25-2018, 01:15 PM
|
#2
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
I don't understand at all what you are asking about, can you clarify?
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
|
|
|
01-25-2018, 01:20 PM
|
#3
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Xenakios
I don't understand at all what you are asking about, can you clarify?
|
https://forum.cockos.com/showthread....t=convo+engine
I want to convert impulse response to .h file to use with convo engine.I'm doing everything but getting errors.
|
|
|
01-25-2018, 01:30 PM
|
#4
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by Tunca
|
Getting errors with what exactly?
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
|
|
|
01-25-2018, 01:40 PM
|
#5
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Xenakios
Getting errors with what exactly?
|
I created .cpp file with extractor code in IPlugConvoEngine project and compiled it.Then i opened compiled plugin with command line.Tried to convert my wav to .h but it can't extract .h file.
Did i miss something?
|
|
|
01-25-2018, 03:24 PM
|
#6
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
Quote:
Originally Posted by Tunca
I created .cpp file with extractor code in IPlugConvoEngine project and compiled it.Then i opened compiled plugin with command line.Tried to convert my wav to .h but it can't extract .h file.
Did i miss something?
|
Yeah, you should create a separate CPP file (e.g. extract.cpp), and then just compile it from the command line (no need to add it to your plug-in project) i.e.:
Code:
Windows:
cl extract.cpp
extract.exe my_ir.wav > my_ir.h
macOS:
g++ -o extract extract.cpp
./extract my_ir.wav > my_ir.h
BTW, I guess I should update the extractor/convertor code to use my WaveReader class, so it will support non 32-bit floating-point WAV files.
|
|
|
01-26-2018, 02:17 AM
|
#7
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Tale
Yeah, you should create a separate CPP file (e.g. extract.cpp), and then just compile it from the command line (no need to add it to your plug-in project) i.e.:
Code:
Windows:
cl extract.cpp
extract.exe my_ir.wav > my_ir.h
macOS:
g++ -o extract extract.cpp
./extract my_ir.wav > my_ir.h
BTW, I guess I should update the extractor/convertor code to use my WaveReader class, so it will support non 32-bit floating-point WAV files.
|
Thanks!
But still i'm doing something wrong...
I'm creating extract.cpp and compiling with command line with "g++ -o extract extract.cpp".
And then i'm using "./extract my_ir.wav > my_ir.h" to convert wav.But there is no any file.
What i'm doing wrong?
EDIT
I used only this code "/extract my_ir.wav" and it gave me values.But when i use "/extract my_ir.wav > my_ir.h" it can't export ir.h file.
Last edited by Tunca; 01-26-2018 at 02:28 AM.
|
|
|
01-26-2018, 02:26 AM
|
#8
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by Tunca
What i'm doing wrong?
|
The wav to text converter doesn't have any error handling, so it's probably just silently failing on you for some reason.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
|
|
|
01-26-2018, 02:28 AM
|
#9
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Xenakios
The wav to text converter doesn't have any error handling, so it's probably just silently failing on you for some reason.
|
EDIT
I used only this code "/extract my_ir.wav" and it gave me values.But when i use "/extract my_ir.wav > my_ir.h" it can't export ir.h file.
|
|
|
01-26-2018, 02:32 AM
|
#10
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Oh!
Finally i converted to ir.h file!
Thanks!
But i have another problem now.
I'm seeing "nanf".
What should i do?
|
|
|
01-26-2018, 02:41 AM
|
#11
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Code:
-1.10919050e-16f,
-4.09825543e-17f,
nanf,
3.12016401e-02f,
1.11114186e+36f,
nanf,
-1.58188340e+29f,
3.63949725e+29f,
-2.73374409e+38f,
1.30644203e+05f,
As you can see there is nanf...
|
|
|
01-26-2018, 03:20 AM
|
#12
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
"NaN" stands for "not a number", so I guess your WAV file might not be 32-bit float, or maybe it has some additional chunks that mess up things (because the convertor code is *really* simple, so it only works for 32-bit float WAV files with no additional chunks).
Like I said earlier, I should really rewrite this using my WaveReader class, so it supports other WAV formats as well.
|
|
|
01-26-2018, 06:13 AM
|
#13
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Tale
"NaN" stands for "not a number", so I guess your WAV file might not be 32-bit float, or maybe it has some additional chunks that mess up things (because the convertor code is *really* simple, so it only works for 32-bit float WAV files with no additional chunks).
Like I said earlier, I should really rewrite this using my WaveReader class, so it supports other WAV formats as well.
|
I tried 32-bit float but no luck.Still getting NaN.
What do you mean with "chunks"?
|
|
|
01-26-2018, 06:15 AM
|
#14
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
FWIW, here is an improved version:
https://github.com/TaleTN/ir2h
|
|
|
01-26-2018, 06:17 AM
|
#15
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
Quote:
Originally Posted by Tunca
I tried 32-bit float but no luck.Still getting NaN.
|
You could try my updated version.
Quote:
Originally Posted by Tunca
What do you mean with "chunks"?
|
A WAV file can hold extra info, e.g. markers etc. My simple convertor doesn't support this at all, but the newer version should automatically skip them (I think).
|
|
|
01-26-2018, 06:32 AM
|
#16
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Tale
|
Thanks!
I just tried but got some issues.
Getting this error while making.
Code:
make: *** No rule to make target `ir2h.cpp', needed by `ir2h'. Stop.
|
|
|
01-26-2018, 06:42 AM
|
#17
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
Sounds like you are missing ir2h.cpp...
|
|
|
01-26-2018, 06:52 AM
|
#18
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Tale
Sounds like you are missing ir2h.cpp...
|
It's there but i tried your "how to...".No luck...
I didn't understand new one.Now older one working correctly.But i will figure new one out.
Also any tip to use multiple IR with convoengine?
|
|
|
01-26-2018, 06:55 AM
|
#19
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
Quote:
Originally Posted by Tunca
It's there but i tried your "how to...".No luck...
I didn't understand new one.Now older one working correctly.But i will figure new one out.
|
Well, not important if you got the old one up and running I guess... But maybe you were running make from outside the directory where ir2h.cpp and Makefile.gcc are?
Quote:
Originally Posted by Tunca
Also any tip to use multiple IR with convoengine?
|
Do you mean multi-channel, or switching between different IRs?
|
|
|
01-26-2018, 07:00 AM
|
#20
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Tale
Well, not important if you got the old one up and running I guess... But maybe you were running make from outside the directory where ir2h.cpp and Makefile.gcc are?
Do you mean multi-channel, or switching between different IRs?
|
I guess i did something wrong while running make.I will check this to night.Thank you so much for new version!
I mean switching between different IRs.
|
|
|
01-26-2018, 07:07 AM
|
#21
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
Quote:
Originally Posted by Tunca
I mean switching between different IRs.
|
Well, what I typically do is prepare multiple WDL_ImpulseBuffers, and then switch between them using WDL_ConvolutionEngine::SetImpulse(). I guess a nicer option would be to crossfade between two WDL_ConvolutionEngines, but then you would have to temporarily run two of them, which can be rather heavy on CPU.
|
|
|
01-26-2018, 07:54 AM
|
#22
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Tale
Well, what I typically do is prepare multiple WDL_ImpulseBuffers, and then switch between them using WDL_ConvolutionEngine::SetImpulse(). I guess a nicer option would be to crossfade between two WDL_ConvolutionEngines, but then you would have to temporarily run two of them, which can be rather heavy on CPU.
|
As i can see,we are including ir.h file.
Can we select it with basic if/else function?
Like this;
Code:
if (mSel == 0)
IR = #include "ir1.h";
else if (mSel == 1)
IR = #include "ir2.h";
Am i idiot?
|
|
|
01-26-2018, 09:01 AM
|
#23
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
More something like this i.e. include both IRs during compile time:
Code:
static const int len = 1024;
static const float ir1[ir_len] =
{
#include "ir1.h"
};
static const float ir2[ir_len] =
{
#include "ir2.h"
};
And then select ir1/ir2 on runtime.
EDIT: Assuming same length here for simplicity's sake, but they don't have to be.
Quote:
Originally Posted by Tunca
Am i idiot?
|
No comment...
|
|
|
01-26-2018, 09:13 AM
|
#24
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Tale
More something like this i.e. include both IRs during compile time:
Code:
static const int len = 1024;
static const float ir1[ir_len] =
{
#include "ir1.h"
};
static const float ir2[ir_len] =
{
#include "ir2.h"
};
And then select ir1/ir2 on runtime.
EDIT: Assuming same length here for simplicity's sake, but they don't have to be.
No comment...
|
Thanks for reply.
I added both IRs but i can't switch. mIR and mIR1
Now playing with this.I believe i can switch IRs in here.What do you thing?
I need to add if/else function to switch IRs between mIR and mIR1.
Code:
void IPlugConvoEngine::Reset()
{
TRACE; IMutexLock lock(this);
// Detect a change in sample rate.
if (GetSampleRate() != mSampleRate)
{
mSampleRate = GetSampleRate();
const int irLength = sizeof(mIR) / sizeof(mIR[0]);
const double irSampleRate = 44100.;
mImpulse.SetNumChannels(1);
#if defined(_USE_WDL_RESAMPLER)
mResampler.SetMode(false, 0, true); // Sinc, default size
mResampler.SetFeedMode(true); // Input driven
#elif defined(_USE_R8BRAIN)
if (mResampler) delete mResampler;
mResampler = new CDSPResampler16IR(irSampleRate, mSampleRate, mBlockLength);
#endif
// Resample the impulse response.
int len = mImpulse.SetLength(ResampleLength(irLength, irSampleRate, mSampleRate));
if (len) Resample(mIR, irLength, irSampleRate, mImpulse.impulses[0].Get(), len, mSampleRate);
// Tie the impulse response to the convolution engine.
mEngine.SetImpulse(&mImpulse);
}
}
|
|
|
02-02-2018, 02:54 AM
|
#25
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
You will probably want to resample both IRs, and keep them around. Then you do either
Code:
mEngine.SetImpulse(&mImpulse1);
or
Code:
mEngine.SetImpulse(&mImpulse2);
to select IR 1 or 2.
|
|
|
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 04:41 AM.
|