Tone.js/doc/Tone.BitCrusher.html
2014-06-23 15:28:03 -04:00

4339 lines
No EOL
58 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tone.js Class: BitCrusher</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.spacelab.css">
</head>
<body>
<div class="container-fluid">
<div class="navbar navbar-fixed-top navbar-inverse">
<div class="navbar-inner">
<a class="brand" href="index.html">Tone.js</a>
<ul class="nav">
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li>
<a href="Tone.html">Tone</a>
</li>
<li>
<a href="Tone.Add.html">Add</a>
</li>
<li>
<a href="Tone.AutoPanner.html">AutoPanner</a>
</li>
<li>
<a href="Tone.BitCrusher.html">BitCrusher</a>
</li>
<li>
<a href="Tone.DryWet.html">DryWet</a>
</li>
<li>
<a href="Tone.Effect.html">Effect</a>
</li>
<li>
<a href="Tone.Envelope.html">Envelope</a>
</li>
<li>
<a href="Tone.FeedbackDelay.html">FeedbackDelay</a>
</li>
<li>
<a href="Tone.FeedbackEffect.html">FeedbackEffect</a>
</li>
<li>
<a href="Tone.LFO.html">LFO</a>
</li>
<li>
<a href="Tone.Merge.html">Merge</a>
</li>
<li>
<a href="Tone.Meter.html">Meter</a>
</li>
<li>
<a href="Tone.Microphone.html">Microphone</a>
</li>
<li>
<a href="Tone.Multiply.html">Multiply</a>
</li>
<li>
<a href="Tone.Noise.html">Noise</a>
</li>
<li>
<a href="Tone.Oscillator.html">Oscillator</a>
</li>
<li>
<a href="Tone.Panner.html">Panner</a>
</li>
<li>
<a href="Tone.PingPongDelay.html">PingPongDelay</a>
</li>
<li>
<a href="Tone.Player.html">Player</a>
</li>
<li>
<a href="Tone.Recorder.html">Recorder</a>
</li>
<li>
<a href="Tone.Scale.html">Scale</a>
</li>
<li>
<a href="Tone.Signal.html">Signal</a>
</li>
<li>
<a href="Tone.Source.html">Source</a>
</li>
<li>
<a href="Tone.Split.html">Split</a>
</li>
<li>
<a href="Tone.Transport.html">Transport</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span8">
<div id="main">
<h1 class="page-title">Class: BitCrusher</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="Tone.html">Tone</a>.</span>
BitCrusher
</h2>
</header>
<article>
<div class="container-overview">
<dt>
<h4 class="name" id="BitCrusher"><span class="type-signature"></span>new BitCrusher<span class="signature">(<span class="optional">bits</span>, <span class="optional">frequency</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>downsample incoming signal
inspiration from <a href="https://github.com/jaz303/bitcrusher/blob/master/index.js">https://github.com/jaz303/bitcrusher/blob/master/index.js</a></p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>bits</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>frequency</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-3580">line 3580</a>
</li></ul></dd>
</dl>
</dd>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li><a href="Tone.html">Tone</a></li>
</ul>
<h3 class="subsection-title">Members</h3>
<dl>
<dt>
<h4 class="name" id="input"><span class="type-signature"></span>input<span class="type-signature"> :GainNode</span></h4>
</dt>
<dd>
<div class="description">
<p>default input of the ToneNode</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">GainNode</span>
</li>
</ul>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#input">Tone#input</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-110">line 110</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="output"><span class="type-signature"></span>output<span class="type-signature"> :GainNode</span></h4>
</dt>
<dd>
<div class="description">
<p>default output of the ToneNode</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">GainNode</span>
</li>
</ul>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#output">Tone#output</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-116">line 116</a>
</li></ul></dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="chain"><span class="type-signature"></span>chain<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>connect together all of the arguments in series</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<span class="param-type">AudioParam</span>
|
<span class="param-type"><a href="Tone.html">Tone</a></span>
</td>
<td class="attributes">
&lt;repeatable><br>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#chain">Tone#chain</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-167">line 167</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="connect"><span class="type-signature"></span>connect<span class="signature">(unit)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>connect the output of a ToneNode to an AudioParam, AudioNode, or ToneNode</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>unit</code></td>
<td class="type">
<span class="param-type"><a href="Tone.html">Tone</a></span>
|
<span class="param-type">AudioParam</span>
|
<span class="param-type"><a href="AudioNode.html">AudioNode</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#connect">Tone#connect</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-152">line 152</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="dbToGain"><span class="type-signature"></span>dbToGain<span class="signature">(db)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>convert db scale to gain scale (0-1)</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>db</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#dbToGain">Tone#dbToGain</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-226">line 226</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="defaultArg"><span class="type-signature"></span>defaultArg<span class="signature">(given, fallback)</span><span class="type-signature"> &rarr; {*}</span></h4>
</dt>
<dd>
<div class="description">
<p>if a the given is undefined, use the fallback</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>given</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>fallback</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#defaultArg">Tone#defaultArg</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-189">line 189</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="disconnect"><span class="type-signature"></span>disconnect<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>disconnect the output</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#disconnect">Tone#disconnect</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-159">line 159</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="dispose"><span class="type-signature"></span>dispose<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>clean up</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-3681">line 3681</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="equalPowerScale"><span class="type-signature"></span>equalPowerScale<span class="signature">(percent)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>equal power gain scale
good for cross-fading</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>percent</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>(0-1)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#equalPowerScale">Tone#equalPowerScale</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-200">line 200</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>output gain (0-1)</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="expScale"><span class="type-signature"></span>expScale<span class="signature">(gain)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>gain</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>(0-1)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#expScale">Tone#expScale</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-217">line 217</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>gain (decibel scale but betwee 0-1)</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="frequencyToSeconds"><span class="type-signature"></span>frequencyToSeconds<span class="signature">(freq)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>convert a frequency into seconds
accepts both numbers and strings
i.e. 10hz or 10 both equal .1</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>freq</code></td>
<td class="type">
<span class="param-type">number</span>
|
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#frequencyToSeconds">Tone#frequencyToSeconds</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-345">line 345</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="gainToDb"><span class="type-signature"></span>gainToDb<span class="signature">(gain)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>convert gain scale to decibels</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>gain</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>(0-1)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#gainToDb">Tone#gainToDb</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-235">line 235</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="interpolate"><span class="type-signature"></span>interpolate<span class="signature">(input, outputMin, outputMax)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>interpolate the input value (0-1) to be between outputMin and outputMax</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>input</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>outputMin</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>outputMax</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#interpolate">Tone#interpolate</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-246">line 246</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="logScale"><span class="type-signature"></span>logScale<span class="signature">(gain)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>gain</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>(0-1)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#logScale">Tone#logScale</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-209">line 209</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>gain (decibel scale but betwee 0-1)</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="noGC"><span class="type-signature"></span>noGC<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>makes a connection to ensure that the node will not be garbage collected
until 'dispose' is explicitly called</p>
<p> use carefully. circumvents JS and WebAudio's normal Garbage Collection behavior</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#noGC">Tone#noGC</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-483">line 483</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="normalize"><span class="type-signature"></span>normalize<span class="signature">(input, inputMin, inputMax)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>normalize the input to 0-1 from between inputMin to inputMax</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>input</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>inputMin</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>inputMax</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#normalize">Tone#normalize</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-257">line 257</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="notationToSeconds"><span class="type-signature"></span>notationToSeconds<span class="signature">(notation, <span class="optional">bpm</span>, <span class="optional">timeSignature</span>)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>convert notation format strings to seconds</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>notation</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>bpm</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>timeSignature</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#notationToSeconds">Tone#notationToSeconds</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-2004">line 2004</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="now"><span class="type-signature"></span>now<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#now">Tone#now</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-284">line 284</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>the currentTime from the AudioContext</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="receive"><span class="type-signature"></span>receive<span class="signature">(channelName)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>recieve the input from the desired channelName to the input gain of 'this' node.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>channelName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#receive">Tone#receive</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-3147">line 3147</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="samplesToSeconds"><span class="type-signature"></span>samplesToSeconds<span class="signature">(samples)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>convert a sample count to seconds</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>samples</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#samplesToSeconds">Tone#samplesToSeconds</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-293">line 293</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="secondsToFrequency"><span class="type-signature"></span>secondsToFrequency<span class="signature">(seconds)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>convert a number in seconds to a frequency</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>seconds</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#secondsToFrequency">Tone#secondsToFrequency</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-354">line 354</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="send"><span class="type-signature"></span>send<span class="signature">(channelName, amount)</span><span class="type-signature"> &rarr; {GainNode}</span></h4>
</dt>
<dd>
<div class="description">
<p>send signal to a channel name</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>channelName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>amount</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#send">Tone#send</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-3132">line 3132</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">GainNode</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setBits"><span class="type-signature"></span>setBits<span class="signature">(bits)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>set the bit rate</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>bits</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-3664">line 3664</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setFrequency"><span class="type-signature"></span>setFrequency<span class="signature">(freq)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>set the frequency</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>freq</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-3674">line 3674</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="toFrequency"><span class="type-signature"></span>toFrequency<span class="signature">(time)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>convert a time to a frequency</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>time</code></td>
<td class="type">
<span class="param-type">Tone.Time</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#toFrequency">Tone#toFrequency</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-2091">line 2091</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>the time in hertz</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="toMaster"><span class="type-signature"></span>toMaster<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>connect 'this' to the master output</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#toMaster">Tone#toMaster</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-454">line 454</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="toSamples"><span class="type-signature"></span>toSamples<span class="signature">(time)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>convert a time into samples</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>time</code></td>
<td class="type">
<span class="param-type">Tone.time</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#toSamples">Tone#toSamples</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-303">line 303</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="toSeconds"><span class="type-signature"></span>toSeconds<span class="signature">(time, <span class="optional">now</span>)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>convert Tone.Time to seconds</p>
<p> this is a simplified version which only handles numbers and
'now' relative numbers. If the Transport is included this
method is overridden to include many other features including
notationTime, Frequency, and transportTime</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>time</code></td>
<td class="type">
<span class="param-type">Tone.Time</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>now</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>if passed in, this number will be
used for all 'now' relative timings</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#toSeconds">Tone#toSeconds</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-321">line 321</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>seconds in the same timescale as the AudioContext</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="toSeconds"><span class="type-signature"></span>toSeconds<span class="signature">(time, <span class="optional">now</span>)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>convert Tone.Time into seconds.</p>
<p> unlike the method which it overrides, this takes into account
transporttime and musical notation</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>time</code></td>
<td class="type">
<span class="param-type">Tone.Time</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>now</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>if passed in, this number will be
used for all 'now' relative timings</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="Tone.html#toSeconds">Tone#toSeconds</a>
</li></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Tone.js.html">Tone.js</a>, <a href="Tone.js.html#sunlight-1-line-2113">line 2113</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<div class="clearfix"></div>
<footer>
<span class="copyright">
Tone No Tone Copyright © 2014.
</span>
<br />
<span class="jsdoc-message">
Documentation generated on Mon Jun 23 2014 15:23:10 GMT-0400 (EDT).
</span>
</footer>
</div>
<div class="span3">
<div id="toc"></div>
</div>
<br clear="both">
</div>
</div>
<script src="scripts/sunlight.js"></script>
<script src="scripts/sunlight.javascript.js"></script>
<script src="scripts/sunlight-plugin.doclinks.js"></script>
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
<script src="scripts/sunlight-plugin.menu.js"></script>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/jquery.scrollTo.js"></script>
<script src="scripts/jquery.localScroll.js"></script>
<script src="scripts/bootstrap-dropdown.js"></script>
<script src="scripts/toc.js"></script>
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
<script>
$( function () {
$( "#toc" ).toc( {
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : 60
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
} );
</script>
<script>
$( function () {
$('#main').localScroll({
offset: { top: 56 } //offset by the height of your header (give or take a few px, see what works for you)
});
$( "dt h4.name" ).each( function () {
var $this = $( this );
var icon = $( "<i/>" ).addClass( "icon-plus-sign" ).addClass( "pull-right" ).addClass( "icon-white" );
var dt = $this.parents( "dt" );
var children = dt.next( "dd" );
$this.append( icon ).css( {cursor : "pointer"} );
$this.addClass( "member-collapsed" ).addClass( "member" );
children.hide();
$this.toggle( function () {
icon.addClass( "icon-minus-sign" ).removeClass( "icon-plus-sign" ).removeClass( "icon-white" );
$this.addClass( "member-open" ).removeClass( "member-collapsed" );
children.slideDown();
}, function () {
icon.addClass( "icon-plus-sign" ).removeClass( "icon-minus-sign" ).addClass( "icon-white" );
$this.addClass( "member-collapsed" ).removeClass( "member-open" );
children.slideUp();
} );
} );
} );
</script>
</body>
</html>