This repository has been archived on 2024-09-22. You can view files and clone it, but cannot push or open issues or pull requests.
pbi-ide/help/BasicStampHelp/Content/LanguageTopics/Commands/SOUND.htm

113 lines
5.9 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="6" MadCap:lastHeight="94" MadCap:lastWidth="853" MadCap:disableMasterStylesheet="true" MadCap:tocPath="" MadCap:InPreviewMode="false" MadCap:PreloadImages="false" MadCap:RuntimeFileType="Topic" MadCap:TargetType="WebHelp" lang="en-us" xml:lang="en-us" MadCap:PathToHelpSystem="../../../" MadCap:HelpSystemFileName="Default.xml" MadCap:SearchType="Stem">
<head><title>SOUND</title>
<link href="../../SkinSupport/MadCap.css" rel="stylesheet" />
<link href="../../Resources/Stylesheets/BSE_Help.css" rel="stylesheet" />
<script src="../../SkinSupport/MadCapAll.js" type="text/javascript">
</script>
</head>
<body>
<h1 class="code">SOUND</h1>
<div class="ImagePlusCaption">
<div class="Col2">
<p>
<img src="../../graphics/pgm_icon1.gif" border="0" alt="BS1 icon" title="BS1 icon" /><span class="code_in_text"> {PBASIC&#160;1.0}</span>
</p>
</div>
<p style="text-align: right;"><a href="../ExampleTopics/SoundEx.htm" target="" title="" alt="" class="MCXref_0" xrefformat="{paratext}">SOUND Example</a>
</p>
<p>&#160;</p>
</div>
<p class="clear">&#160;</p>
<p>&#160;</p>
<p class="PlainText">Syntax: <span class="keyword_in_text">SOUND</span> <![CDATA[ ]]><i>Pin</i>, (<i>Note</i>,<i> Duration </i>{,<i> Note, Duration</i>...})</p>
<h2>Function</h2>
<p class="PlainText">Generate square-wave tones for a specified duration.
</p>
<ul>
<li value="1"><b><i>Pin</i></b> is a variable/constant (0 - 7) that specifies the I/O pin
to use. This pin will be set to output mode.</li>
<li value="2"><b><i>Note</i></b> is a variable/constant (0 - 255) specifying the type and
frequency of the tone. 1 - 127 are ascending tones and 128 - 255 are ascending
white noises ranging from buzzing (128) to hissing (255).</li>
<li value="3"><b><i>Duration</i></b> is a variable/constant (1 - 255) specifying the amount
of time to generate the tone(s). The unit of time for <i>Duration</i> is 12
ms.</li>
</ul>
<p class="PlainText">Note: See <a href="FREQOUT.htm" target="" title="" alt="" class="MCXref_0" xrefformat="{paratext}">FREQOUT</a> for all BS2 models.</p>
<h2>Quick Facts</h2>
<table cellpadding="4" cellspacing="0" border="1" style="caption-side: top;width: 100%;">
<col />
<col />
<tr bgcolor="#CFCFCF">
<td width="15%" align="center">&#160;</td>
<td width="85%" align="center">BS1</td>
</tr>
<tr>
<td align="center" bgcolor="#CFCFCF">Units in Duration</td>
<td>
<p align="center">12 ms</p>
</td>
</tr>
<tr>
<td align="center" bgcolor="#CFCFCF">Available Sounds</td>
<td>
<p align="center">256</p>
</td>
</tr>
<tr>
<td align="center" bgcolor="#CFCFCF">Frequency Range</td>
<td>
<p align="center">94.8 Hz to 10,550 Hz</p>
</td>
</tr>
</table>
<h2>Explanation</h2>
<p class="PlainText"><span class="keyword_in_text">SOUND</span> generates one of 255 square-wave frequencies on an I/O pin. The output
pin should be connected as shown in the circuits below. </p>
<p class="PlainText">The tones produced by <span class="keyword_in_text">SOUND</span> can vary in frequency from 94.8 Hz (1) to
10,550 Hz (127). If you need to determine the frequency corresponding to a given
note value, or need to find the note value that will give you best approximation
for a given frequency, use the equations below.</p>
<center>Note = 127 - (((1 ÷ Frequency) - 0.000095) ÷ 0.000083)
<br></br><br></br>-- and --
<br></br><br></br>Frequency = (1 ÷ (0.000095 + ((127 - Note) x 0.000083))
</center>
<p class="PlainText">&#160;</p>
<p class="PlainText">Note, in the above equations, Frequency is in Hertz (Hz).</p>
<center>
<img src="../../graphics/freqout_sch.gif" border="0" />
</center>
<div class="Col2">
<div class="MasterFoot">
<p MadCap:conditions="BSEconditions.BSEWebHelp (Primary)-INCLUDE"><a href="../../HomeTopics/HomePage.htm">Go to Welcome page</a>
</p>
</div>
</div>
<div class="Col2">
<div class="MasterFoot">
<p style="text-align: right;"><span class="ContactInfoProjectName">BASIC Stamp Help</span> <![CDATA[ ]]><span class="ContactInfoVersion#">Version 2.5.4</span> <![CDATA[ ]]></p>
<p style="text-align: right;">Copyright ©&#160;<span class="ContactInfoCompanyName">Parallax Inc.</span></p>
<p style="text-align: right;"><span class="SystemShortDate">8/8/2012</span>
</p>
</div>
</div>
<script type="text/javascript">/* <![CDATA[ */
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-285614-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
/* ]]> */</script>
<script type="text/javascript" src="../../SkinSupport/MadCapBodyEnd.js">
</script>
</body>
</html>