AudioTrim[audio]
trims silence from the beginning and end of audio.
AudioTrim[audio,t]
returns the first t seconds of audio.
AudioTrim[audio,-t]
returns the last t seconds of audio.
AudioTrim[audio,{t1,t2}]
returns audio starting at time t1 and ending at time t2 of audio.
AudioTrim[audio,{{t11,t12},…}]
returns a list of audio for all given intervals {ti1,ti2}.
AudioTrim
AudioTrim[audio]
trims silence from the beginning and end of audio.
AudioTrim[audio,t]
returns the first t seconds of audio.
AudioTrim[audio,-t]
returns the last t seconds of audio.
AudioTrim[audio,{t1,t2}]
returns audio starting at time t1 and ending at time t2 of audio.
AudioTrim[audio,{{t11,t12},…}]
returns a list of audio for all given intervals {ti1,ti2}.
Details and Options
- AudioTrim can be used to trim silence or extract specific intervals from an audio object.
- AudioTrim can be used to either extract interesting parts of a recording or remove uninteresting parts, e.g. silence.
- Intervals with amplitudes below
are assumed to be silent. - The time t can be any of the following:
-
t time given in seconds Quantity[t,"unit"] time given in "unit" compatible with seconds Quantity[t,"Samples"] time given as number of samples - AudioTrim takes a Padding option. See the reference page for AudioPad for possible settings.
- In AudioTrim[audio,t], when t is longer than the duration of audio, by default no extra padding is introduced.
Examples
open all close allBasic Examples (1)
Scope (4)
Take the last 2 seconds of a a signal:
a = \!\(\*AudioBox[""]\);
AudioTrim[a, -2]AudioTrim[a, {1.5, 2.5}]Specify the amount of trimming using a time Quantity:
AudioTrim[\!\(\*AudioBox[""]\), Quantity[1.5, "Seconds"]]//DurationSpecify the amount of trimming using a number of samples:
AudioTrim[\!\(\*AudioBox[""]\), Quantity[16000, "Samples"]]//AudioLengthAudioTrim[\!\(\*AudioBox[""]\), {{.2, 1}, {.6, 2}}]Applications (1)
Extract intervals that satisfy a condition:
a = ExampleData[{"Audio", "NoisyTalk"}, "Audio"]Use AudioIntervals to look for segments with high RMS amplitude:
loudIntervals = AudioIntervals[a, #RMSAmplitude > .02&, .7]AudioTrim[a, loudIntervals]Properties & Relations (1)
Partition an Audio object:
a = \!\(\*AudioBox[""]\);Define the times for partitioning:
times = Table[{i, i + Quantity[2, "Seconds"]}, {i, Quantity[0, "Seconds"], Duration@a, Quantity[2, "Seconds"]}]AudioTrim[a, times]Related Guides
History
Text
Wolfram Research (2016), AudioTrim, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioTrim.html.
CMS
Wolfram Language. 2016. "AudioTrim." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AudioTrim.html.
APA
Wolfram Language. (2016). AudioTrim. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioTrim.html
BibTeX
@misc{reference.wolfram_2026_audiotrim, author="Wolfram Research", title="{AudioTrim}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/AudioTrim.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_audiotrim, organization={Wolfram Research}, title={AudioTrim}, year={2016}, url={https://reference.wolfram.com/language/ref/AudioTrim.html}, note=[Accessed: 12-June-2026]}