Duration
Duration[expr]
returns the duration of expr.
Details

- Duration can be computed on Audio and Sound objects as well as sound primitives.
- Some supported objects are:
-
Audio[samples] length of samples divided by sample rate DateInterval[{start,end}] duration between start and end Sound[prims] computed from sound primitives prims Sound[prims,t] Sound[prims,{tmin,tmax}] SampledSoundList[{a1,…,an},r] SampledSoundFunction[f,n,r] SoundNote[spec] SoundNote[spec,t] SoundNote[spec,{tmin,tmax}] TimeSeries[…] difference between last time and first time Video[…] approximate duration of video, audio and subtitle tracks
Examples
open allclose allBasic Examples (1)
Duration of an Audio object:
Scope (5)
Applications (1)
Get the Audio duration in seconds:
Properties & Relations (4)
Duration automatically optimizes the unit of the result:
For Audio, dividing the number of samples by the sample rate is equivalent to the duration:
Audio duration can be computed by dividing the number of samples by the sample rate:
The duration of audio files can be imported directly from the file:
Compare with the duration of the imported audio:
Duration returns approximate duration for video files:
Compare with the "Duration" element in Import:
Get exact durations for all tracks using "ExactDurations" element:
Computing "Duration" is typically faster than computing "ExactDurations":
Text
Wolfram Research (2016), Duration, Wolfram Language function, https://reference.wolfram.com/language/ref/Duration.html (updated 2020).
CMS
Wolfram Language. 2016. "Duration." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/Duration.html.
APA
Wolfram Language. (2016). Duration. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Duration.html