Param drives pitch effect in FMOD Studio, but not in Unity

Hello, I have an FMOD Event I set up with a local parameter called “Power”. It’s a looping hum sound that gets both higher in pitch and also louder as the Power param moves from 0 to 1. In FMOD Studio, moving the parameter works as designed. However, when this sound is playing in Unity, adjusting the Power parameter only changes the volume of the sound. The pitch stays static.

The FMOD Event has a Pitch Shifter component on the Master Track and also on each of its 3 Logic Tracks (4 in total). The automation is applied on the Pitch Shifter Pitch setting on the Master Track, with the other pitch settings set statically. It seems like these components are being ignored completely, because the pitch that I hear in game is the same as if the Pitch Shifters in FMOD Studio were bypassed.

I had the thought that maybe having multiple Pitch Shifters was causing the problem, but removing them from the individual tracks (leaving just the one on the Master Track), rebuilding and retesting didn’t seem to make a difference.

I’ve seen this sort of thing a couple of times but haven’t been able to sort out the cause or how to fix it. I do have plenty of other sounds with parameter-driven pitch automation that work fine.

I’m using FMOD Studio 2.02.11.

Hi,

Thank you for all the information.

Would it be possible to get screenshots of the event in FMOD Studio showing all the pitch shifters and the automation attached to them? Also, could I get a code snippet outlining how you control the parameter value in Unity?

I created a simple event and was not able to reproduce the issue. Are there any logs in the Unity console that you can share?

Thanks for your response. Yeah, of course! Screenshots are attached of the Event with each track selected so you can see the params. The automation is currently removed from the pitch on the individual tracks.




Here’s the code I’m using to fade the parameter to a target value. We use DOTween. (This component also keeps a Dictionary of Events by name so it’s easy to get a reference to the event instance.)

    public static DG.Tweening.Core.TweenerCore<float, float, DG.Tweening.Plugins.Options.FloatOptions> FadeParam(string eventName, string paramName, float to, float duration, AnimationCurve curve) {
      DG.Tweening.Core.TweenerCore<float, float, DG.Tweening.Plugins.Options.FloatOptions> tween;

      EventInstance instance = events[eventName].EventInstance;

      tween = DOTween
        .To(() => {
          instance.getParameterByName(paramName, out float val);
          return val;
        }, (v) => instance.setParameterByName(paramName, v), to, duration);

      if (curve != null) {
        tween.SetEase(curve);
      } else {
        tween.SetEase(Ease.InOutSine);
      }

      return tween;
    }

Thank you for the images and the code.

Could I suggest adding a Studio::EventInstance::isValid() call after retrieving the instance?

EventInstance instance = events[eventName].EventInstance;
if (instance.isValid())
    // Manipulate params
else
   // There is an issue retrieving the instance

Do you still experience the issue when not using DOTween? Is it possible to return any of the FMOD.RESULT calls from this function?

Thanks for the response and the suggestion. This method returns a DOTween tween, so it’s not super straightforward to make the proposed changes, but we can use the following method for now to isolate our testing from any tweens or fades, just setting the parameter directly:

   public static FMOD.RESULT SetEventParam(string eventName, string paramName, float value) {
      if (!events.ContainsKey(eventName)) {
        return FMOD.RESULT.OK;
      }

      EventInstance instance = events[eventName].EventInstance;

      if (!instance.isValid()) {
        Debug.LogWarning("Tried to set parameter " + paramName + " on invalid event instance " + eventName);
        return FMOD.RESULT.OK;
      }

      return events[eventName].EventInstance.setParameterByName(paramName, value);
    }

This still has the same issue. The pitch isn’t changing. The volume and the tremolo frequency (which you may have noticed from the screenshots is also automated) do change as expected. The FMOD.Result is “OK” for each call to set the Power level, which is being set to .25f, .5f, .75f, and 1f, in that order. There are no errors or warnings logging in the console that I can see.

1 Like

Thank you for the update code, I was able to test that on my side and it does seem to be working. Would it be possible to package the project, with banks included:
image


and upload them to your profile, please note that you need to register a project with us before uploading to your profile. This will allow me to try setting the params with the code on my side.

Yeah, you bet. Our project is really massive, so I wanted to give you a limited test case. I deleted all the Events and Assets I could that weren’t related to this particular issue and then just as a test wired this limited project up in Unity to verify the issue is still happening, and it is. So hopefully that’s helpful. You should be able to find it on my profile as “FMOD Project test case.fspackage”.

By the way, if you want to look at another issue, there is also an Event in that project package at event:/UI/Music/Previous Versions/Night Frights which I was unable to delete. Each time I tried, FMOD Studio crashed. (This issue is less of a priority for us, but still thought you might want to know about it.)

Thanks!

1 Like

Thank you for the project. I have tested with some of my audio files and I am not sure if it is the expected behaviour.

Would it be possible to share just the build banks? That way, I can load them in my test scene, play the same events you have, and then record a profiler session to confirm it is not working as expected.

I have been able to reproduce the crash when deleting the event. I have passed it on to our development team to investigate further. Thank you for bringing this to our attention.

Of course, no problem. I’ve uploaded our Build folder compressed as Build.zip. Let me know if you need anything else from me. Thanks.