UNPKG

noteplayer

Version:

WebAudio musical audio note player

618 lines (201 loc) 9.44 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: notePlayer</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: notePlayer</h1> <section> <header> <h2>notePlayer</h2> <div class="class-description">A musical note that can be played in a browser. Plays for however long it has been defined to.</div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="notePlayer"><span class="type-signature"></span>new notePlayer<span class="signature">(obj)</span><span class="type-signature"></span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>obj</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">properties needed to instanciate the class <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>keynb</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">corresponding number on a piano keyboard</td> </tr> <tr> <td class="name"><code>freq</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">sound frequency, in Hertz</td> </tr> <tr> <td class="name"><code>octave</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">musical octave the note belongs to [1-8]</td> </tr> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Full name of the note</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5 class="subsection-title">Properties:</h5> <table class="props"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>pianoKeyNb</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">corresponding number on a piano keyboard</td> </tr> <tr> <td class="name"><code>frequency</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">sound frequency, in Hertz</td> </tr> <tr> <td class="name"><code>octave</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">musical octave the note belongs to [1-8]</td> </tr> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">Full name of the note</td> </tr> <tr> <td class="name"><code>duration</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">length of time the sound has to be played, in seconds</td> </tr> <tr> <td class="name"><code>volume</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">volume [0-1]</td> </tr> <tr> <td class="name"><code>verbose</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">verbose mode (true/false)</td> </tr> <tr> <td class="name"><code>attack</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">time to ramp up to the desired volume [0-1]</td> </tr> <tr> <td class="name"><code>release</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">time to ramp up from the desired volume to silence [0-1]</td> </tr> <tr> <td class="name"><code>audioContext</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">WebAudio audioContext</td> </tr> <tr> <td class="name"><code>destinationNode</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">WebAudio destinationNode</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>David B - laopunk</li> </ul> </dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="notePlayer.js.html">notePlayer.js</a>, <a href="notePlayer.js.html#line4">line 4</a> </li></ul></dd> </dl> </div> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="notePlayer.html">notePlayer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#buildFromFrequency">buildFromFrequency</a></li><li><a href="global.html#buildFromKeyNb">buildFromKeyNb</a></li><li><a href="global.html#buildFromName">buildFromName</a></li><li><a href="global.html#play">play</a></li><li><a href="global.html#setAttack">setAttack</a></li><li><a href="global.html#setAudioContext">setAudioContext</a></li><li><a href="global.html#setDestinationNode">setDestinationNode</a></li><li><a href="global.html#setDuration">setDuration</a></li><li><a href="global.html#setRelease">setRelease</a></li><li><a href="global.html#setVerbose">setVerbose</a></li><li><a href="global.html#setVolume">setVolume</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Fri Dec 02 2016 10:02:03 GMT+0000 (GMT) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>