2016-01-30 18:40:19 +00:00
<!DOCTYPE html>
< html >
< head >
2019-01-09 01:21:29 +00:00
< meta charset = "utf-8" >
2016-01-30 18:40:19 +00:00
< title > FatOscillator< / 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" >
2016-01-30 18:40:19 +00:00
2019-01-09 01:21:29 +00:00
< script src = "https://unpkg.com/@webcomponents/webcomponentsjs@^2/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:36:42 +00:00
< script src = "../../examples/dist/tone-gui.js" > < / script >
< script src = "../../examples/dist/components.js" > < / script >
2016-01-30 18:40:19 +00:00
< / head >
2019-01-09 01:21:29 +00:00
< body >
< style type = "text/css" >
tone-play-toggle {
margin-bottom: 10px;
}
< / style >
2020-07-18 00:36:42 +00:00
< tone-example label = "Supersaw" >
< div slot = "explanation" >
2019-01-09 01:21:29 +00:00
< a href = "https://tonejs.github.io/docs/FatOscillator" > Tone.FatOscillator< / a > creates multiple oscillators
2016-01-30 18:40:19 +00:00
and detunes them slightly from each other to thicken the sound. The < code > count< / code > parameter sets
the number of oscillators and < code > spread< / code > sets the total spread (in cents) between the oscillators.
< br > < br >
2019-01-09 01:21:29 +00:00
FatOscillator is also available in < a href = "https://tonejs.github.io/docs/OmniOscillator" > Tone.OmniOscillator< / a >
2016-03-04 22:45:03 +00:00
by prefixing another type with "fat", then use the count and spread to control the number and detune of the oscillators. To create a "supersaw": < code > omniOscillator.type = "fatsawtooth"< / code > .
2016-01-30 18:40:19 +00:00
< br > < br >
2019-08-26 18:04:36 +00:00
< a href = "http://www.midiworld.com/files/1121/" > Jump by Van Halen MIDI< / a > converted using < a href = "https://tonejs.github.io/Midi/" > @tonejs/midi< / a >
2020-07-18 00:36:42 +00:00
< / div >
2019-01-09 01:21:29 +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 >
2016-01-30 18:40:19 +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.PolySynth(Tone.Synth, {
oscillator: {
type: "fatsawtooth",
count: 3,
spread: 30
2016-01-30 18:40:19 +00:00
},
2020-07-18 00:36:42 +00:00
envelope: {
attack: 0.01,
decay: 0.1,
sustain: 0.5,
release: 0.4,
attackCurve: "exponential"
2016-01-30 18:40:19 +00:00
},
2020-07-18 00:36:42 +00:00
}).toDestination();
2016-01-30 18:40:19 +00:00
2020-07-18 00:36:42 +00:00
2016-01-30 18:40:19 +00:00
// Van Halen - Jump MIDI from http://www.midiworld.com/files/1121/
// converted using
2020-07-18 00:36:42 +00:00
const part = new Tone.Part(((time, note) => {
2016-01-30 18:40:19 +00:00
synth.triggerAttackRelease(note.noteName, note.duration, time, note.velocity);
2020-07-18 00:36:42 +00:00
}), [{
time: "192i",
noteName: "G4",
velocity: 0.8110236220472441,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "192i",
noteName: "B4",
velocity: 0.7874015748031497,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "192i",
noteName: "D5",
velocity: 0.8031496062992126,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "480i",
noteName: "G4",
velocity: 0.7559055118110236,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "480i",
noteName: "C5",
velocity: 0.6850393700787402,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "480i",
noteName: "E5",
velocity: 0.6771653543307087,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "768i",
noteName: "F4",
velocity: 0.8661417322834646,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "768i",
noteName: "A4",
velocity: 0.8346456692913385,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "768i",
noteName: "C5",
velocity: 0.8188976377952756,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "1056i",
noteName: "F4",
velocity: 0.7007874015748031,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "1056i",
noteName: "A4",
velocity: 0.6850393700787402,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "1056i",
noteName: "C5",
velocity: 0.6614173228346457,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "1248i",
noteName: "G4",
velocity: 0.6771653543307087,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "1248i",
noteName: "B4",
velocity: 0.6771653543307087,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "1248i",
noteName: "D5",
velocity: 0.7165354330708661,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "1440i",
noteName: "G4",
velocity: 0.8818897637795275,
duration: "248i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "1440i",
noteName: "B4",
velocity: 0.84251968503937,
duration: "248i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "1440i",
noteName: "D5",
velocity: 0.8818897637795275,
duration: "248i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "1728i",
noteName: "G4",
velocity: 0.8267716535433071,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "1728i",
noteName: "C5",
velocity: 0.8031496062992126,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "1728i",
noteName: "E5",
velocity: 0.8188976377952756,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "2016i",
noteName: "F4",
velocity: 0.7086614173228346,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "2016i",
noteName: "A4",
velocity: 0.7244094488188977,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "2016i",
noteName: "C5",
velocity: 0.7007874015748031,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "2208i",
noteName: "C4",
velocity: 0.9921259842519685,
duration: "296i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "2208i",
noteName: "F4",
velocity: 0.968503937007874,
duration: "200i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "2208i",
noteName: "A4",
velocity: 0.9606299212598425,
duration: "208i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "2400i",
noteName: "E4",
velocity: 0.7559055118110236,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "2400i",
noteName: "G4",
velocity: 0.7007874015748031,
duration: "104i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "2592i",
noteName: "C4",
velocity: 0.968503937007874,
duration: "488i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "2592i",
noteName: "D4",
velocity: 0.9448818897637795,
duration: "488i"
2019-01-09 01:21:29 +00:00
},
{
2020-07-18 00:36:42 +00:00
time: "2592i",
noteName: "G4",
velocity: 0.937007874015748,
duration: "488i"
2019-01-09 01:21:29 +00:00
}
]).start(0);
2016-01-30 18:40:19 +00:00
2019-01-09 01:21:29 +00:00
part.loop = true;
part.loopEnd = "4m";
2016-01-30 18:40:19 +00:00
2019-01-09 01:21:29 +00:00
Tone.Transport.bpm.value = 132;
2016-01-30 18:40:19 +00:00
2020-07-18 00:36:42 +00:00
drawer().add({
tone: synth,
});
// bind the interface
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
< / script >
2016-01-30 18:40:19 +00:00
< / body >
2017-03-18 16:35:37 +00:00
< / html >