resamples audio data to the specified sample rate - Maple Help

Home : Support : Online Help : Programming : Audio Processing : AudioTools/Resample

AudioTools[Resample] - resamples audio data to the specified sample rate

 Calling Sequence Resample(audArray, samplesPerSec, options)

Parameters

 audArray - Array or Matrix containing the audio data to resample samplesPerSec - desired sampling rate options - options modifying the resampling operation

Description

 • The Resample command resamples audio data, producing a new audio object with the specified sample rate.
 • The audArray parameter specifies the audio to resample, and must be a dense, rectangular, one or two dimensional Array, Vector, or Matrix with datatype=float[8].
 • The samplesPerSec parameter specifies the desired sample rate. Typical values are 11025, 22050, and 44100 samples per second.
 • By default, resampling is done using B-spline interpolation.  This produces excellent results reasonably fast.
 • If the method=nearest option is specified, resampling is done using the nearest-neighbor algorithm. This produces poorer results, but the algorithm is very fast.  This method is often suitable for producing low-quality resamplings of audio data.
 • Specifying method=bspline is equivalent to the default behavior.

Examples

 > $\mathrm{audiofile}:=\mathrm{cat}\left(\mathrm{kernelopts}\left(\mathrm{datadir}\right),"/audio/stereo.wav"\right):$
 > $\mathrm{with}\left(\mathrm{AudioTools}\right):$
 > $\mathrm{aud}:=\mathrm{Read}\left(\mathrm{audiofile}\right)$
 ${\mathrm{aud}}{:=}\left[\begin{array}{c}{\mathrm{1..19962 x 1..2}}{\mathrm{Array}}\\ {\mathrm{Data Type:}}{{\mathrm{float}}}_{{8}}\\ {\mathrm{Storage:}}{\mathrm{rectangular}}\\ {\mathrm{Order:}}{\mathrm{C_order}}\end{array}\right]$ (1)
 > $\mathrm{attributes}\left(\mathrm{aud}\right)$
 ${22050}{,}{8}{,}{1}$ (2)
 > $\mathrm{small}:=\mathrm{Resample}\left(\mathrm{aud},11025\right)$
 ${\mathrm{small}}{:=}\left[\begin{array}{c}{\mathrm{1..9981 x 1..2}}{\mathrm{Array}}\\ {\mathrm{Data Type:}}{{\mathrm{float}}}_{{8}}\\ {\mathrm{Storage:}}{\mathrm{rectangular}}\\ {\mathrm{Order:}}{\mathrm{C_order}}\end{array}\right]$ (3)
 > $\mathrm{attributes}\left(\mathrm{small}\right)$
 ${11025}{,}{8}{,}{1}$ (4)