Your Ad Here

Go to: Synopsis. Flags. Return value. Python examples.

Synopsis

sound( [objects] , [file=string], [length=boolean], [name=node], [offset=time])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

sound is undoable, queryable, and editable.

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

file, length, name, offset
Long name (short name) [argument types] Properties
file(f) string createqueryedit
Name of sound file.

In query mode, this flag needs a value.

offset(o) time createqueryedit
Time at which to start the sound.

In query mode, this flag needs a value.

name(n) node createqueryedit
Name to give the resulting audio node.

In query mode, this flag needs a value.

length(l) boolean query
The length (in the current time unit) of the sound.

In query mode, this flag needs a value.


Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Return value


string Name of resulting audio node

Python examples

import maya.cmds as cmds

# 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".
#
cmds.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' )
cmds.timeControl( gPlayBackSlider, edit=True, sound='audio1' )

  

Return to Autodesk Index


Your Ad Here