soundduration(
IDENTIFIER
)
The soundduration( function returns the duration (in seconds) of the specified playing sound.
Parameters
This function has one parameter:
identifier – identifier for the sound (sound must already be playing).
Description
This function returns the duration (in seconds) of the specified playing sound. This example code starts playing a sound and then displays a notification with the duration of the sound.
playsound "~/Sounds/Big Ben Chime.aiff","IDENTIFIER","Chimes"
nsnotify pattern(int(soundduration("Chimes")),"# second~")
Note: The duration is a floating point number, so it can be a fractional value. (The example code above rounds the duration down to a whole number.)
See Also
- controlsound -- controls playback of a sound file.
- info("sounds") -- returns a carriage return delimited list of all currently playing sounds.
- playsound -- starts playing a sound file.
- sounddurationhhmmss( -- returns the duration (in hours:minutes:seconds) of the specified playing sound.
- soundinfo( -- returns a dictionary that contains all of the properties of a sound.
- soundplaying( -- returns true if the specified sound is currently playing, false if it is paused or not playing at all.
- soundposition( -- returns the current playback position (in seconds) of the specified playing sound.
- soundpositionhhmmss( -- returns the current playback position (in hours:minutes:seconds) of the specified playing sound.
- soundprogress( -- returns the progress of the played sound from 0 to 1.
- soundstatus( -- returns the status of the specified sound: stopped, playing or paused.
- soundvolume( -- returns the current volume of the specified playing sound.
History
10.2 | New | New in this version. |