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 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:
  • ttime 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 allclose all

Basic Examples  (1)

Import sound as an audio object:

In[1]:=
Click for copyable input

Trim the silence at the beginning and end:

In[2]:=
Click for copyable input
Out[2]=

Take the first 2 seconds:

In[3]:=
Click for copyable input
Out[3]=

Take the last 2 seconds:

In[4]:=
Click for copyable input
Out[4]=

Take from time 1.5 to 2.5:

In[5]:=
Click for copyable input
Out[5]=

Scope  (3)

Applications  (1)

Properties & Relations  (1)

See Also

AudioDelete  AudioSplit  AudioIntervals  AudioLocalMeasurements  AudioPad  AudioData  AudioChannelSeparate  StringTrim  ImageTrim

Introduced in 2016
(11.0)