2016-01-30 21:13:44 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2019-01-09 01:21:29 +00:00
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>MetalSynth</title>
|
2016-01-30 21:13:44 +00:00
|
|
|
|
2019-01-09 01:21:29 +00:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
|
|
<link rel="icon" type="image/png" sizes="174x174" href="./favicon.png">
|
2016-01-30 21:13:44 +00:00
|
|
|
|
2019-01-09 01:21:29 +00:00
|
|
|
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@^2/webcomponents-bundle.js"></script>
|
|
|
|
<script src="../build/Tone.js"></script>
|
|
|
|
<script src="./js/tonejs-ui.js"></script>
|
2016-01-30 21:13:44 +00:00
|
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
2019-01-09 01:21:29 +00:00
|
|
|
<tone-example>
|
|
|
|
<tone-explanation label="Bembe">
|
|
|
|
<a href="https://tonejs.github.io/docs/MetalSynth">Tone.MetalSynth</a>
|
2016-12-22 18:11:38 +00:00
|
|
|
creates metallic, inharmonic sounds using 6
|
2019-01-09 01:21:29 +00:00
|
|
|
<a href="https://tonejs.github.io/docs/FMOscillator">Tone.FMOscillators</a>
|
2016-12-22 18:11:38 +00:00
|
|
|
with a tuning based on the TR-808 Cymbal.
|
2019-01-09 01:21:29 +00:00
|
|
|
<a href="https://tonejs.github.io/docs/MembraneSynth">Tone.MembraneSynth</a>
|
2016-12-22 18:11:38 +00:00
|
|
|
makes kick and tom-like sounds using a frequency envelope which is triggered on notes attack.
|
2019-01-09 01:21:29 +00:00
|
|
|
</tone-explanation>
|
2016-01-30 21:13:44 +00:00
|
|
|
|
2019-01-09 01:21:29 +00:00
|
|
|
<tone-content>
|
|
|
|
<tone-play-toggle></tone-play-toggle>
|
|
|
|
</tone-content>
|
2016-01-30 21:13:44 +00:00
|
|
|
|
2019-01-09 01:21:29 +00:00
|
|
|
<tone-drawer>
|
|
|
|
<tone-metal-synth collapsed></tone-metal-synth>
|
|
|
|
<tone-membrane-synth collapsed></tone-membrane-synth>
|
|
|
|
</tone-drawer>
|
|
|
|
</tone-example>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2016-01-30 21:13:44 +00:00
|
|
|
var bell = new Tone.MetalSynth({
|
|
|
|
"harmonicity" : 12,
|
|
|
|
"resonance" : 800,
|
|
|
|
"modulationIndex" : 20,
|
|
|
|
"envelope" : {
|
|
|
|
"decay" : 0.4,
|
|
|
|
},
|
|
|
|
"volume" : -15
|
|
|
|
}).toMaster();
|
|
|
|
|
|
|
|
var bellPart = new Tone.Sequence(function(time, freq){
|
|
|
|
bell.frequency.setValueAtTime(freq, time, Math.random()*0.5 + 0.5);
|
|
|
|
bell.triggerAttack(time);
|
2019-01-09 01:21:29 +00:00
|
|
|
}, [[300, null, 200],
|
|
|
|
[null, 200, 200],
|
|
|
|
[null, 200, null],
|
|
|
|
[200, null, 200]
|
|
|
|
], "4n").start(0);
|
2016-01-30 21:13:44 +00:00
|
|
|
|
|
|
|
// bellPart.loop = true;
|
|
|
|
// bellPart.loopEnd = "1m";
|
|
|
|
|
|
|
|
var conga = new Tone.MembraneSynth({
|
|
|
|
"pitchDecay" : 0.008,
|
|
|
|
"octaves" : 2,
|
|
|
|
"envelope" : {
|
|
|
|
"attack" : 0.0006,
|
|
|
|
"decay" : 0.5,
|
|
|
|
"sustain" : 0
|
|
|
|
}
|
|
|
|
}).toMaster();
|
|
|
|
|
|
|
|
var congaPart = new Tone.Sequence(function(time, pitch){
|
|
|
|
conga.triggerAttack(pitch, time, Math.random()*0.5 + 0.5);
|
|
|
|
}, ["G3", "C4", "C4", "C4"], "4n").start(0);
|
|
|
|
|
|
|
|
// congaPart.loop = true;
|
|
|
|
// congaPart.loopEnd = "1m";
|
|
|
|
|
|
|
|
Tone.Transport.bpm.value = 115;
|
|
|
|
|
2019-01-09 01:21:29 +00:00
|
|
|
//bind the interface
|
|
|
|
document.querySelector("tone-play-toggle").bind(Tone.Transport);
|
|
|
|
document.querySelector("tone-metal-synth").bind(bell);
|
|
|
|
document.querySelector("tone-membrane-synth").bind(conga);
|
2017-03-26 20:39:19 +00:00
|
|
|
|
2016-01-30 21:13:44 +00:00
|
|
|
</script>
|
|
|
|
</body>
|
2017-03-18 16:35:37 +00:00
|
|
|
</html>
|