pymel.core.animation.sound

sound(*args, **kwargs)

Creates an audio node which can be used with UI commands such as soundControl or timeControl which support sound scrubbing and sound during playback.

Flags:

Long Name / Short Name Argument Types Properties
endTime / et time ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Time at which to end the sound.
file / f unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Name of sound file.
length / l bool ../../../_images/query.gif
  Query the length (in the current time unit) of the sound.
mute / m bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Mute the audio clip.
name / n unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Name to give the resulting audio node.
offset / o time ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Time at which to start the sound.
sourceEnd / se time ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Time offset from the start of the sound file at which to end the sound.
sourceStart / ss time ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Time offset from the start of the sound file at which to start the sound. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.sound

Example:

import pymel.core as pm

# Create an audio node for a sound file, and have it
# start at time 10.  This command will return the name
# of the created node, something like "audio1".
#
pm.sound( offset=10, file='ohNo.aiff' )

# In order to have this sound displayed in a
# timeControl widget (like the timeSlider) use a
# command like this one, where the global MEL variable
# $gPlayBackSlider is the name of the widget to display
# the sound in.
#
import maya.mel
gPlayBackSlider = maya.mel.eval( '$tmpVar=$gPlayBackSlider' )
pm.timeControl( gPlayBackSlider, edit=True, sound='audio1' )