A shared folder with AI prompts and code snippets
From workspace: Nvidia
Team: Omniverse
Total snippets: 5
5 snippets
# set to half volume volume_multiplier = 0.5 my_audio_prim.GetAttribute("gain").Set(volume_multiplier)
# double the pitch pitch_multiplier = 2.0 my_audio_prim.GetAttribute("timeScale").Set(pitch_multiplier)
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)
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)
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 =...