\(\text{PlayAudio}\)

You can use the \(\text{PlayAudio}\) function to send auto output to the computer’s sound card.

You can use the \playaudio backslash command to insert this function.

The following variants of this function are available:

  • \(\text{boolean } \text{PlayAudio} \left ( \text{<tuple>} \right )\)

  • \(\text{boolean } \text{PlayAudio} \left ( \text{<sample rate>}, \text{<c0 sample data>} \right )\)

  • \(\text{boolean } \text{PlayAudio} \left ( \text{<sample rate>}, \text{<c0 sample data>}, \text{<c1 sample data>} \right )\)

You can use this function several different ways:

  • You can provide a tuple containing the sample rate, in Hertz, followed by either one or two channels of channel data.

  • You can provide the sample rate, in Hertz, followed by one or two channels of channel data.

Channel data can be provided as integer or real row or column matrices. If needed, the \(\text{PlayAudio}\) function will perform sample rate conversion using a windowed sinc function based sample rate converter.

The \(\text{PlayAudio}\) function will also remove any DC content and rescale the provided audio based on the maximum value across all provided channel data.

Figure 165 shows the basic use of the \(\text{PlayAudio}\) function.