Play - Maple Help

AudioTools

 Play
 play back audio data to a speaker

 Calling Sequence Play(audio, component)

Parameters

 audio - audio object to play back component - (optional) string; name of the Speaker component to use.

Description

 • The Play command plays audio data from the specified Audio object to a Speaker component.
 • If the component parameter is not specified, the default component name Speaker0 will be used.

Examples

In order to play back any of the following examples, open the Components Palette and insert a Speaker component.

 > $\mathrm{with}\left(\mathrm{AudioTools}\right):$

Play a stored audio file to the speaker.

 > $\mathrm{audiofile}≔\mathrm{FileTools}:-\mathrm{JoinPath}\left(\left["audio/ding.wav"\right],\mathrm{base}=\mathrm{datadir}\right)$
 > $\mathrm{Play}\left(\mathrm{Read}\left(\mathrm{audiofile}\right),"Speaker0"\right)$

Create a signal and play it back to the speaker:

 > $\mathrm{Tone}≔f↦\mathrm{Play}\left(\mathrm{Create}\left(x↦\mathrm{evalhf}\left(\mathrm{sin}\left(\frac{x\cdot \mathrm{\pi }\cdot f}{22050}\right)\right),\mathrm{duration}=1\right)\right):$
 > $\mathrm{Tone}\left(440\right)$
 > $\mathrm{Tone}\left(880\right)$

Compatibility

 • The AudioTools[Play] command was introduced in Maple 2015.