summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'index.html')
-rw-r--r--index.html77
1 files changed, 77 insertions, 0 deletions
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..358b4a3
--- /dev/null
+++ b/index.html
@@ -0,0 +1,77 @@
+<style>
+.note {
+ color: #339;
+ text-decoration: underline;
+ cursor: pointer;
+}
+* {
+ cursor: default;
+}
+</style>
+<pre>
+<script src="intonation.js"></script>
+<script>
+var delim = "</span> <span>"
+function write(s){ document.write("<span>" + (s || "") + "</span>\n") }
+
+s = new Intonation({
+ intervals: '1/1 9/8 5/4 4/3 3/2 5/3 15/8 2/1',
+})
+write("original scale:")
+write( s.range(0, 10).map(function(i){ return i.toFixed(0) }).join(delim) )
+write("")
+
+s = new Intonation({
+ root: 450,
+ intervals: '1/1 9/8 5/4 4/3 3/2 5/3 15/8 2/1',
+})
+write("root @ 450:")
+write( s.range(0, 10).map(function(i){ return i.toFixed(0) }).join(delim) )
+write("")
+
+s = new Intonation({
+ tet: 5,
+})
+write("5-tet")
+write( s.range(0, 6).map(function(i){ return i.toFixed(0) }).join(delim) )
+write("")
+
+s = new Intonation({
+ tet: 12,
+})
+write("12-tet")
+write( s.range(0, 13).map(function(i){ return i.toFixed(0) }).join(delim) )
+write("")
+
+s = new Intonation({
+ tet: 17,
+})
+write("17-tet")
+write( s.range(0, 18).map(function(i){ return i.toFixed(0) }).join(delim) )
+write("")
+
+</script>
+<script src="http://asdf.us/harp/js/vendor/Tone.min.js"></script>
+<script>
+polysynth = new Tone.PolySynth(8, Tone.synth)
+polysynth.set({
+ oscillator: { type: "sine" },
+ envelope:{
+ attack: 0.01,
+ decay: 2.5,
+ sustain: 0.0,
+ release: 0.1,
+ }
+})
+var comp = new Tone.Compressor(-30, 3).toMaster()
+polysynth.connect(comp)
+Array.prototype.slice.apply( document.querySelectorAll("span") ).forEach(function(span){
+ if (! span.innerHTML.match(/[^0-9]/)) {
+ var f = parseInt(span.innerHTML)
+ span.classList.add("note")
+ span.addEventListener("click", function(){
+ polysynth.triggerAttackRelease(f, 1.5)
+ })
+ }
+})
+</script> \ No newline at end of file