Preview - Maple Help

# Online Help

###### All Products    Maple    MapleSim

AudioTools

 Preview
 preview audio data in the worksheet in the form of an audiogram

 Calling Sequence Preview(audArray, optDuration, options)

Parameters

 audArray - Array, Vector, or Matrix; table of values containing the audio data to preview optDuration - (optional); the amount of the data to preview, in seconds options - one or more keyword options as described later

Options

 • color : color; the color or list of colors used in the preview plot
 • output : identical(plot, embed); display the returned plot as either a plot or plot with embedded audio playback control. The default is plot

Description

 • The Preview command generates a plot of audio data.
 • The audArray parameter must be a dense, rectangular, one or two dimensional Array, Vector, or Matrix with datatype=float[8].
 • The optional optDuration parameter indicates the amount of the recording to preview (in seconds). If omitted, the entire recording is previewed.
 A positive value for the optDuration parameter indicates that samples from the beginning of the recording are to be previewed.
 A negative value for optDuration specifies that samples from the end of audArray are to be previewed. The last $\left|\mathrm{optDuration}\right|$ seconds will appear in the preview.
 The duration can also be specified as a range of time values, in which case the samples falling in that time interval are previewed. Negative values are treated as mentioned earlier.
 • The audio is resampled for previewing and is displayed with the x-axis corresponding to elapsed time.
 • By default, the data is resampled for previewing by using B-spline interpolation (the default mode for the AudioTools[Scale] function). If the option method=nearest is specified, the Preview command will use the nearest-neighbor algorithm. This method is significantly faster, but produces a poorer quality audiogram.
 • The default color for the audiogram is green, as this makes it easier to read the axis labels superimposed on what is typically a very dense plot. The option color=colorSpec can be used to override this behavior. The colorSpec can be any color specification as described in the plot/color help page, or it can be a list of such specifications. If a list is given, each entry is used as the color for the corresponding channel of audio data.

Examples

 > $\mathrm{with}\left(\mathrm{AudioTools}\right):$
 > $\mathrm{audiofile}≔\mathrm{cat}\left(\mathrm{kernelopts}\left(\mathrm{datadir}\right),"/audio/stereo.wav"\right):$
 > $\mathrm{aud}≔\mathrm{Read}\left(\mathrm{audiofile}\right)$
 ${\mathrm{aud}}{≔}\left[\begin{array}{cc}{"Sample Rate"}& {22050}\\ {"File Format"}& {\mathrm{PCM}}\\ {"File Bit Depth"}& {8}\\ {"Channels"}& {2}\\ {"Samples/Channel"}& {19962}\\ {"Duration"}& {0.90531}{}{s}\end{array}\right]$ (1)
 > $\mathrm{Preview}\left(\mathrm{aud},0.2..0.4\right)$
 > $\mathrm{Preview}\left(\mathrm{aud},\mathrm{method}=\mathrm{nearest},\mathrm{color}=\left[\mathrm{gray},\mathrm{red}\right]\right)$
 > $\mathrm{Preview}\left(\mathrm{aud},0.2..0.25,\mathrm{color}="Orange",\mathrm{output}=\mathrm{embed}\right)$

Compatibility

 • The AudioTools[Preview] command was updated in Maple 2015.
 • The bubble_legend option was introduced in Maple 2015.
 • For more information on Maple 2015 changes, see Updates in Maple 2015.

 See Also