UNPKG

@sebastbake/music-tempo

Version:

Finding out tempo of the music

1,695 lines (881 loc) 44.8 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <base data-ice="baseUrl" href="../../"> <title data-ice="title">Agent | API Document</title> <link type="text/css" rel="stylesheet" href="css/style.css"> <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css"> <script src="script/prettify/prettify.js"></script> <script src="script/manual.js"></script> </head> <body class="layout-container" data-ice="rootContainer"> <header> <a href="./">Home</a> <a href="identifiers.html">Reference</a> <a href="source.html">Source</a> <a data-ice="repoURL" href="https://github.com/killercrush/music-tempo" class="repo-url-github">Repository</a> <div class="search-box"> <span> <img src="./image/search.png"> <span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span> </span> <ul class="search-result"></ul> </div> </header> <nav class="navigation" data-ice="nav"><div> <ul> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Agent.js~Agent.html">Agent</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/BeatTracking.js~BeatTracking.html">BeatTracking</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/FFT.js~FFT.html">FFT</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/MusicTempo.js~MusicTempo.html">MusicTempo</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/OnsetDetection.js~OnsetDetection.html">OnsetDetection</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/TempoInduction.js~TempoInduction.html">TempoInduction</a></span></span></li> </ul> </div> </nav> <div class="content" data-ice="content"><div class="header-notice"> <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import Agent from &apos;<span><a href="file/src/Agent.js.html#lineNumber5">music-tempo/src/Agent.js</a></span>&apos;</code></pre></div> <span data-ice="access">public</span> <span data-ice="kind">class</span> <span data-ice="source">| <span><a href="file/src/Agent.js.html#lineNumber5">source</a></span></span> </div> <div class="self-detail detail"> <h1 data-ice="name">Agent</h1> <div class="description" data-ice="description"><p>Agent is the central class for beat tracking</p> </div> </div> <div data-ice="constructorSummary"><h2>Constructor Summary</h2><table class="summary" data-ice="summary"> <thead><tr><td data-ice="title" colspan="3">Public Constructor</td></tr></thead> <tbody> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-constructor-constructor">constructor</a></span></span><span data-ice="signature">(tempo: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>, firstBeatTime: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>, firsteventScore: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>, agentList: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span>, params: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>)</span> </p> </div> <div> <div data-ice="description"><p>Constructor</p> </div> </div> </td> <td> </td> </tr> </tbody> </table> </div> <div data-ice="memberSummary"><h2>Member Summary</h2><table class="summary" data-ice="summary"> <thead><tr><td data-ice="title" colspan="3">Public Members</td></tr></thead> <tbody> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-member-agentListRef">agentListRef</a></span></span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span></span> </p> </div> <div> <div data-ice="description"><p>reference to the agent list </p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-member-beatInterval">beatInterval</a></span></span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> </p> </div> <div> <div data-ice="description"><p>the current tempo hypothesis of the Agent, expressed as the beat period</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-member-beatTime">beatTime</a></span></span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> </p> </div> <div> <div data-ice="description"><p>the time of the most recent beat accepted by this Agent</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-member-correctionFactor">correctionFactor</a></span></span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> </p> </div> <div> <div data-ice="description"><p>correction factor for updating beat period</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-member-events">events</a></span></span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span></span> </p> </div> <div> <div data-ice="description"><p>the array of onsets accepted by this Agent as beats, plus interpolated beats</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-member-expiryTime">expiryTime</a></span></span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> </p> </div> <div> <div data-ice="description"><p>the time after which an Agent that has not accepted any beat will be destroyed</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-member-initialBeatInterval">initialBeatInterval</a></span></span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> </p> </div> <div> <div data-ice="description"><p>the initial tempo hypothesis of the Agent, expressed as the beat period</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-member-maxChange">maxChange</a></span></span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> </p> </div> <div> <div data-ice="description"><p>the maximum allowed deviation from the initial tempo, expressed as a fraction of the initial beat period</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-member-penaltyFactor">penaltyFactor</a></span></span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> </p> </div> <div> <div data-ice="description"><p>factor for correcting score, if onset do not coincide precisely with predicted beat time</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-member-score">score</a></span></span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> </p> </div> <div> <div data-ice="description"><p>sum of salience values of the onsets which have been interpreted as beats by this Agent</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-member-toleranceWndInner">toleranceWndInner</a></span></span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> </p> </div> <div> <div data-ice="description"><p>the maximum time that a beat can deviate from the predicted beat time without a fork occurring</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-member-toleranceWndPost">toleranceWndPost</a></span></span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> </p> </div> <div> <div data-ice="description"><p>the maximum amount by which a beat can be later than the predicted beat time, expressed as a fraction of the beat period</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-member-toleranceWndPre">toleranceWndPre</a></span></span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> </p> </div> <div> <div data-ice="description"><p>the maximum amount by which a beat can be earlier than the predicted beat time, expressed as a fraction of the beat period</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-member-totalBeatCount">totalBeatCount</a></span></span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> </p> </div> <div> <div data-ice="description"><p>the number of beats found by this Agent, including interpolated beats</p> </div> </div> </td> <td> </td> </tr> </tbody> </table> </div> <div data-ice="methodSummary"><h2>Method Summary</h2><table class="summary" data-ice="summary"> <thead><tr><td data-ice="title" colspan="3">Public Methods</td></tr></thead> <tbody> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-method-acceptEvent">acceptEvent</a></span></span><span data-ice="signature">(eventTime: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>, eventScore: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>, err: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>, beatCount: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>)</span> </p> </div> <div> <div data-ice="description"><p>Accept the event time as a beat time, and update the state of the Agent accordingly</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-method-clone">clone</a></span></span><span data-ice="signature">(): <span><a href="class/src/Agent.js~Agent.html">Agent</a></span></span> </p> </div> <div> <div data-ice="description"><p>Makes a clone of the Agent</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-method-considerEvent">considerEvent</a></span></span><span data-ice="signature">(eventTime: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>, eventScore: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></span></span> </p> </div> <div> <div data-ice="description"><p>The event time is tested if it is a beat time</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="class/src/Agent.js~Agent.html#instance-method-fillBeats">fillBeats</a></span></span><span data-ice="signature">()</span> </p> </div> <div> <div data-ice="description"><p>Interpolates missing beats in the Agent&apos;s beat track</p> </div> </div> </td> <td> </td> </tr> </tbody> </table> </div> <div data-ice="constructorDetails"><h2 data-ice="title">Public Constructors</h2> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-constructor-constructor"> <span class="access" data-ice="access">public</span> <span data-ice="name">constructor</span><span data-ice="signature">(tempo: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>, firstBeatTime: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>, firsteventScore: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>, agentList: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span>, params: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>)</span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber21">source</a></span></span> </span> </h3> <div data-ice="description"><p>Constructor</p> </div> <div data-ice="properties"><div data-ice="properties"> <h4 data-ice="title">Params:</h4> <table class="params"> <thead> <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> </thead> <tbody> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">tempo</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"></td> <td data-ice="description"><p>tempo hypothesis of the Agent</p> </td> </tr> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">firstBeatTime</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"></td> <td data-ice="description"><p>the time of the first beat accepted by this Agent</p> </td> </tr> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">firsteventScore</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"></td> <td data-ice="description"><p>salience value of the first beat accepted by this Agent</p> </td> </tr> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">agentList</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span></td> <td data-ice="appendix"></td> <td data-ice="description"><p>reference to the agent list</p> </td> </tr> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">params</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span></td> <td data-ice="appendix"><ul><li>optional</li> <li>default: {}</li></ul></td> <td data-ice="description"><p>parameters</p> </td> </tr> <tr data-ice="property" data-depth="1"> <td data-ice="name" data-depth="1">params.expiryTime</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"><ul><li>optional</li> <li>default: 10</li></ul></td> <td data-ice="description"><p>the time after which an Agent that has not accepted any beat will be destroyed</p> </td> </tr> <tr data-ice="property" data-depth="1"> <td data-ice="name" data-depth="1">params.toleranceWndInner</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"><ul><li>optional</li> <li>default: 0.04</li></ul></td> <td data-ice="description"><p>the maximum time that a beat can deviate from the predicted beat time without a fork occurring</p> </td> </tr> <tr data-ice="property" data-depth="1"> <td data-ice="name" data-depth="1">params.toleranceWndPre</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"><ul><li>optional</li> <li>default: 0.15</li></ul></td> <td data-ice="description"><p>the maximum amount by which a beat can be earlier than the predicted beat time, expressed as a fraction of the beat period</p> </td> </tr> <tr data-ice="property" data-depth="1"> <td data-ice="name" data-depth="1">params.toleranceWndPost</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"><ul><li>optional</li> <li>default: 0.3</li></ul></td> <td data-ice="description"><p>the maximum amount by which a beat can be later than the predicted beat time, expressed as a fraction of the beat period</p> </td> </tr> <tr data-ice="property" data-depth="1"> <td data-ice="name" data-depth="1">params.correctionFactor</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"><ul><li>optional</li> <li>default: 50</li></ul></td> <td data-ice="description"><p>correction factor for updating beat period</p> </td> </tr> <tr data-ice="property" data-depth="1"> <td data-ice="name" data-depth="1">params.maxChange</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"><ul><li>optional</li> <li>default: 0.2</li></ul></td> <td data-ice="description"><p>the maximum allowed deviation from the initial tempo, expressed as a fraction of the initial beat period</p> </td> </tr> <tr data-ice="property" data-depth="1"> <td data-ice="name" data-depth="1">params.penaltyFactor</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"><ul><li>optional</li> <li>default: 0.5</li></ul></td> <td data-ice="description"><p>factor for correcting score, if onset do not coincide precisely with predicted beat time</p> </td> </tr> </tbody> </table> </div> </div> </div> </div> <div data-ice="memberDetails"><h2 data-ice="title">Public Members</h2> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-member-agentListRef"> <span class="access" data-ice="access">public</span> <span data-ice="name">agentListRef</span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber96">source</a></span></span> </span> </h3> <div data-ice="description"><p>reference to the agent list </p> </div> <div data-ice="properties"> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-member-beatInterval"> <span class="access" data-ice="access">public</span> <span data-ice="name">beatInterval</span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber66">source</a></span></span> </span> </h3> <div data-ice="description"><p>the current tempo hypothesis of the Agent, expressed as the beat period</p> </div> <div data-ice="properties"> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-member-beatTime"> <span class="access" data-ice="access">public</span> <span data-ice="name">beatTime</span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber76">source</a></span></span> </span> </h3> <div data-ice="description"><p>the time of the most recent beat accepted by this Agent</p> </div> <div data-ice="properties"> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-member-correctionFactor"> <span class="access" data-ice="access">public</span> <span data-ice="name">correctionFactor</span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber50">source</a></span></span> </span> </h3> <div data-ice="description"><p>correction factor for updating beat period</p> </div> <div data-ice="properties"> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-member-events"> <span class="access" data-ice="access">public</span> <span data-ice="name">events</span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber86">source</a></span></span> </span> </h3> <div data-ice="description"><p>the array of onsets accepted by this Agent as beats, plus interpolated beats</p> </div> <div data-ice="properties"> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-member-expiryTime"> <span class="access" data-ice="access">public</span> <span data-ice="name">expiryTime</span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber26">source</a></span></span> </span> </h3> <div data-ice="description"><p>the time after which an Agent that has not accepted any beat will be destroyed</p> </div> <div data-ice="properties"> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-member-initialBeatInterval"> <span class="access" data-ice="access">public</span> <span data-ice="name">initialBeatInterval</span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber71">source</a></span></span> </span> </h3> <div data-ice="description"><p>the initial tempo hypothesis of the Agent, expressed as the beat period</p> </div> <div data-ice="properties"> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-member-maxChange"> <span class="access" data-ice="access">public</span> <span data-ice="name">maxChange</span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber55">source</a></span></span> </span> </h3> <div data-ice="description"><p>the maximum allowed deviation from the initial tempo, expressed as a fraction of the initial beat period</p> </div> <div data-ice="properties"> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-member-penaltyFactor"> <span class="access" data-ice="access">public</span> <span data-ice="name">penaltyFactor</span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber60">source</a></span></span> </span> </h3> <div data-ice="description"><p>factor for correcting score, if onset do not coincide precisely with predicted beat time</p> </div> <div data-ice="properties"> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-member-score"> <span class="access" data-ice="access">public</span> <span data-ice="name">score</span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber91">source</a></span></span> </span> </h3> <div data-ice="description"><p>sum of salience values of the onsets which have been interpreted as beats by this Agent</p> </div> <div data-ice="properties"> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-member-toleranceWndInner"> <span class="access" data-ice="access">public</span> <span data-ice="name">toleranceWndInner</span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber31">source</a></span></span> </span> </h3> <div data-ice="description"><p>the maximum time that a beat can deviate from the predicted beat time without a fork occurring</p> </div> <div data-ice="properties"> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-member-toleranceWndPost"> <span class="access" data-ice="access">public</span> <span data-ice="name">toleranceWndPost</span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber41">source</a></span></span> </span> </h3> <div data-ice="description"><p>the maximum amount by which a beat can be later than the predicted beat time, expressed as a fraction of the beat period</p> </div> <div data-ice="properties"> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-member-toleranceWndPre"> <span class="access" data-ice="access">public</span> <span data-ice="name">toleranceWndPre</span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber36">source</a></span></span> </span> </h3> <div data-ice="description"><p>the maximum amount by which a beat can be earlier than the predicted beat time, expressed as a fraction of the beat period</p> </div> <div data-ice="properties"> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-member-totalBeatCount"> <span class="access" data-ice="access">public</span> <span data-ice="name">totalBeatCount</span><span data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber81">source</a></span></span> </span> </h3> <div data-ice="description"><p>the number of beats found by this Agent, including interpolated beats</p> </div> <div data-ice="properties"> </div> </div> </div> <div data-ice="methodDetails"><h2 data-ice="title">Public Methods</h2> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-method-acceptEvent"> <span class="access" data-ice="access">public</span> <span data-ice="name">acceptEvent</span><span data-ice="signature">(eventTime: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>, eventScore: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>, err: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>, beatCount: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>)</span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber129">source</a></span></span> </span> </h3> <div data-ice="description"><p>Accept the event time as a beat time, and update the state of the Agent accordingly</p> </div> <div data-ice="properties"><div data-ice="properties"> <h4 data-ice="title">Params:</h4> <table class="params"> <thead> <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> </thead> <tbody> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">eventTime</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"></td> <td data-ice="description"><p>the event time to be accepted</p> </td> </tr> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">eventScore</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"></td> <td data-ice="description"><p>salience values of the event time</p> </td> </tr> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">err</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"></td> <td data-ice="description"><p>the difference between the predicted and actual beat times</p> </td> </tr> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">beatCount</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"></td> <td data-ice="description"><p>the number of beats since the last beat</p> </td> </tr> </tbody> </table> </div> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-method-clone"> <span class="access" data-ice="access">public</span> <span data-ice="name">clone</span><span data-ice="signature">(): <span><a href="class/src/Agent.js~Agent.html">Agent</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber169">source</a></span></span> </span> </h3> <div data-ice="description"><p>Makes a clone of the Agent</p> </div> <div data-ice="properties"> </div> <div class="return-params" data-ice="returnParams"> <h4>Return:</h4> <table> <tbody> <tr> <td class="return-type" data-ice="returnType"><span><a href="class/src/Agent.js~Agent.html">Agent</a></span></td> <td class="return-desc" data-ice="returnDescription"><p>agent&apos;s clone</p> </td> </tr> </tbody> </table> <div data-ice="returnProperties"> </div> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-method-considerEvent"> <span class="access" data-ice="access">public</span> <span data-ice="name">considerEvent</span><span data-ice="signature">(eventTime: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>, eventScore: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber104">source</a></span></span> </span> </h3> <div data-ice="description"><p>The event time is tested if it is a beat time</p> </div> <div data-ice="properties"><div data-ice="properties"> <h4 data-ice="title">Params:</h4> <table class="params"> <thead> <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> </thead> <tbody> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">eventTime</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"></td> <td data-ice="description"><p>the event time to be tested</p> </td> </tr> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">eventScore</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td> <td data-ice="appendix"></td> <td data-ice="description"><p>salience values of the event time</p> </td> </tr> </tbody> </table> </div> </div> <div class="return-params" data-ice="returnParams"> <h4>Return:</h4> <table> <tbody> <tr> <td class="return-type" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></span></td> <td class="return-desc" data-ice="returnDescription"><p>indicate whether the given event time was accepted as a beat time</p> </td> </tr> </tbody> </table> <div data-ice="returnProperties"> </div> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="instance-method-fillBeats"> <span class="access" data-ice="access">public</span> <span data-ice="name">fillBeats</span><span data-ice="signature">()</span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/Agent.js.html#lineNumber145">source</a></span></span> </span> </h3> <div data-ice="description"><p>Interpolates missing beats in the Agent&apos;s beat track</p> </div> <div data-ice="properties"> </div> </div> </div> </div> <footer class="footer"> Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(0.5.2)</span><img src="./image/esdoc-logo-mini-black.png"></a> </footer> <script src="script/search_index.js"></script> <script src="script/search.js"></script> <script src="script/pretty-print.js"></script> <script src="script/inherited-summary.js"></script> <script src="script/test-summary.js"></script> <script src="script/inner-link.js"></script> <script src="script/patch-for-local.js"></script> </body> </html>