FMOD Programmer Sound question - emergency!

Hello, I am trying to find a way to return 0 on those red segment where there is no volume. and returns 1 where it is above volume 0. Is there any way to do that with FMOD Programmer Sound?

I implemented Programmer Sound based on this code - https://www.fmod.com/docs/2.01/unity/examples-programmer-sounds.html

Thank you in advance-

1 Like

bump

Hi,

An option would be utilizing another one of our scripting examples, Unity Integration | Scripting Examples - DSP Capture, and combining it with the Programmer Sounds example that you are currently using.

The example creates a DSP (FMOD API | Core API Reference - DSP) which is attached to the Master Channel Group (FMOD API | Core API Reference - Channel Group). I would suggest attaching it to the events channel group for more accurate results.

The value we are checking is the mDataBuffer[i]. There are a couple of checks that we can add that will hopefully improve our results:

  1. Rather than just checking mDataBuffer[i] for 0, use a threshold that will hopefully filter out any ambient sound that could still be considered silence.
  2. Also adding a sensitivity buffer that will check multiple samples in a row for our threshold will help filter out false zero crossover readings.

Hope this helps!

Hello there,

So, in order to get a specific event’s volume I assume I need to grab its Group’s ChannelGroup?

So I have group as below - is that my “channel group”?

Then, I copied its path:
2

which is “bus:/VO”.

The, I tried to get

var bus = RuntimeManager.GetBus("bus:/VO");
            if (bus.getChannelGroup(out var channelGroup) == FMOD.RESULT.OK)
            {
                if (FMODUnity.RuntimeManager.CoreSystem.createDSP(ref desc, out mCaptureDSP) == FMOD.RESULT.OK)
                {
                    if (channelGroup.addDSP(0, mCaptureDSP) != FMOD.RESULT.OK)
                    {
                        Debug.Log("FMOD: Unable to add mCaptureDSP to the master channel group");
                    }
                }
                else
                {
                    Debug.Log("FMOD: Unable to create a DSP: mCaptureDSP");
                }
            }
            else
            {
                Debug.Log("FMOD: Unable to create a master channel group: masterCG");
            }

and it goes to “Debug.Log(“FMOD: Unable to create a master channel group: masterCG”);”…
Then, it showed " ERR_STUDIO_NOT_LOADED" code for the result.

I am using code from here: https://www.fmod.com/docs/2.01/unity/examples-dsp-capture.html

Please help me.

1 Like

Hi,

The issue is the VO bus’ channel group won’t be created until there is an event or sound being played through it.

There are two options, waiting to add the DSP after the event has been played, or forcing the channel group to be created before a sound is played on it.

I would suggest loading the channel group into memory which will allow you to add the DSP. To do so you will want to call Bus.lockChannelGroup() (FMOD API | Studio API Reference - Bus), while this will begin the process of loading the channel group it will not be immediately, so you can use the function StudioSystem.flushCommands() (FMOD API Studio API Reference - System) which will ensure the channel group is created.

You will have to remember to call Bus.unlockChannelGroup() to allow the channel group to be cleaned up with the system closing.

Hope this helps!