Previous Up Next

13.1.4  Preparing digital sound data: soundsec

The soundsec prepares sound data in the form of a vector.

The soundsec command takes as argument a real number, and an optional second argument of another real number.

soundsec returns sound data with duration (in seconds) given by the argument. The optional second argument determines the sampling frequency. The sound data is returned as a vector, whose ith element is the time corresponding to index i.
Input:

soundsec(2.5)

returns sound data 2.5 seconds long sampled at the default frequency of 44100 Hz.
Input:

soundsec(1,22050)

returns sound data 1 second long sampled at the frequency of 22050 Hz.
Input:

sin(2*pi*440*soundsec(1.3))

returns a sinusoid with frequency 440 Hz sampled 44100 times per second for 1.3 seconds.


Previous Up Next