Previous Up Next

28.2.2  New audio clips from existing ones

You can create audio clips from existing ones by using some standard operators.

Slicing.

Audio clips can be obtained from existing clips by slicing. To extract a portion of length n samples starting at kth sample in an audio clip clip, use the () operator like this:

subclip:=clip(k,n)

The second argument may be omitted, in which case n=Lk is used, where L is the length of clip in samples. You can also use

subclip:=clip(t1..t2)

to extract the portion between timestamps t1 and t2 (in seconds).

Concatenation.

Existing audio clips can be concatenated together by using the + operator. Note that clips to be concatenated must have the same number of channels, bit depth and sample rate. For example, to concatenate two audio clips clip1 and clip2, input:

clip:=clip1+clip2

This is useful for e.g. padding audio with zeros (silence).

Inverting and reversing.

Audio clips can be inverted (which is equivalent to multiplying sample data with −1 for each channel) by using the unary sign operator - or the inv command which takes an audio clip as its only argument.

To reverse an audio clip in the time domain, use the reverse command which takes an audio clip as its only argument.


Previous Up Next