AudioLength[audio]
returns the number of samples in the Audio object audio.
AudioLength
AudioLength[audio]
returns the number of samples in the Audio object audio.
Details
- AudioLength returns the actual number of samples stored in each channel of the Audio object.
- The duration of an audio is computed as the number of samples divided by the sample rate.
Examples
open all close allBasic Examples (2)
Number of samples of an Audio object:
AudioLength[\!\(\*AudioBox[""]\)]Number of samples of an audio file:
AudioLength[\!\(\*AudioBox[""]\)]Scope (1)
Properties & Relations (1)
Compute the duration from length and sample rate:
a = Audio["ExampleData/car.mp3"];length = AudioLength[a]sr = AudioSampleRate[a]N[QuantityMagnitude[length] / QuantityMagnitude[sr]]This would be the same as what Duration computes:
Duration[a]Related Guides
History
Text
Wolfram Research (2016), AudioLength, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioLength.html.
CMS
Wolfram Language. 2016. "AudioLength." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AudioLength.html.
APA
Wolfram Language. (2016). AudioLength. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioLength.html
BibTeX
@misc{reference.wolfram_2026_audiolength, author="Wolfram Research", title="{AudioLength}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/AudioLength.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_audiolength, organization={Wolfram Research}, title={AudioLength}, year={2016}, url={https://reference.wolfram.com/language/ref/AudioLength.html}, note=[Accessed: 12-June-2026]}