Audio

A shared folder with AI prompts and code snippets

From workspace: Nvidia

Team: Omniverse

Total snippets: 5

Nvidia

Audio

5 snippets

Set the Volume

# set to half volume volume_multiplier = 0.5 my_audio_prim.GetAttribute("gain").Set(volume_multiplier)

Set the Pitch

# double the pitch pitch_multiplier = 2.0 my_audio_prim.GetAttribute("timeScale").Set(pitch_multiplier)

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)

my_audio_prim.GetAttribute("loopCount").Set(-1)

Play a Looping audio clip

Use a Prim to play a looping Audio Clip.

audio = omni.usd.audio.get_stage_audio_interface() my_audio_prim.GetAttribute("loopCount").Set(-1) audio.spawn_voice(prim)

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) my_audio_prim.GetAttribute("loopCount").Set(0) audio =...

Nvidia - Audio - AI Prompts & Code Snippets | Snippets AI