Tone.js/examples/monoSynth.html

61 lines
1.5 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
2015-06-26 05:23:05 +00:00
<title>MonoSynth</title>
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-02-20 05:59:19 +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>
</head>
2019-01-09 01:21:29 +00:00
<body>
<style>
tone-piano {
margin-bottom: 10px;
}
</style>
<tone-example>
<tone-explanation label="MonoSynth">
<a href="https://tonejs.github.io/docs/MonoSynth">Tone.MonoSynth</a>
2015-06-27 22:02:55 +00:00
is composed of one oscillator, one filter, and two envelopes.
2015-06-26 05:23:05 +00:00
Both envelopes are triggered simultaneously when a note is triggered.
2019-01-09 01:21:29 +00:00
</tone-explanation>
2019-01-09 01:21:29 +00:00
<tone-content>
<tone-piano polyphonic></tone-piano>
<tone-mono-synth polyphonic></tone-mono-synth>
</tone-content>
</tone-example>
2015-06-26 05:23:05 +00:00
2019-01-09 01:21:29 +00:00
<script type="text/javascript">
var synth = new Tone.PolySynth(4, Tone.MonoSynth, {
2015-06-26 05:23:05 +00:00
"oscillator" : {
2018-03-29 20:57:04 +00:00
"type" : "square8"
2015-06-26 05:23:05 +00:00
},
"envelope" : {
2018-03-29 20:57:04 +00:00
"attack" : 0.05,
"decay" : 0.3,
2015-06-26 05:23:05 +00:00
"sustain" : 0.4,
2018-03-29 20:57:04 +00:00
"release" : 0.8,
},
"filterEnvelope" : {
2018-03-29 20:57:04 +00:00
"attack" : 0.001,
"decay" : 0.7,
"sustain" : 0.1,
"release" : 0.8,
"baseFrequency" : 300,
"octaves" : 4
2015-06-26 05:23:05 +00:00
}
}).toMaster();
2019-01-09 01:21:29 +00:00
//bind the interface
document.querySelector("tone-piano").bind(synth);
document.querySelector("tone-mono-synth").bind(synth);
2014-09-02 04:25:38 +00:00
</script>
</body>
</html>