Similar to Game Engines like Unity and Unreal, Audio in Omniverse, is location based. This means that in order to play an AudioClip, you need to first attach it to a prim. Once this clip is attached, attributes can be tweaked in order to achieve specific effects.

Play audio clips

Play an Audio Clip Once

Use a Prim to play an Audio Clip once.

import omni

usd_context = omni.usd.get_context()
stage = usd_context.get_stage()
my_audio_prim = stage.GetPrimAtPath(my_audio_prim_path)

audio =

Play a Looping audio clip

Use a Prim to play a looping Audio Clip.

audio =

Set the loop count

The loopCount attribute tells the audio engine how many times to loop a sound. The value -1 is used to loop a sound indefinitely, 0 is used to play the audio clip just once, 1 and up plays it n+1 times (where n is the value of loopCount)


Modify Audio Attributes

You can programmatically change several attributes of an audio prim. The most common ones to adjust would be pitch (timeScale) and volume (gain) which can be dynamically changed as the sound is being played.

Set the Pitch

# double the pitch
pitch_multiplier = 2.0

Set the Volume

# set to half volume
volume_multiplier = 0.5