0
0

Is there a way in fmod to create a directional audio emitter where the sound is projected like a megaphone or a person speaking from their mouth where the emitter sound falls off according to a cone shape instead of the default spherical falloff?

  • You must to post comments
0
0

OK, figured it out. I’m just calling FMOD_StudioEventEmitter.StartEvent() and things sound correct now. Seems like a lot of the code snippets that have been posted are outdated now so just calling FMOD_StudioEventEmitter.StartEvent() seems to work well since I know FMOD has updated that class. I’m using Version 1.03.06 of the Unity integration. Below is my code followed by my settings for the different directional parameters. The last parameter is a custom parameter called "Occlusion" where I intend to eventually fade out the Master volume when the voice emitter is occluded by walls.

It sounds pretty good, although I haven’t tuned it very much. Should work well for a situation where there are lots of characters in a scene (e.g. a cocktail party) where you should be able to focus on different people’s dialogue just by facing them.

I added the FMOD_StudioEventEmitter.cs script to my emitter object and then the following script to trigger the event:

[code:1dqshvmn]
using UnityEngine;
using System.Collections;
using FMOD.Studio;

public class SpeechPlayer : MonoBehaviour {

FMOD_StudioEventEmitter emitter;

void Start () {
    emitter = transform.GetComponent<FMOD_StudioEventEmitter>();
    emitter.StartEvent();
}

}
[/code:1dqshvmn]

Directional Parameter Settings:
[attachment=0:1dqshvmn]FMOD_Directional_Audio_Settings.jpg[/attachment:1dqshvmn]

  • You must to post comments
0
0

Hi bradowado,

The "Built-In" parameters are automatically updated inside FMOD based on the 3D attributes passed in to FMOD. If you’re using the FMODListener and the FMOD_StudioEventEmitter or FMOD_StudioSystem.PlayOneShot, this 3D information is already passed through to FMOD. To make a directional sound just create a volume automation controlled by the Cone Angle parameter.

  • You must to post comments
0
0

I created a volume automation for the Event Cone Angle parameter and set the maximum value = 10, but I don’t hear any effect inside Unity and when I try and get the parameter it returns null. Here is my code which is attached to my Main Camera alongside the FMOD_Listener script:

[code:32kiy8j1]
using UnityEngine;
using System.Collections;
using FMOD.Studio;

public class ForumCode : MonoBehaviour {
FMOD_StudioSystem soundSystem;
FMOD.Studio.EventInstance speechEvent;
FMOD.Studio.ParameterInstance coneAngle;
float pos = 0;
int parameterCount;

void Start () {
    //Cache the FMOD_StudioSystem instance for easier access
    soundSystem = FMOD_StudioSystem.instance;

    //declare a string variable holding the file name. The Application.dataPath is needed so that
    //the sounds work both in the editor and in standalone builds
    string fileName = Application.dataPath + "/StreamingAssets/Master Bank.bank";

    //Load the FMOD bank
    FMOD.Studio.Bank bank;
    FMOD_StudioSystem.ERRCHECK(soundSystem.System.loadBankFile(fileName, LOAD_BANK_FLAGS.NORMAL, out bank));
    //Also load the corresponding strings bank so that we can find the events by their names
    FMOD.Studio.Bank bankStrings;
    FMOD_StudioSystem.ERRCHECK(soundSystem.System.loadBankFile(fileName + ".strings", LOAD_BANK_FLAGS.NORMAL, out bankStrings));

    speechEvent = soundSystem.getEvent("event:/Speech");
    var attributes = FMOD.Studio.UnityUtil.to3DAttributes(transform.position);
    FMOD_StudioSystem.ERRCHECK( speechEvent.set3DAttributes(attributes) );

    FMOD_StudioSystem.ERRCHECK(speechEvent.getParameter("AUTOMATIC_EVENT_CONE_ANGLE", out coneAngle));
    FMOD_StudioSystem.ERRCHECK(speechEvent.getParameterCount(out parameterCount));

    FMOD_StudioSystem.ERRCHECK(speechEvent.start());
    print ("parameterCount: " + parameterCount + ", coneAngle: " + coneAngle);

}

void Update () {

}

void OnDisable(){
    FMOD_StudioSystem.ERRCHECK(speechEvent.stop());
    FMOD_StudioSystem.ERRCHECK(speechEvent.release());
}

}
[/code:32kiy8j1]

  • You must to post comments
0
0

After searching the FMOD Studio Manual I see on pg. 99 that there are the Direction, Elevation and Cone Angle parameters so I’ll look into enabling that in Unity, but if anyone knows some tips for this please let me know!

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.