Set Spatializer's Sound Size Programmatically

Via the API I can set the Spatializer’s min/max distance (if it’s on the Master Track):

eventInstance->setProperty(FMOD_STUDIO_EVENT_PROPERTY_MINIMUM_DISTANCE, customValue);

I would like to be able to do the same for Spatializer > Envelopment > User > Sound Size. I can’t find it in the API documentation and suspect it isn’t possible.

Can I set Sound Size programmatically?

There isn’t an API for setting it but you can automate the Sound Size property and modify it by adjusting a parameter.

1 Like

Thanks for the reply.

I tried this solution out and, while it sets the variable correctly, it has no effect on the Spatializer (e.g. if I set the Spatializer’s sound size to 0 in FMOD Studio, but change it to 10k programmatically, it continues to behave as if the sound size were 0, a.k.a. strong left-right differences, a.k.a. no envelope).

I was able to get it working in a test.
What versions of FMOD and Unity are you using?

1 Like

Thanks for the follow up.

I’m using FMOD Studio 2.00.10.
No Unity, I’m working on Android.

Sorry, just assumed it was Unity.
Are you able to share a snippet of the code you are using?

This is where I update the sound size (and min/max distance):

    void Java_tools_jag_starball_modules_audio_FmodAudioModule_fmodUpdateEventLimits(JNIEnv *env, jobject thiz, jstring soundName, float innerLimit, float outerLimit) {
        const char* soundNamePtr = env->GetStringUTFChars(soundName, NULL);

        auto it = eventMap.find(soundNamePtr);
        if (it != eventMap.end()) {
            FMOD::Studio::EventInstance* eventInstance = it->second;
            ERRCHECK(eventInstance->setProperty(FMOD_STUDIO_EVENT_PROPERTY_MINIMUM_DISTANCE, innerLimit));
            ERRCHECK(eventInstance->setProperty(FMOD_STUDIO_EVENT_PROPERTY_MAXIMUM_DISTANCE, outerLimit));
            ERRCHECK(eventInstance->setParameterByName("SoundSize", innerLimit * 3, false));
        }
    }

(As an aside, if the SoundSize parameter is not connected to an event, I get an FMOD_EVENT_NOT_FOUND error, which is ok, but a bit misleading.)

I’ve made sure that the event is loaded (by calling flushLoading, and checking with getLoadState) and that the value of SoundSize is being set to something reasonable (e.g. 75), but still I get heavy left right panning in a small range (e.g. 10-20m from the sound source).

Here’s my FMOD Studio setup:

Are you able to reproduce this in the sandbox/profiler in FMOD Studio at all?