(first post here)
I’m pretty new to fmod, but I already like it
After reading documentation and tutorials I still have a question. I’ve found how to get a frequency range using low and high pass DSP at the same time on the main channel, but I can’t find how to get several ranges at the same time.
For example I want to hear range 400 to 600Hz and 1000 to 2000hz of the same sound.
I tried to create a channel by range, but it doesn’t seem to work (or maybe I do something wrong).
How can I do that ?
- larles asked 6 years ago
Thank you for that quick answer, anyway I don’t understand what you mean by splitting the signal.
Do you mean "add 2 HighPass DSP to my channel, then add 2 LowPass. Set the outputs of HighPasses to connect to LowPass"… is it what you meant?
Any code example would be appreciate (a lot! :)).
You can set up custom routing using DSP nodes.
first create a ChannelGroup.
get the DSP of the ChannelGroup using ChannelGroup::getDSPHead.
Create two lowpass filters (I’ll call them lowpass1 and lowpass2)
Connect both of them to the ChanellGroup’s DSP using
Then create two highpass filters (highpass1 and highpass2)
Connect highpass1 to lowpass1
Connect highpass2 to lowpass2
Now get Channel::getDSPHead.
Connect this DSP to both of the highpass filters.
Now you should have the same set up as shown in my diagram from the previous post.
I’ve read your last post a dozen times and I still can’t have something working properly.
In fact, I "think" I have done exactly what you said but I still hear my sound as if no DSP was applied on it.
Here is my code :
system->playSound(FMOD_CHANNEL_FREE, sound, false, &pChan); // creates chan group result = system->createChannelGroup( "my_chan_grp", &pChanGrp ); result = pChanGrp->getDSPHead(&pDSPChanGrpHead); // creates low passes result = system->createDSPByType( FMOD_DSP_TYPE_LOWPASS, &pDSPlow1 ); result = pDSPlow1->setParameter( FMOD_DSP_LOWPASS_CUTOFF, 200.f ); result = pDSPlow1->addInput(pDSPChanGrpHead, 0); // connecting to grp head result = system->createDSPByType( FMOD_DSP_TYPE_LOWPASS, &pDSPlow2 ); result = pDSPlow2->setParameter( FMOD_DSP_LOWPASS_CUTOFF, 200.f ); result = pDSPlow2->addInput(pDSPChanGrpHead, 0); // connecting to grp head // creates high passes result = system->createDSPByType( FMOD_DSP_TYPE_HIGHPASS, &pDSPhigh1 ); result = pDSPhigh1->setParameter( FMOD_DSP_HIGHPASS_CUTOFF, 100.f ); result = pDSPhigh1->addInput(pDSPlow1, 0); result = system->createDSPByType( FMOD_DSP_TYPE_HIGHPASS, &pDSPhigh2 ); result = pDSPhigh2->setParameter( FMOD_DSP_HIGHPASS_CUTOFF, 100.f ); result = pDSPhigh2->addInput(pDSPlow2, 0); result = pChan->getDSPHead(&pDSPChanHead); result = pDSPChanHead->addInput(pDSPhigh1, 0); // connecting to chan head result = pDSPChanHead->addInput(pDSPhigh2, 0); // connecting to chan head
What am I doing wrong ? Can you spot it ’cause I can’t manager to find where I am wrong
EDIT: even with setActive(true) on my DSPs the result is the same : I still hear my sound as if nothing was cut.
Good work, you’ve done well.
The only mistake is that the addInput calls are the wrong way around.
[code:3s6curph] result = pDSPlow1->addInput(pDSPChanGrpHead, 0); // connecting to grp head[/code:3s6curph]
That code is setting the channelgroup as the input to the lowpass. You want it the other way around so the low pass is the input to the channelgroup.
So this should be:
[code:3s6curph] result = pDSPChanGrpHead->addInput(pDSPlow1, 0); // connecting to grp head[/code:3s6curph]
This is true of all the addInput calls in the code you posted. If you swap them all around it should work.
There is one thing i neglected to mention. The fact that you’re still hearing sound is a problem, that will be a third signal path that you do not want. So before you connect the channel’s head to anything call DSP::disconnectAll(false, true) to disconnect all outputs. That will destroy the default signal path from the channel’s head to the system’s master channelgroup. To make it easier to visualize what is happening you can use FMOD Profiler. Just add FMOD_INIT_PROFILE_ENABLED to the System::init flags and then you can connect the FMOD Profiler tool to your program and see the DSP network. (One thing to note is that the signal flows from right to left in FMOD Profiler which can be a bit confusing).
The easiest thing to do would be to split the signal. You can do this by having multiple outputs from the dsp creating two separate signal paths. Then add one highpass and lowpass to each signal path and set the cutoff values to what you want. Then rejoin the signal together.
Something like this;
o -- HighPass -- LowPass -- o / \
— o o —
o — HighPass — LowPass — o
Please login first to submit.