diff options
| -rw-r--r-- | index.html | 62 | ||||
| -rw-r--r-- | intonation.js | 9 |
2 files changed, 66 insertions, 5 deletions
@@ -52,6 +52,52 @@ pre { 1200. </script> +<script type="text/scale" id="mavila12-scl"> +! mavila12.scl +! +A 12-note mavila scale (for warping meantone-based music), 5-limit TOP + 12 +! +-30.99719 + 163.50770 + 358.01258 + 327.01540 + 521.52028 + 490.52310 + 685.02798 + 654.03080 + 848.53568 + 1043.04057 + 1012.04338 + 1206.54826 +</script> + +<script type="text/scale" id="carlos_alpha-scl"> +! carlos_alpha.scl +! +Wendy Carlos' Alpha scale with perfect fifth divided in nine + 18 +! + 78.00000 + 156.00000 + 234.00000 + 312.00000 + 390.00000 + 468.00000 + 546.00000 + 624.00000 + 702.00000 + 780.00000 + 858.00000 + 936.00000 + 1014.00000 + 1092.00000 + 1170.00000 + 1248.00000 + 1326.00000 + 1404.00000 +</script> + <pre> <script src="intonation.js"></script> <script> @@ -115,6 +161,22 @@ write("meantone.scl:") write( s.range(0, s.scale.length+1).map(function(i){ return i.toFixed(0) }).join(delim) ) write("") +s = new Intonation({ + scl: document.querySelector("#mavila12-scl").innerHTML +}) +write("mavila12.scl:") +write( s.range(0, s.scale.length+1).map(function(i){ return i.toFixed(0) }).join(delim) ) +write( s.range(0, (s.scale.length*2)+1).map(function(i){ return i.toFixed(0) }).join(delim) ) +write("") + +s = new Intonation({ + scl: document.querySelector("#carlos_alpha-scl").innerHTML +}) +write("carlos_alpha.scl (does not contain octave):") +write( s.range(0, s.scale.length+1).map(function(i){ return i.toFixed(0) }).join(delim) ) +write( s.range(0, (s.scale.length*2)+1).map(function(i){ return i.toFixed(0) }).join(delim) ) +write("") + </script> <script src="http://asdf.us/harp/js/vendor/Tone.min.js"></script> <script> diff --git a/intonation.js b/intonation.js index 8c12847..fe2fa37 100644 --- a/intonation.js +++ b/intonation.js @@ -28,7 +28,7 @@ var Intonation = (function(){ interval_list = interval_list.split(" ") } this.intervals = interval_list - this.opt.interval = parseInterval.call(this, interval_list.pop() ) + this.interval = this.opt.interval = parseInterval.call(this, interval_list.pop() ) this.scale = interval_list.map( parseIntervalString.bind(this) ).filter(function(v){ return !! v }) @@ -37,7 +37,7 @@ var Intonation = (function(){ var scale = this.scale = [] var root = this.opt.root var tet = this.opt.tet - var interval = this.opt.interval + var interval = this.interval = this.opt.interval var ratio = Math.pow( interval, 1/tet ) var n = root scale.push(n) @@ -83,7 +83,6 @@ var Intonation = (function(){ note = Math.pow( 2, (parseFloat(note) / 1200) ) } else { - console.log("note", line, note) note = parseInterval(note) } if (note) { @@ -97,7 +96,7 @@ var Intonation = (function(){ octave = octave || this.opt.octave var f = this.scale[ mod(i, this.scale.length)|0 ] var pow = Math.floor(norm(i, 0, this.scale.length)) + octave - f *= Math.pow(this.opt.interval, pow) + f *= Math.pow(this.interval, pow) return f } Intonation.prototype.range = function(min, max){ @@ -115,7 +114,7 @@ var Intonation = (function(){ if (f == 0) return 0 var scale_f = f var pow = 0 - var interval = this.opt.interval + var interval = this.interval var scale = this.scale while (scale_f < root) { scale_f *= interval |
