2015-06-26 05:23:05 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
2016-05-23 23:52:56 +00:00
|
|
|
<title>Synth</title>
|
2015-06-26 05:23:05 +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">
|
2015-06-26 05:23:05 +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>
|
2015-06-26 05:23:05 +00:00
|
|
|
</head>
|
2019-01-09 01:21:29 +00:00
|
|
|
<body>
|
|
|
|
<style>
|
|
|
|
tone-piano {
|
|
|
|
margin-bottom: 10px;
|
2015-06-26 05:23:05 +00:00
|
|
|
}
|
|
|
|
</style>
|
2020-07-18 00:36:42 +00:00
|
|
|
<tone-example label="Synth">
|
|
|
|
<div slot="explanation">
|
2019-01-09 01:21:29 +00:00
|
|
|
<a href="https://tonejs.github.io/docs/Synth" target="_blank">Tone.Synth</a> is composed simply of a
|
|
|
|
<a href="https://tonejs.github.io/docs/OmniOscillator" target="_blank">Tone.OmniOscillator</a>
|
2015-06-26 05:23:05 +00:00
|
|
|
routed through a
|
2019-01-09 01:21:29 +00:00
|
|
|
<a href="https://tonejs.github.io/docs/AmplitudeEnvelope" target="_blank">Tone.AmplitudeEnvelope</a>.
|
2020-07-18 00:36:42 +00:00
|
|
|
</div>
|
2015-06-26 05:23:05 +00:00
|
|
|
|
2020-07-18 00:36:42 +00:00
|
|
|
<div id="content">
|
|
|
|
</div>
|
2019-01-09 01:21:29 +00:00
|
|
|
</tone-example>
|
2015-06-26 05:23:05 +00:00
|
|
|
|
2019-01-09 01:21:29 +00:00
|
|
|
<script type="text/javascript">
|
2020-07-18 00:36:42 +00:00
|
|
|
const synth = new Tone.Synth({
|
2020-07-19 00:20:19 +00:00
|
|
|
oscillator: {
|
|
|
|
type: "amtriangle",
|
|
|
|
harmonicity: 0.5,
|
|
|
|
modulationType: "sine"
|
2015-06-26 05:23:05 +00:00
|
|
|
},
|
2020-07-19 00:20:19 +00:00
|
|
|
envelope: {
|
|
|
|
attackCurve: "exponential",
|
|
|
|
attack: 0.05,
|
|
|
|
decay: 0.2,
|
|
|
|
sustain: 0.2,
|
|
|
|
release: 1.5,
|
2018-03-06 05:03:04 +00:00
|
|
|
},
|
2020-07-19 00:20:19 +00:00
|
|
|
portamento: 0.05
|
2020-07-18 00:36:42 +00:00
|
|
|
}).toDestination();
|
2015-06-26 05:23:05 +00:00
|
|
|
|
2020-07-18 00:36:42 +00:00
|
|
|
piano({
|
|
|
|
tone: synth,
|
|
|
|
parent: document.querySelector("#content"),
|
|
|
|
noteon: (note) => synth.triggerAttack(note.name),
|
|
|
|
noteoff: (note) => synth.triggerRelease()
|
2020-07-19 00:20:19 +00:00
|
|
|
});
|
2020-07-18 00:36:42 +00:00
|
|
|
|
|
|
|
ui({
|
|
|
|
tone: synth,
|
|
|
|
name: "Synth",
|
|
|
|
parent: document.querySelector("#content"),
|
2020-07-19 00:20:19 +00:00
|
|
|
});
|
2015-06-26 05:23:05 +00:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
2019-01-09 01:21:29 +00:00
|
|
|
</html>
|