# Questions about DSP

**URL:** <https://qa.fmod.com/t/questions-about-dsp/14739>\
**Category:** FMOD Engine\
**Created:** [June 4, 2019, 5:03pm UTC](https://qa.fmod.com/t/questions-about-dsp/14739 "2019-06-04T17:03:47Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [June 4, 2019, 5:03pm UTC](https://qa.fmod.com/t/questions-about-dsp/14739/1 "2019-06-04T17:03:47Z")

</div>

I have several DSP related questions.

1. If I apply FMOD\_DSP\_SetBypass(TRUE) to a certain DSP instance, does FMOD still consume some CPU power for the DSP effect in the background or do nothing?

When I add a global echo / reverb instance to a channel group using FMOD\_ChannelGroup\_AddDSP() or FMOD\_System\_SetReverbProperties(),  
calling FMOD\_Channel\_Stop() / FMOD\_ChannelGroup\_Stop() only stops the original source sound but not the remaining echo / reverb effect of the sound.  
On the other hand, I could stop the whole sound using FMOD\_Channel\_Stop() / FMOD\_ChannelGroup\_Stop() when I added an echo / reverb instance to a specific channel using FMOD\_Channel\_AddDSP().

1. Is there a way to stop a sound including its remaining DSP effects immediately when the DSP instances are added to a channel group?

Calling FMOD\_ChannelGroup\_SetMute() or FMOD\_ChannelGroup\_SetVolume() on DSP instances added using FMOD\_Channel\_AddDSP() or FMOD\_System\_SetReverbProperties() works fine,  
(whereas FMOD\_Channel\_SetMute() and FMOD\_Channel\_SetVolume() don’t.)  
but FMOD\_Channel\_SetMute(), FMOD\_ChannelGroup\_SetVolume(), FMOD\_ChannelGroup\_SetMute() and FMOD\_ChannelGroup\_SetVolume() don’t work at all with DSP instances  
added using FMOD\_ChannelGroup\_AddDSP().

1. How can I adjust the volume of a channel group’s DSPs?

The final question is not actually related to DSP, but let me ask.  
I read about FMOD\_System\_SetStreamBufferSize() from the Core API Reference and found this statement.

“Does not affect latency of playback.”

1. Is there really nothing to worry about with large values other than consuming more memory unlike FMOD\_System\_SetDSPBufferSize() which causes high latency?

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [June 11, 2019, 5:48am UTC](https://qa.fmod.com/t/questions-about-dsp/14739/2 "2019-06-11T05:48:44Z")

</div>

> [@jiyongman](#):
>
> If I apply FMOD\_DSP\_SetBypass(TRUE) to a certain DSP instance, does FMOD still consume some CPU power for the DSP effect in the background or do nothing?

It should not use any CPU while it is bypassed, if it does it will so minimal that it is not noticeable.

> [@jiyongman](#):
>
> Is there a way to stop a sound including its remaining DSP effects immediately when the DSP instances are added to a channel group?

You can cut off any signal from a DSP using [DSP::reset](https://fmod.com/resources/documentation-api?version=2.0&page=core-api-dsp.html#dsp_reset).

> [@jiyongman](#):
>
> How can I adjust the volume of a channel group’s DSPs?

You can control the level of DSP::Connections between DSPs to achieve that, using [DSPConnection::setMix](https://fmod.com/resources/documentation-api?version=2.0&page=core-api-dspconnection.html#dspconnection_setmix).

> [@jiyongman](#):
>
> Is there really nothing to worry about with large values other than consuming more memory unlike FMOD\_System\_SetDSPBufferSize() which causes high latency?

You would be limited by the disk access speed.

---

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [June 11, 2019, 9:05am UTC](https://qa.fmod.com/t/questions-about-dsp/14739/3 "2019-06-11T09:05:25Z")

</div>

Thank you very much!

---

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [June 11, 2019, 8:58pm UTC](https://qa.fmod.com/t/questions-about-dsp/14739/4 "2019-06-11T20:58:17Z")

</div>

May I ask one more question?

What are advantages and disadvantages of FMOD\_DSP\_SetActive() over FMOD\_DSP\_SetBypass(), when I just want to disable a DSP for a few seconds to a few minutes?

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [June 11, 2019, 11:53pm UTC](https://qa.fmod.com/t/questions-about-dsp/14739/5 "2019-06-11T23:53:04Z")

</div>

SetActive stops the signal flow at the DSP, bypass passes the signal around the DSP.

---

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [June 12, 2019, 2:22pm UTC](https://qa.fmod.com/t/questions-about-dsp/14739/6 "2019-06-12T14:22:37Z")

</div>

Reading your comments, I guess, from a user’s perspective, it may seem the same as calling FMOD\_DSP\_SetBypass() and then FMOD\_DSP\_Reset() since CPU is not used either when bypassing.  
Thanks!

---

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [June 12, 2019, 2:34pm UTC](https://qa.fmod.com/t/questions-about-dsp/14739/7 "2019-06-12T14:34:22Z")

</div>

I wanted to try FMOD\_DSPConnection\_SetMix() but failed because I couldn’t get a FMOD\_DSPCONNECTION\*.  
I guess, a FMOD\_DSPCONNECTION\* can be obtained using FMOD\_ChannelGroup\_AddGroup(), but isn’t there any other way for a DSP directly added to the Master Channel Group using FMOD\_ChannelGroup\_AddDSP() and a Standard Reverb object created by FMOD\_System\_SetReverbProperties() ?

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [June 17, 2019, 1:22am UTC](https://qa.fmod.com/t/questions-about-dsp/14739/8 "2019-06-17T01:22:14Z")

</div>

You can use [DSP::getInput](https://fmod.com/resources/documentation-api?version=2.0&page=core-api-dsp.html#dsp_getinput) & [DSP::getOutput](https://fmod.com/resources/documentation-api?version=2.0&page=core-api-dsp.html#dsp_getoutput) to access the DSPConnections.

---

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [June 18, 2019, 11:27am UTC](https://qa.fmod.com/t/questions-about-dsp/14739/9 "2019-06-18T11:27:47Z")

</div>

In fact, I already had a look at them, but didn’t really think it would help because it required an index, which I have no idea at all.  
But anyway I tried again because you said it would work.

First I compared the dsp pointers resulted from FMOD\_DSP\_GetOutput() with the original dsp pointer, iterating from 0 to FMOD\_DSP\_GetNumOutputs().  
And I found two things.

1. There’s only one connection for my reverb DSP.
2. My reverb DSP pointer and the pointer from the function are not the same.

So now I simply tried calling FMOD\_DSP\_GetOutput(g\_DSP\_reverb, 0, &ouputDSP, &outputDSPConnection); and this worked for me.

My final question is,

1. If there’s any connection, will index-0 be always valid? Or do I have to iterate through the whole range and find a valid one myself?

2. If I added a dsp using FMOD\_ChannelGroup\_AddGroup() to the Master Channel Group just once, will that dsp ever have more than one input/output connections? Or can I just assume there’s always only one?

3. Can’t I call FMOD\_DSP\_GetOutput() right after FMOD\_ChannelGroup\_AddGroup()?  
In my test, I had to put some delay before calling FMOD\_DSP\_GetOutput().

Thanks.

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [June 19, 2019, 5:25am UTC](https://qa.fmod.com/t/questions-about-dsp/14739/10 "2019-06-19T05:25:31Z")

</div>

> [@jiyongman](#):
>
> If there’s any connection, will index-0 be always valid? Or do I have to iterate through the whole range and find a valid one myself?

This depends where and to what you are adding the DSP.

- All leaf Channels will have at least one output but may not have an input.
- The Master Channel Group will have inputs but no output.
- DSP’s on the tail of a ChannelGroup can have multiple outputs.

If you wanted, for example, the output of a DSP you know won’t be at the tail of a ChannelGroup you can be confident that it will only have one output.

> [@jiyongman](#):
>
> If I added a dsp using FMOD\_ChannelGroup\_AddGroup() to the Master Channel Group just once, will that dsp ever have more than one input/output connections? Or can I just assume there’s always only one?

It depends, see above.

> [@jiyongman](#):
>
> Can’t I call FMOD\_DSP\_GetOutput() right after FMOD\_ChannelGroup\_AddGroup()?  
> In my test, I had to put some delay before calling FMOD\_DSP\_GetOutput().

FMOD\_DSP\_GetOutput will flush the DSP queue (which blocks against the mixer), if you are not seeing this then it may be a bug. Do you get an FMOD\_RESULT from GetOutput that would indicate the issue?

---

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [June 19, 2019, 8:54am UTC](https://qa.fmod.com/t/questions-about-dsp/14739/11 "2019-06-19T08:54:56Z")

</div>

Thank you very much!

As for your last question,  
I get 0 from FMOD\_DSP\_GetNumOutputs(), and FMOD\_ERR\_DSP\_NOTFOUND from FMOD\_DSP\_GetOutput().  
But when I call it later AGAIN, then FMOD\_DSP\_GetNumOutputs() returns 1, and FMOD\_DSP\_GetOutput() returns FMOD\_OK.

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [June 20, 2019, 2:10am UTC](https://qa.fmod.com/t/questions-about-dsp/14739/12 "2019-06-20T02:10:26Z")

</div>

My tests are all returning the connection when calling `getOutput` immediately after adding a channelgroup/dsp.

What version of FMOD are you using?  
Are you able to share the code you are using?  
You can send it to [support@fmod.com](mailto:support@fmod.com) if you like.

---

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [June 20, 2019, 6:50am UTC](https://qa.fmod.com/t/questions-about-dsp/14739/13 "2019-06-20T06:50:53Z")

</div>

I tested it again, and found it works always fine with any channels, but it has the issue with the master channel group.

When that happened, I could workaround by either changing the option FMOD\_CHANNELCONTROL\_DSP\_HEAD to FMOD\_CHANNELCONTROL\_DSP\_TAIL,  
or adding one more dsp to the master channel group.

a. If only one dsp is added to the head, FMOD\_DSP\_GetNumOutputs() will return 0.  
b. If more than one dsps are added to the head, FMOD\_DSP\_GetNumOutputs() will return 1.  
c. If only one dsp is added to the tail, FMOD\_DSP\_GetNumInputs() will return 0.  
d. If more than one dsps are added to the tail, FMOD\_DSP\_GetNumInputs() will return 1.  
e. Mixing head and tail doesn’t help.  
f. When added to a channel, both FMOD\_DSP\_GetNumOutputs() and FMOD\_DSP\_GetNumInputs() always return 1.

I’ll attach my test code at the end.

By the way, your Core API Reference says FMOD\_DSP\_GetOutput() can accept an index which is “Range: [0, DSP::getNumOutputs]”, but it should be “Range: [0, DSP::getNumOutputs - 1]”,  
because if FMOD\_DSP\_GetNumOutputs() returns 1, then there’s only one index I can access, which is 0. The reference can be confusing to some people, I think.

* * *

Here’s my test code :

// 09/05/19 2.00.01 - FMOD Studio API minor release (build 102182)

#include \<stdio.h\>  
#include \<conio.h\>  
#include \<fmod.h\>

FMOD\_SYSTEM \*g\_System;  
FMOD\_DSP \*g\_DSP1;  
FMOD\_DSP _g\_DSP2;  
FMOD\_CHANNELGROUP_ g\_MasterChannelGroup;

void GetOutput() {  
static int count;  
static FMOD\_DSP\* ouputDSP;  
static FMOD\_DSPCONNECTION\* outputDSPConnection;

```
FMOD_DSP_GetNumOutputs(g_DSP1, &count);

FMOD_RESULT result = FMOD_DSP_GetOutput(g_DSP1, 0, &ouputDSP, &outputDSPConnection);

printf("Count:%d, Result:%d\n", count, result);

```

}

void init() {  
FMOD\_System\_Create(&g\_System);

```
FMOD_System_SetSoftwareChannels(g_System, 128);

FMOD_System_Init(g_System, 1024, FMOD_INIT_NORMAL, NULL);

FMOD_System_GetMasterChannelGroup(g_System, &g_MasterChannelGroup);

// All other DSPs including FMOD_DSP_TYPE_ECHO, FMOD_DSP_TYPE_FLANGE,
// FMOD_DSP_TYPE_PITCHSHIFT, FMOD_DSP_TYPE_LOWPASS and FMOD_DSP_TYPE_HIGHPASS lead to the same result.
FMOD_System_CreateDSPByType(g_System, FMOD_DSP_TYPE_SFXREVERB, &g_DSP1);
FMOD_System_CreateDSPByType(g_System, FMOD_DSP_TYPE_SFXREVERB, &g_DSP2);

// Adding to the tail always works : FMOD_ChannelGroup_AddDSP(g_ChannelGroup, FMOD_CHANNELCONTROL_DSP_TAIL, g_DSP1);
FMOD_ChannelGroup_AddDSP(g_MasterChannelGroup, FMOD_CHANNELCONTROL_DSP_HEAD, g_DSP1);

GetOutput();

FMOD_ChannelGroup_AddDSP(g_MasterChannelGroup, FMOD_CHANNELCONTROL_DSP_HEAD, g_DSP2);
GetOutput();

```

}

int main(void) {

```
init();

_getch();

return 0;

```

}

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [June 20, 2019, 11:00pm UTC](https://qa.fmod.com/t/questions-about-dsp/14739/14 "2019-06-20T23:00:36Z")

</div>

> [@jiyongman](#):
>
> a. If only one dsp is added to the head, FMOD\_DSP\_GetNumOutputs() will return 0.  
> b. If more than one dsps are added to the head, FMOD\_DSP\_GetNumOutputs() will return 1.

The Master Chanel Group’s head will never have an output, it is the only channel/group that does not.  
If you add a DSP to the head/tail it becomes the new head/tail, if you add another DSP it will become the new head/tail then your first DSP is now 1 DSP away from the head/tail and will have an input/output.

> [@jiyongman](#):
>
> c. If only one dsp is added to the tail, FMOD\_DSP\_GetNumInputs() will return 0.  
> d. If more than one dsps are added to the tail, FMOD\_DSP\_GetNumInputs() will return 1.

Same as above, but to get input into the Master Channel group there needs to be an active sound playing.

I recommend having a look at the [FMOD Profiler](https://fmod.com/resources/documentation-api?version=2.0&page=core-guide.html#dsp-engine-flexible-programmable-soft-synth-architecture), seeing the DSP graph may help.

---

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [June 21, 2019, 1:05pm UTC](https://qa.fmod.com/t/questions-about-dsp/14739/15 "2019-06-21T13:05:41Z")

</div>

Thank you as always!
