Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
danigb committed Feb 26, 2019
1 parent 82a727e commit a4f9e7f
Show file tree
Hide file tree
Showing 42 changed files with 12,396 additions and 199 deletions.
151 changes: 151 additions & 0 deletions extensions_abc-notation_build_es5.js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="utf-8">
<title>extensions/abc-notation/build/es5.js - Documentation</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.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>

<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>

<label for="nav-trigger" class="overlay"></label>

<nav>

<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Abc.html">Abc</a><ul class='methods'><li data-type='method'><a href="module-Abc.html#~toAbc">toAbc</a></li><li data-type='method'><a href="module-Abc.html#~toNote">toNote</a></li></ul></li><li><a href="module-Array.html">Array</a><ul class='methods'><li data-type='method'><a href="module-Array.html#~compact">compact</a></li><li data-type='method'><a href="module-Array.html#~permutations">permutations</a></li><li data-type='method'><a href="module-Array.html#~range">range</a></li><li data-type='method'><a href="module-Array.html#~rotate">rotate</a></li><li data-type='method'><a href="module-Array.html#~sort">sort</a></li><li data-type='method'><a href="module-Array.html#~unique">unique</a></li></ul></li><li><a href="module-Chord.html">Chord</a><ul class='methods'><li data-type='method'><a href="module-Chord.html#~exists">exists</a></li><li data-type='method'><a href="module-Chord.html#~intervals">intervals</a></li><li data-type='method'><a href="module-Chord.html#~names">names</a></li><li data-type='method'><a href="module-Chord.html#~notes">notes</a></li><li data-type='method'><a href="module-Chord.html#~props">props</a></li><li data-type='method'><a href="module-Chord.html#~subsets">subsets</a></li><li data-type='method'><a href="module-Chord.html#~supersets">supersets</a></li><li data-type='method'><a href="module-Chord.html#~tokenize">tokenize</a></li></ul></li><li><a href="module-Detect.html">Detect</a><ul class='methods'><li data-type='method'><a href="module-Detect.html#~chord">chord</a></li><li data-type='method'><a href="module-Detect.html#~scale">scale</a></li></ul></li><li><a href="module-Dictionary.html">Dictionary</a><ul class='methods'><li data-type='method'><a href="module-Dictionary.html#~chord">chord</a></li><li data-type='method'><a href="module-Dictionary.html#~scale">scale</a></li></ul></li><li><a href="module-Distance.html">Distance</a><ul class='methods'><li data-type='method'><a href="module-Distance.html#~add">add</a></li><li data-type='method'><a href="module-Distance.html#~fifths">fifths</a></li><li data-type='method'><a href="module-Distance.html#~interval">interval</a></li><li data-type='method'><a href="module-Distance.html#~semitones">semitones</a></li><li data-type='method'><a href="module-Distance.html#~subtract">subtract</a></li><li data-type='method'><a href="module-Distance.html#~transpose">transpose</a></li><li data-type='method'><a href="module-Distance.html#~transposeBy">transposeBy</a></li><li data-type='method'><a href="module-Distance.html#~trFifths">trFifths</a></li></ul></li><li><a href="module-Interval.html">Interval</a><ul class='methods'><li data-type='method'><a href="module-Interval.html#~build">build</a></li><li data-type='method'><a href="module-Interval.html#~chroma">chroma</a></li><li data-type='method'><a href="module-Interval.html#~fromSemitones">fromSemitones</a></li><li data-type='method'><a href="module-Interval.html#~ic">ic</a></li><li data-type='method'><a href="module-Interval.html#~invert">invert</a></li><li data-type='method'><a href="module-Interval.html#~name">name</a></li><li data-type='method'><a href="module-Interval.html#~names">names</a></li><li data-type='method'><a href="module-Interval.html#~num">num</a></li><li data-type='method'><a href="module-Interval.html#~props">props</a></li><li data-type='method'><a href="module-Interval.html#~semitones">semitones</a></li><li data-type='method'><a href="module-Interval.html#~simplify">simplify</a></li></ul></li><li><a href="module-Note.html">Note</a><ul class='methods'><li data-type='method'><a href="module-Note.html#~altToAcc">altToAcc</a></li><li data-type='method'><a href="module-Note.html#~chroma">chroma</a></li><li data-type='method'><a href="module-Note.html#~enharmonic">enharmonic</a></li><li data-type='method'><a href="module-Note.html#~freq">freq</a></li><li data-type='method'><a href="module-Note.html#~freqToMidi">freqToMidi</a></li><li data-type='method'><a href="module-Note.html#~from">from</a></li><li data-type='method'><a href="module-Note.html#~fromMidi">fromMidi</a></li><li data-type='method'><a href="module-Note.html#~midi">midi</a></li><li data-type='method'><a href="module-Note.html#~midiToFreq">midiToFreq</a></li><li data-type='method'><a href="module-Note.html#~name">name</a></li><li data-type='method'><a href="module-Note.html#~names">names</a></li><li data-type='method'><a href="module-Note.html#~oct">oct</a></li><li data-type='method'><a href="module-Note.html#~pc">pc</a></li><li data-type='method'><a href="module-Note.html#~simplify">simplify</a></li><li data-type='method'><a href="module-Note.html#~stepToLetter">stepToLetter</a></li><li data-type='method'><a href="module-Note.html#~tokenize">tokenize</a></li></ul></li><li><a href="module-PcSet.html">PcSet</a><ul class='methods'><li data-type='method'><a href="module-PcSet.html#~chroma">chroma</a></li><li data-type='method'><a href="module-PcSet.html#~chromas">chromas</a></li><li data-type='method'><a href="module-PcSet.html#~filter">filter</a></li><li data-type='method'><a href="module-PcSet.html#~includes">includes</a></li><li data-type='method'><a href="module-PcSet.html#~intervals">intervals</a></li><li data-type='method'><a href="module-PcSet.html#~isChroma">isChroma</a></li><li data-type='method'><a href="module-PcSet.html#~isEqual">isEqual</a></li><li data-type='method'><a href="module-PcSet.html#~isSubsetOf">isSubsetOf</a></li><li data-type='method'><a href="module-PcSet.html#~isSupersetOf">isSupersetOf</a></li><li data-type='method'><a href="module-PcSet.html#~modes">modes</a></li></ul></li><li><a href="module-Range.html">Range</a><ul class='methods'><li data-type='method'><a href="module-Range.html#~chromatic">chromatic</a></li><li data-type='method'><a href="module-Range.html#~fifths">fifths</a></li><li data-type='method'><a href="module-Range.html#~numeric">numeric</a></li><li data-type='method'><a href="module-Range.html#~scale">scale</a></li></ul></li><li><a href="module-RomanNumeral.html">RomanNumeral</a><ul class='methods'><li data-type='method'><a href="module-RomanNumeral.html#~decimal">decimal</a></li><li data-type='method'><a href="module-RomanNumeral.html#~fromDegree">fromDegree</a></li><li data-type='method'><a href="module-RomanNumeral.html#~name">name</a></li><li data-type='method'><a href="module-RomanNumeral.html#~names">names</a></li><li data-type='method'><a href="module-RomanNumeral.html#~props">props</a></li><li data-type='method'><a href="module-RomanNumeral.html#~type">type</a></li></ul></li><li><a href="module-Scale.html">Scale</a><ul class='methods'><li data-type='method'><a href="module-Scale.html#~chords">chords</a></li><li data-type='method'><a href="module-Scale.html#~exists">exists</a></li><li data-type='method'><a href="module-Scale.html#~intervals">intervals</a></li><li data-type='method'><a href="module-Scale.html#~modeNames">modeNames</a></li><li data-type='method'><a href="module-Scale.html#~names">names</a></li><li data-type='method'><a href="module-Scale.html#~notes">notes</a></li><li data-type='method'><a href="module-Scale.html#~props">props</a></li><li data-type='method'><a href="module-Scale.html#~subsets">subsets</a></li><li data-type='method'><a href="module-Scale.html#~supersets">supersets</a></li><li data-type='method'><a href="module-Scale.html#~tokenize">tokenize</a></li><li data-type='method'><a href="module-Scale.html#~toScale">toScale</a></li></ul></li><li><a href="module-Tonal.html">Tonal</a><ul class='methods'><li data-type='method'><a href="module-Tonal.html#~chord">chord</a></li><li data-type='method'><a href="module-Tonal.html#~freq">freq</a></li><li data-type='method'><a href="module-Tonal.html#~interval">interval</a></li><li data-type='method'><a href="module-Tonal.html#~midi">midi</a></li><li data-type='method'><a href="module-Tonal.html#~note">note</a></li><li data-type='method'><a href="module-Tonal.html#~scale">scale</a></li><li data-type='method'><a href="module-Tonal.html#~transpose">transpose</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#alteredNotes">alteredNotes</a></li><li><a href="global.html#chords">chords</a></li><li><a href="global.html#degrees">degrees</a></li><li><a href="global.html#fromAlter">fromAlter</a></li><li><a href="global.html#leadsheetSymbols">leadsheetSymbols</a></li><li><a href="global.html#modeNames">modeNames</a></li><li><a href="global.html#props">props</a></li><li><a href="global.html#relative">relative</a></li><li><a href="global.html#scale">scale</a></li><li><a href="global.html#secDomChords">secDomChords</a></li><li><a href="global.html#tokenize">tokenize</a></li><li><a href="global.html#triads">triads</a></li></ul>
</nav>

<div id="main">

<h1 class="page-title">extensions/abc-notation/build/es5.js</h1>







<section>
<article>
<pre class="prettyprint source linenums"><code>'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var tonalNote = require('tonal-note');

/**
* [![npm version](https://img.shields.io/npm/v/tonal-abc-notation.svg?style=flat-square)](https://www.npmjs.com/package/tonal-abc-notation)
*
* Convert note strings between ABC and scientific notation
*
* This is part of [tonal](https://www.npmjs.com/package/tonal) music theory library.
*
* @example
* const Abc = require("tonal-abc-notation")
* Abc.toNote("c") // => "C5"
* Abc.toAbc("Db2") // => "_D,,"
*
* @example
* import Tonal from "tonal"
* import { toAbc } from "tonal-abc-notation"
* Tonal.Scale.notes("C major").map(toAbc);
*
* @module Abc
*/

var REGEX = /^(_{1,}|=|\^{1,}|)([abcdefgABCDEFG])([,']*)$/;
var fillStr = function (s, n) { return Array(n + 1).join(s); };

function tokenize(str) {
var m = REGEX.exec(str);
if (!m) { return ["", "", ""]; }
return [m[1], m[2], m[3]];
}

/**
* Convert a (string) note in ABC notation into a (string) note in scientific notation
*
* @param {string} abcNote - the note in ABC notation
* @return {string} the note in scientific notation of null if not valid
* @example
* Abc.toNote("c") // => "C5"
*/
function toNote(str) {
var ref = tokenize(str);
var acc = ref[0];
var letter = ref[1];
var oct = ref[2];
if (letter === "") { return null; }
var o = 4;
for (var i = 0; i &lt; oct.length; i++) { o += oct[i] === "," ? -1 : 1; }
var a =
acc[0] === "_"
? acc.replace(/_/g, "b")
: acc[0] === "^"
? acc.replace(/\^/g, "#")
: "";
return letter.charCodeAt(0) > 96
? letter.toUpperCase() + a + (o + 1)
: letter + a + o;
}

/**
* Convert a (string) note in scientific notation into a (string) note in ABC notation
*
* @param {string} note - a note in scientific notation
* @return {string} the note in ABC notation or null if not valid note
* @example
* abc.toAbc("C#4") // => "^C"
*/
function toAbc(str) {
var ref = tonalNote.props(str);
var letter = ref.letter;
var acc = ref.acc;
var oct = ref.oct;
var a = acc[0] === "b" ? acc.replace(/b/g, "_") : acc.replace(/#/g, "^");
var l = oct > 4 ? letter.toLowerCase() : letter;
var o =
oct === 5 ? "" : oct > 4 ? fillStr("'", oct - 5) : fillStr(",", 4 - oct);
return a + l + o;
}

exports.tokenize = tokenize;
exports.toNote = toNote;
exports.toAbc = toAbc;
</code></pre>
</article>
</section>






</div>

<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 26 2019 22:25:37 GMT+0100 (CET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>


</body>
</html>
2 changes: 1 addition & 1 deletion extensions_abc-notation_index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ <h1 class="page-title">extensions/abc-notation/index.js</h1>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Feb 15 2019 01:16:42 GMT+0100 (CET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 26 2019 22:04:21 GMT+0100 (CET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
Loading

0 comments on commit a4f9e7f

Please sign in to comment.