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
|
|
|
|
2020-07-18 00:58:09 +00:00
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.4.3/webcomponents-bundle.js"></script>
|
2020-07-18 00:36:42 +00:00
|
|
|
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet"/>
|
2019-01-09 01:21:29 +00:00
|
|
|
<script src="../build/Tone.js"></script>
|
2020-07-18 00:58:09 +00:00
|
|
|
<script src="./js/tone-ui.js"></script>
|
|
|
|
<script src="./js/components.js"></script>
|
2016-01-30 21:13:44 +00:00
|
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
2020-07-18 00:36:42 +00:00
|
|
|
<tone-example label="Bembe">
|
|
|
|
<div slot="explanation">
|
2019-01-09 01:21:29 +00:00
|
|
|
<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.
|
2020-07-18 00:36:42 +00:00
|
|
|
</div>
|
2016-01-30 21:13:44 +00:00
|
|
|
|
2020-07-18 00:36:42 +00:00
|
|
|
<div id="content">
|
2019-01-09 01:21:29 +00:00
|
|
|
<tone-play-toggle></tone-play-toggle>
|
2020-07-18 00:36:42 +00:00
|
|
|
</div>
|
2019-01-09 01:21:29 +00:00
|
|
|
</tone-example>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2020-07-18 00:36:42 +00:00
|
|
|
const bell = new Tone.MetalSynth({
|
|
|
|
harmonicity: 12,
|
|
|
|
resonance: 800,
|
|
|
|
modulationIndex: 20,
|
|
|
|
envelope: {
|
|
|
|
decay: 0.4,
|
2016-01-30 21:13:44 +00:00
|
|
|
},
|
2020-07-18 00:36:42 +00:00
|
|
|
volume: -15
|
|
|
|
}).toDestination();
|
2016-01-30 21:13:44 +00:00
|
|
|
|
2020-07-18 00:36:42 +00:00
|
|
|
const bellPart = new Tone.Sequence(((time, freq) => {
|
2019-09-04 00:35:32 +00:00
|
|
|
bell.triggerAttack(freq, time, Math.random()*0.5 + 0.5);
|
2020-07-18 00:36:42 +00:00
|
|
|
}), [[300, null, 200],
|
2019-01-09 01:21:29 +00:00
|
|
|
[null, 200, 200],
|
|
|
|
[null, 200, null],
|
|
|
|
[200, null, 200]
|
|
|
|
], "4n").start(0);
|
2016-01-30 21:13:44 +00:00
|
|
|
|
2020-07-18 00:36:42 +00:00
|
|
|
const conga = new Tone.MembraneSynth({
|
|
|
|
pitchDecay: 0.008,
|
|
|
|
octaves: 2,
|
|
|
|
envelope: {
|
|
|
|
attack: 0.0006,
|
|
|
|
decay: 0.5,
|
|
|
|
sustain: 0
|
2016-01-30 21:13:44 +00:00
|
|
|
}
|
2020-07-18 00:36:42 +00:00
|
|
|
}).toDestination();
|
2016-01-30 21:13:44 +00:00
|
|
|
|
2020-07-18 00:36:42 +00:00
|
|
|
const congaPart = new Tone.Sequence(((time, pitch) => {
|
2016-01-30 21:13:44 +00:00
|
|
|
conga.triggerAttack(pitch, time, Math.random()*0.5 + 0.5);
|
2020-07-18 00:36:42 +00:00
|
|
|
}), ["G3", "C4", "C4", "C4"], "4n").start(0);
|
2016-01-30 21:13:44 +00:00
|
|
|
|
|
|
|
Tone.Transport.bpm.value = 115;
|
|
|
|
|
2020-07-18 00:36:42 +00:00
|
|
|
drawer().add({
|
|
|
|
tone: conga,
|
|
|
|
title: "Conga"
|
|
|
|
}).add({
|
|
|
|
tone: bell,
|
|
|
|
title: "Bell"
|
|
|
|
});
|
|
|
|
|
|
|
|
// connect the UI with the components
|
|
|
|
document.querySelector("tone-play-toggle").addEventListener("start", () => Tone.Transport.start());
|
|
|
|
document.querySelector("tone-play-toggle").addEventListener("stop", () => Tone.Transport.stop());
|
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>
|