[ Launch: timbre.js ] 5893159 by enjalot
-
-
Save enjalot/5893159 to your computer and use it in GitHub Desktop.
timbre.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"description":"timbre.js","endpoint":"","display":"svg","public":true,"require":[{"name":"timbrejs","url":"http://mohayonao.github.io/timbre.js/timbre.js"},{"name":"supercollider","url":"http://mohayonao.github.io/subcollider.js/builds/subcollider-min.js"},{"name":"supercollider","url":"http://mohayonao.github.io/subcollider.js/builds/subcollider-min.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/ZRfCF1B.png"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var svg = d3.select("svg"); | |
T.reset(); | |
var pattern = new sc.Pshuf(sc.series(12), Infinity); | |
var scale = new sc.Scale.major(); | |
var chords = [ | |
[0, 1, 4], [0, 1, 5], [0, 1, 6], | |
[0, 2, 6], [0, 2, 5], [0, 2, 4], | |
[0, 3, 6], [0, 3, 5], [0, 3, 4] | |
]; | |
var msec = timbre.timevalue("BPM120 L16"); | |
var osc = T("saw"); | |
var env = T("env", {table:[0.2, [1, msec * 48], [0.2, msec * 16]]}); | |
var gen = T("OscGen", {osc:osc, env:env, mul:0.5}); | |
var pan = T("pan", gen); | |
var synth = pan; | |
synth = T("+saw", {freq:(msec * 2)+"ms", add:0.5, mul:0.85}, synth); | |
synth = T("lpf" , {cutoff:800, Q:12}, synth); | |
synth = T("reverb", {room:0.9, damp:0.1, mix:0.75}, synth); | |
T("interval", {interval:msec * 64}, function() { | |
var root = pattern.next(); | |
chords.choose().forEach(function(i) { | |
gen.noteOn(scale.wrapAt(root + i) +60, 80); | |
}); | |
pan.pos.value = Math.random() * 2 - 1; | |
}).set({buddies:synth}).start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment