Immerse SDK
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Audio Tags

Audio tags can be used to filter voice chat within a session. For example, if you want to have a discussion in smaller groups within a session or if you wanted to simulate one way communication such as a PA system.

Each audio tag must be defined in the Immerse SDK Voice foldout in Project Settings. Audio tags must be unique and changes must be pushed to the platform before they will become available. This can be done by pressing the Update Project button or uploading a new build that contains an updated metadata.json file.

Audio tags configuration

By setting the Is Default option, this audio tag will be added to all new users as they connect to a session. Users with no audio tags will not be able to hear or speak to anyone else in the session.

Having no audio tags assigned is treated as it’s own tag. i.e. Uses that have no listening tags will hear users that have no speaking tags.

Changing Audio Tags

The most direct way to control audio tags is by creating an AudioTagChangeRequest. Below is an example script that contains example methods showing how to listen and speak to an audio tag.

using ImmerseSDK.PlatformServices.Voice.AudioTags;
using UnityEngine;

/// <summary>
/// Example methods that show how to enable/disable listening and speaking to audio tags
/// </summary>
public class AudioTagsExample : MonoBehaviour
{
    [SerializeField]
    [Tooltip("Name of the audio tag")]
    private string _audioTag = "Global";

    /// <summary>
    /// Start listening to the audio tag
    /// </summary>
    public void EnableListening()
    {
        var descriptor = new AudioTagChangeRequest();
        descriptor.ListenTo(_audioTag);
        descriptor.SendChangeRequest();
    }
    
    /// <summary>
    /// Stop listening to the audio tag
    /// </summary>
    public void DisableListening()
    {
        var descriptor = new AudioTagChangeRequest();
        descriptor.StopListeningTo(_audioTag);
        descriptor.SendChangeRequest();
    }

    /// <summary>
    /// Start speaking to the audio tag
    /// </summary>
    public void EnableSpeaking()
    {
        var descriptor = new AudioTagChangeRequest();
        descriptor.SpeakTo(_audioTag);
        descriptor.SendChangeRequest();
    }

    /// <summary>
    /// Stop speaking to the audio tag
    /// </summary>
    public void DisableSpeaking()
    {
        var descriptor = new AudioTagChangeRequest();
        descriptor.StopSpeakingTo(_audioTag);
        descriptor.SendChangeRequest();
    }

    /// <summary>
    /// Start listening AND speaking to the audio tag
    /// </summary>
    public void JoinAudioTag()
    {
        var descriptor = new AudioTagChangeRequest();
        descriptor.ListenTo(_audioTag);
        descriptor.SpeakTo(_audioTag);
        descriptor.SendChangeRequest();
    }

    /// <summary>
    /// Stop listening AND speaking to the audio tag
    /// </summary>
    public void LeaveAudioTag()
    {
        var descriptor = new AudioTagChangeRequest();
        descriptor.StopListeningTo(_audioTag);
        descriptor.StopSpeakingTo(_audioTag);
        descriptor.SendChangeRequest();
    }
}

Audio Tag Volumes

Audio tags can also be controlled using the AudioTagVolume component. This component is designed to change a user’s audio tags when their avatar enters/exits a trigger collider.

The example shows how to set up an audio tag volume that will allow a user to speak and listen to the ‘Red’ audio tag when their avatar enters the box collider and will remove these audio tags when leaving.

AudioTagVolume component and BoxCollider trigger

Field Description
Audio Tag Behaviour Additive: Add the listed audio tags when entering
Subtract: Remove the listed audio tags when entering
Set: Remove all audio tags, apart from those listed, when entering
Reverse on Exit If the enter behaviour should be reversed when the avatar exits.
(This option is not available with the Set behaviour)
Speaking Audio Tags Speaking audio tags to be changed
Listening Audio Tags Listening audio tags to be changed