You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
3.0 KiB
70 lines
3.0 KiB
<script type="text/x-red" data-help-name="AudioPlaySdWav">
|
|
<h3>Summary</h3>
|
|
<div class=tooltipinfo>
|
|
<p>Play a WAV file, stored on a SD card.</p>
|
|
</div>
|
|
<h3>Audio Connections</h3>
|
|
<table class=doc align=center cellpadding=3>
|
|
<tr class=top><th>Port</th><th>Purpose</th></tr>
|
|
<tr class=odd><td align=center>Out 0</td><td>Left Channel Output</td></tr>
|
|
<tr class=odd><td align=center>Out 1</td><td>Right Channel Output</td></tr>
|
|
</table>
|
|
<h3>Functions</h3>
|
|
<p class=func><span class=keyword>play</span>(filename);</p>
|
|
<p class=desc>Begin playing a WAV file. If a file is already playing,
|
|
it is stopped and this file starts playing from the beginning.
|
|
</p>
|
|
<p class=func><span class=keyword>stop</span>();</p>
|
|
<p class=desc>Stop playing. If not playing, this function has no effect.
|
|
</p>
|
|
<p class=func><span class=keyword>isPlaying</span>();</p>
|
|
<p class=desc>Return true (non-zero) if playing, or false (zero)
|
|
when not playing. See the note below about delayed start.
|
|
</p>
|
|
<p class=func><span class=keyword>positionMillis</span>();</p>
|
|
<p class=desc>While playing, return the current time offset, in
|
|
milliseconds. When not playing, the return from this function
|
|
is undefined.
|
|
</p>
|
|
<p class=func><span class=keyword>lengthMillis</span>();</p>
|
|
<p class=desc>Return the total length of the current sound clip,
|
|
in milliseconds. When not playing, the return from this function
|
|
is undefined.
|
|
</p>
|
|
<h3>Examples</h3>
|
|
<p class=exam>File > Examples > Audio > WavFilePlayer
|
|
</p>
|
|
<h3>Notes</h3>
|
|
<p>Only 16 bit PCM, 44100 Hz WAV files are supported. When mono
|
|
files are played, both output ports transmit a copy of the
|
|
single sound. Of course, stereo WAV files play with the left
|
|
channel on port 0 and the right channel on port 1.
|
|
</p>
|
|
<p>A brief delay after calling play() will usually occur before
|
|
isPlaying() returns true and positionMillis() returns valid
|
|
time offset. WAV files have a header at the beginning of the
|
|
file, which the audio library must read and parse before
|
|
playing can begin.
|
|
</p>
|
|
<p>While playing, the audio library accesses the SD card automatically.
|
|
If card access is required, you must
|
|
<a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">use AudioNoInterrupts()</a>
|
|
to prevent the library from accessing the SD card while you use it.
|
|
Disabling the audio library interrupt for too long may cause audible
|
|
dropouts or glitches.
|
|
</p>
|
|
<p>An experimental SD library optimization exists, which can remove these
|
|
SD library restrictions. It also allows reliable playback of more
|
|
files at the same time. To enable this special code, find and edit
|
|
the SD_t3.h file within your Arduino folder. See the comments within
|
|
that file for details.
|
|
</p>
|
|
|
|
</script>
|
|
<script type="text/x-red" data-template-name="AudioPlaySdWav">
|
|
<div class="form-row">
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
</div>
|
|
</script>
|
|
|
|
|