Previous Up Next

28.2.8  Extracting samples from audio clips

The channel_data command gets samples from an audio clip.

Example

Assuming that the directory sounds contains example.wav, a wav file with three seconds of stereo sound, input:

snd:=readwav("/path/to/sounds/example.wav"):; L:=channel_data(snd,left,range=1.2..1.5)

Output: A list L resp. R containing data between 1.2 and 1.5 seconds in the left resp. right channel of the original file.

L:=snd[left,27400,100]

Output: A list of 100 samples from the left channel, starting from the sample with index 27400.

L:=snd[left,1.2..1.5]

Output: A list of samples from the left channel falling between 1.2 and 1.5 seconds.


Previous Up Next