<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Audio Player (GNU Octave (version 5.1.0))</title> <meta name="description" content="Audio Player (GNU Octave (version 5.1.0))"> <meta name="keywords" content="Audio Player (GNU Octave (version 5.1.0))"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="makeinfo"> <link href="index.html#Top" rel="start" title="Top"> <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="Audio-Processing.html#Audio-Processing" rel="up" title="Audio Processing"> <link href="Playback.html#Playback" rel="next" title="Playback"> <link href="Audio-Device-Information.html#Audio-Device-Information" rel="prev" title="Audio Device Information"> <style type="text/css"> <!-- a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} blockquote.smallindentedblock {margin-right: 0em; font-size: smaller} blockquote.smallquotation {font-size: smaller} div.display {margin-left: 3.2em} div.example {margin-left: 3.2em} div.lisp {margin-left: 3.2em} div.smalldisplay {margin-left: 3.2em} div.smallexample {margin-left: 3.2em} div.smalllisp {margin-left: 3.2em} kbd {font-style: oblique} pre.display {font-family: inherit} pre.format {font-family: inherit} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} pre.smalldisplay {font-family: inherit; font-size: smaller} pre.smallexample {font-size: smaller} pre.smallformat {font-family: inherit; font-size: smaller} pre.smalllisp {font-size: smaller} span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} --> </style> <link rel="stylesheet" type="text/css" href="octave.css"> </head> <body lang="en"> <a name="Audio-Player"></a> <div class="header"> <p> Next: <a href="Audio-Recorder.html#Audio-Recorder" accesskey="n" rel="next">Audio Recorder</a>, Previous: <a href="Audio-Device-Information.html#Audio-Device-Information" accesskey="p" rel="prev">Audio Device Information</a>, Up: <a href="Audio-Processing.html#Audio-Processing" accesskey="u" rel="up">Audio Processing</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> </div> <hr> <a name="Audio-Player-1"></a> <h3 class="section">33.3 Audio Player</h3> <p>The following methods are used to create and use audioplayer objects. These objects can be used to play back audio data stored in Octave matrices and arrays. The audioplayer object supports playback from various devices available to the system, blocking and non-blocking playback, convenient pausing and resuming and much more. </p> <a name="XREF_0040audioplayer_002faudioplayer"></a><dl> <dt><a name="index-audioplayer"></a><em><var>player</var> =</em> <strong>audioplayer</strong> <em>(<var>y</var>, <var>fs</var>)</em></dt> <dt><a name="index-audioplayer-1"></a><em><var>player</var> =</em> <strong>audioplayer</strong> <em>(<var>y</var>, <var>fs</var>, <var>nbits</var>)</em></dt> <dt><a name="index-audioplayer-2"></a><em><var>player</var> =</em> <strong>audioplayer</strong> <em>(<var>y</var>, <var>fs</var>, <var>nbits</var>, <var>id</var>)</em></dt> <dt><a name="index-audioplayer-3"></a><em><var>player</var> =</em> <strong>audioplayer</strong> <em>(<var>recorder</var>)</em></dt> <dt><a name="index-audioplayer-4"></a><em><var>player</var> =</em> <strong>audioplayer</strong> <em>(<var>recorder</var>, <var>id</var>)</em></dt> <dd><p>Create an audioplayer object that will play back data <var>y</var> at sample rate <var>fs</var>. </p> <p>The optional arguments <var>nbits</var>, and <var>id</var> specify the bit depth and player device id, respectively. Device IDs may be found using the audiodevinfo function. Given an audioplayer object, use the data from the object to initialize the player. </p> <p>The signal <var>y</var> can be a vector or a two-dimensional array. </p> <p>The following example will create an audioplayer object that will play back one second of white noise at 44100 sample rate using 8 bits per sample. </p> <div class="example"> <pre class="example">y = 0.25 * randn (2, 44100); player = audioplayer (y, 44100, 8); play (player); </pre></div> </dd></dl> <table class="menu" border="0" cellspacing="0"> <tr><td align="left" valign="top">• <a href="Playback.html#Playback" accesskey="1">Playback</a>:</td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top">• <a href="Player-Properties.html#Player-Properties" accesskey="2">Player Properties</a>:</td><td> </td><td align="left" valign="top"> </td></tr> </table> </body> </html>