react-orchestra
Version:
A toolbox to build interactive and smart instruments on the web and mobile.
2,895 lines (830 loc) • 35.6 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Global</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">Global</h1>
<section>
<header>
<h2></h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="addOctaveToNoteName"><span class="type-signature"></span>addOctaveToNoteName<span class="signature">(noteName, octave)</span><span class="type-signature"> → {string}</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>noteName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Note name</td>
</tr>
<tr>
<td class="name"><code>octave</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="helpers_addOctaveToNoteName.js.html">helpers/addOctaveToNoteName.js</a>, <a href="helpers_addOctaveToNoteName.js.html#line2">line 2</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
noteName - Note name
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>addOctaveToNoteName('A', 3) // returns 'A3'</code></pre>
<h4 class="name" id="getInterval"><span class="type-signature"></span>getInterval<span class="signature">(noteNameOne, noteNameTwo)</span><span class="type-signature"> → {string}</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>noteNameOne</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Without octave</td>
</tr>
<tr>
<td class="name"><code>noteNameTwo</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Without octave</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="helpers_getInterval.js.html">helpers/getInterval.js</a>, <a href="helpers_getInterval.js.html#line4">line 4</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
noteName - Note name
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>getInterval('A', 'B') // returns 1</code></pre>
<h4 class="name" id="getIntervalPermutationsFromNoteNames"><span class="type-signature"></span>getIntervalPermutationsFromNoteNames<span class="signature">(noteNames)</span><span class="type-signature"> → {array}</span></h4>
<div class="description">
Get all possible interval permutations between these notes. Helpful to be able to guess scale
</div>
<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>noteNames</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last">Without octave</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="helpers_getIntervalPermutationsFromNoteNames.js.html">helpers/getIntervalPermutationsFromNoteNames.js</a>, <a href="helpers_getIntervalPermutationsFromNoteNames.js.html#line4">line 4</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
intervalPermutations -
[{firstNoteName: string, intervals: number, guessedScales: array}]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>getIntervalPermutationsFromNoteNames(['A', 'B', 'C'])
// Returns { firstNoteName: 'A', intervals: [0, 9, 10], guessedScales: [] },
// { firstNoteName: 'B', intervals: [0, 2, 11], guessedScales: [] },
// { firstNoteName: 'C', intervals: [0, 1, 3], guessedScales: [] },</code></pre>
<h4 class="name" id="getJSONFromMidiURL"><span class="type-signature"></span>getJSONFromMidiURL<span class="signature">(url)</span><span class="type-signature"> → {Promise.<object>}</span></h4>
<div class="description">
Download midi from url and parse it into JSON {meta, musicTracks}.
Wrapper around MidiIO.parseMidi(url)
</div>
<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>url</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">URL to a midi file.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="helpers_getJSONFromMidiURL.js.html">helpers/getJSONFromMidiURL.js</a>, <a href="helpers_getJSONFromMidiURL.js.html#line4">line 4</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<object></span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>getJSONFromMidiURL('https://s3-eu-west-1.amazonaws.com/ut-music-player/assets/midis/beet1track-medium-fast.mid')
.then((metaAndMusicTracks) => {
const {meta, musicTracks} = metaAndMusicTracks;
})</code></pre>
<h4 class="name" id="getNoteNamesFromChordName"><span class="type-signature"></span>getNoteNamesFromChordName<span class="signature">(firstNoteNameWithOctave, chordName)</span><span class="type-signature"> → {array}</span></h4>
<div class="description">
Get unique note names from array of note objects or note names
</div>
<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>firstNoteNameWithOctave</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">note name with octave e.g. 'A3'</td>
</tr>
<tr>
<td class="name"><code>chordName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Chord name full list of supported chords in src/constants/CHORDS.js</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="helpers_getNoteNamesFromChordName.js.html">helpers/getNoteNamesFromChordName.js</a>, <a href="helpers_getNoteNamesFromChordName.js.html#line4">line 4</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
notenames
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>getNoteNamesFromChordName('A3', 'min') // returns ['A3', 'C3', 'E3']
getNoteNamesFromChordName('C3', 'maj') // returns ['C3', 'E3', 'G3']
// Full list of supported chords in src/constants/CHORDS.js</code></pre>
<h4 class="name" id="getNoteNamesFromIntervals"><span class="type-signature"></span>getNoteNamesFromIntervals<span class="signature">(noteNameWithOctave)</span><span class="type-signature"> → {array}</span></h4>
<div class="description">
Get unique note names from array of note objects or note names
</div>
<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>noteNameWithOctave</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">note name with octave e.g. 'A3'</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="helpers_getNoteNamesFromIntervals.js.html">helpers/getNoteNamesFromIntervals.js</a>, <a href="helpers_getNoteNamesFromIntervals.js.html#line4">line 4</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
notenames
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>getNoteNamesFromChordName('A3', [0, 2, 3]) // returns ['A3', 'B3', 'C3']
// Full list of supported chords in src/constants/CHORDS.js</code></pre>
<h4 class="name" id="getScaleNotes"><span class="type-signature"></span>getScaleNotes<span class="signature">(note, scale, startOctave, count)</span><span class="type-signature"> → {array}</span></h4>
<div class="description">
getScaleNotes - Get notes for a given scale for _count_ octaves at _startOctave_
</div>
<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>note</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">noteName without octave</td>
</tr>
<tr>
<td class="name"><code>scale</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">scaleName must be one defined in constants/SCALES</td>
</tr>
<tr>
<td class="name"><code>startOctave</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">starting octave</td>
</tr>
<tr>
<td class="name"><code>count</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">Number of octaves</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="helpers_getScaleNotes.js.html">helpers/getScaleNotes.js</a>, <a href="helpers_getScaleNotes.js.html#line16">line 16</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Array of note names with octave
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
<h4 class="name" id="getScalesFromNoteNames"><span class="type-signature"></span>getScalesFromNoteNames<span class="signature">(noteNames)</span><span class="type-signature"> → {array}</span></h4>
<div class="description">
getScalesFromNoteNames - Get all scales matched with the given notes
</div>
<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>noteNames</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last">noteNames with octave</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="helpers_getScalesFromNoteNames.js.html">helpers/getScalesFromNoteNames.js</a>, <a href="helpers_getScalesFromNoteNames.js.html#line32">line 32</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Array of note names with octave
[{firstNoteName: string, intervals: number, guessedScales: array}]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>getScalesFromNoteNames(['A3', 'B3', 'C3']);
// [
// {
// firstNoteName: 'A',
// intervals: [0, 9, 10],
// guessedScales: ['dorian', 'mixolydian', 'acoustic', 'algerian', 'majorBlues']
// },
// {
// firstNoteName: 'B',
// intervals: [0, 2, 11],
// guessedScales: ['ionian', 'lydian', 'harmonicMinor', 'melodicMinorAsc']
// },
// {
// firstNoteName: 'C',
// intervals: [0, 1, 3],
// guessedScales: ['phrygian', 'locrian', 'altered']
// },
// ]</code></pre>
<h4 class="name" id="getTracksAndMetaFromParsedMidi"><span class="type-signature"></span>getTracksAndMetaFromParsedMidi<span class="signature">(noteNames)</span><span class="type-signature"> → {object}</span></h4>
<div class="description">
getTracksAndMetaFromParsedMidi - Convert a json midi file parsed with MidiIO into clean meta and tracks object
</div>
<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>noteNames</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last">noteNames with octave</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="helpers_getTracksAndMetaFromParsedMidi.js.html">helpers/getTracksAndMetaFromParsedMidi.js</a>, <a href="helpers_getTracksAndMetaFromParsedMidi.js.html#line21">line 21</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Array of note names with octave
[{firstNoteName: string, intervals: number, guessedScales: array}]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>const parsedMidi = await getJSONFromMidiURL(url);
getTracksAndMetaFromParsedMidi(parsedMidi);
// Returns
// {
// meta: object,
// tracks: array,
// }</code></pre>
<h4 class="name" id="getTracksAndMetaFromUrl"><span class="type-signature"></span>getTracksAndMetaFromUrl<span class="signature">(url)</span><span class="type-signature"> → {object}</span></h4>
<div class="description">
get all tracks and meta information from a midi url hosted online
</div>
<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>url</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">url of midi file that needs to be converted</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="helpers_getTracksAndMetaFromUrl.js.html">helpers/getTracksAndMetaFromUrl.js</a>, <a href="helpers_getTracksAndMetaFromUrl.js.html#line12">line 12</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
{tracks: [], meta: {}}
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>getTracksAndMetaFromUrl('https://s3-eu-west-1.amazonaws.com/ut-music-player/assets/midis/beet1track-medium-fast.mid') // returns {tracks: [], meta: {}}</code></pre>
<h4 class="name" id="getUniqueNoteNames"><span class="type-signature"></span>getUniqueNoteNames<span class="signature">(notes)</span><span class="type-signature"> → {array}</span></h4>
<div class="description">
Get unique note names from array of note objects or note names
</div>
<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>notes</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last">Can contain note objects with payload property or strings of note names</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="helpers_getUniqueNoteNames.js.html">helpers/getUniqueNoteNames.js</a>, <a href="helpers_getUniqueNoteNames.js.html#line2">line 2</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
notenames
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>getUniqueNoteNames(['A3', 'B3', 'A3']) // returns ['A3', 'B3']
getUniqueNoteNames(['A', 'B', 'A']) // returns ['A', 'B']
const noteOne = new Note({name: 'A3'});
const noteTwo = new Note({name: 'B3'});
const noteThree = new Note({name: 'A3'});
getUniqueNoteNames([noteOne, noteTwo, noteThree]) // returns ['A3', 'B3']</code></pre>
<h4 class="name" id="getUniqueNoteNamesNoOctave"><span class="type-signature"></span>getUniqueNoteNamesNoOctave<span class="signature">(notes)</span><span class="type-signature"> → {array}</span></h4>
<div class="description">
Get unique note names from array of note objects or note names and remove octave from it
</div>
<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>notes</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last">Can contain note objects with payload property or strings of note names</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="helpers_getUniqueNoteNamesNoOctave.js.html">helpers/getUniqueNoteNamesNoOctave.js</a>, <a href="helpers_getUniqueNoteNamesNoOctave.js.html#line2">line 2</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
notenames
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>getUniqueNoteNamesNoOctave(['A3', 'B3', 'A3']) // returns ['A', 'B']
getUniqueNoteNamesNoOctave(['A', 'B', 'A']) // returns ['A', 'B']
const noteOne = new Note({name: 'A3'});
const noteTwo = new Note({name: 'B3'});
const noteThree = new Note({name: 'A3'});
getUniqueNoteNamesNoOctave([noteOne, noteTwo, noteThree]) // returns ['A', 'B']</code></pre>
<h4 class="name" id="isInHigherOctave"><span class="type-signature"></span>isInHigherOctave<span class="signature">(noteOneNoOctave, noteTwoNoOctave)</span><span class="type-signature"> → {boolean}</span></h4>
<div class="description">
Checks if interval between noteTwo and noteOne is negative or positive to know when to change octave
</div>
<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>noteOneNoOctave</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>noteTwoNoOctave</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="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="helpers_isInHigherOctave.js.html">helpers/isInHigherOctave.js</a>, <a href="helpers_isInHigherOctave.js.html#line3">line 3</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
isInHigherOctave
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>isInHigherOctave('A', 'B') // returns false
isInHigherOctave('B', 'A') // returns true</code></pre>
<h4 class="name" id="removeOctaveFromNoteName"><span class="type-signature"></span>removeOctaveFromNoteName<span class="signature">(noteName)</span><span class="type-signature"> → {string}</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>noteName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Note name</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="helpers_removeOctaveFromNoteName.js.html">helpers/removeOctaveFromNoteName.js</a>, <a href="helpers_removeOctaveFromNoteName.js.html#line2">line 2</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
noteName - Note name
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>removeOctaveFromNoteName('A3') // returns 'A'</code></pre>
<h4 class="name" id="reOrderNotes"><span class="type-signature"></span>reOrderNotes<span class="signature">(firstNote, notes)</span><span class="type-signature"> → {boolean}</span></h4>
<div class="description">
reorder a set of notes such that it starts with the firstNote
</div>
<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>firstNote</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>notes</code></td>
<td class="type">
<span class="param-type">array</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="helpers_reOrderNotes.js.html">helpers/reOrderNotes.js</a>, <a href="helpers_reOrderNotes.js.html#line3">line 3</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
isInHigherOctave
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>reOrderNotes('A' , ['C', 'B', 'A']) // returns ['A', 'B', 'C']
reOrderNotes('B') // returns ['B', 'C', 'D', 'E', 'F', 'G', 'A']</code></pre>
<h4 class="name" id="updateTempo"><span class="type-signature"></span>updateTempo<span class="signature">(tracksAndMeta, notes)</span><span class="type-signature"> → {object}</span></h4>
<div class="description">
reorder a set of notes such that it starts with the firstNote
</div>
<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>tracksAndMeta</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">from getTracksAndMetaFromParsedMidi getTracksAndMetaFromUrl</td>
</tr>
<tr>
<td class="name"><code>notes</code></td>
<td class="type">
<span class="param-type">array</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="helpers_updateTempo.js.html">helpers/updateTempo.js</a>, <a href="helpers_updateTempo.js.html#line7">line 7</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
tracksAndMeta
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>const newBPM = 60;
const trackIndex = 1;
const tracksAndMeta = await getTracksAndMetaFromUrl(url);
const updatedTracksAndMeta = updateTempo(tracksAndMeta, newBPM, trackIndex);
updateTempo('A' , ['C', 'B', 'A']); // returns ['A', 'B', 'C']
reOrderNotes('B'); // returns ['B', 'C', 'D', 'E', 'F', 'G', 'A']</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Instrument.html">Instrument</a></li><li><a href="Note.html">Note</a></li></ul><h3>Global</h3><ul><li><a href="global.html#addOctaveToNoteName">addOctaveToNoteName</a></li><li><a href="global.html#getInterval">getInterval</a></li><li><a href="global.html#getIntervalPermutationsFromNoteNames">getIntervalPermutationsFromNoteNames</a></li><li><a href="global.html#getJSONFromMidiURL">getJSONFromMidiURL</a></li><li><a href="global.html#getNoteNamesFromChordName">getNoteNamesFromChordName</a></li><li><a href="global.html#getNoteNamesFromIntervals">getNoteNamesFromIntervals</a></li><li><a href="global.html#getScaleNotes">getScaleNotes</a></li><li><a href="global.html#getScalesFromNoteNames">getScalesFromNoteNames</a></li><li><a href="global.html#getTracksAndMetaFromParsedMidi">getTracksAndMetaFromParsedMidi</a></li><li><a href="global.html#getTracksAndMetaFromUrl">getTracksAndMetaFromUrl</a></li><li><a href="global.html#getUniqueNoteNames">getUniqueNoteNames</a></li><li><a href="global.html#getUniqueNoteNamesNoOctave">getUniqueNoteNamesNoOctave</a></li><li><a href="global.html#isInHigherOctave">isInHigherOctave</a></li><li><a href="global.html#removeOctaveFromNoteName">removeOctaveFromNoteName</a></li><li><a href="global.html#reOrderNotes">reOrderNotes</a></li><li><a href="global.html#updateTempo">updateTempo</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Nov 20 2016 16:43:09 GMT+0200 (EET)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>