Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.channels[14] = new Tone.MembraneSynth({
'octaves': 15,
'oscillator': { 'type': 'triangle8' },
'envelope': { 'attack': 0.1, 'decay': 0, 'sustain': 0.5, 'release': 1.0 }
})
this.channels[15] = new Tone.MembraneSynth({
'octaves': 20,
'oscillator': { 'type': 'square8' },
'envelope': { 'attack': 0.1, 'decay': 0, 'sustain': 0.5, 'release': 1.0 }
})
// Effects
this.effects.distortion = new Tone.Distortion(0)
this.effects.chorus = new Tone.Chorus(4, 2.5, 0.5)
this.effects.reverb = new Tone.JCReverb(0)
this.effects.feedback = new Tone.FeedbackDelay(0.5)
// Mastering
this.masters.equalizer = new Tone.EQ3(2, -2, 3)
this.masters.compressor = new Tone.Compressor(-30, 3)
this.masters.limiter = new Tone.Limiter(-12)
this.masters.volume = new Tone.Volume(-12)
// Turn off all effects
for (const i in this.effects) {
this.effects[i].wet.value = 0
}
// Connect instruments to distortion
for (const id in this.channels) {
const channel = this.channels[id]
for (const i in this.effects) {
const effect = this.effects[i]
.then(bowls => {
const volume = new Tone.Volume(VOLUME_ADJUSTMENT);
const delay = new Tone.FeedbackDelay({
wet: 0.5,
delayTime: 20,
feedback: 0.8,
});
bowls.chain(delay, volume, destination);
startInterval(
lowNotes,
MIN_LOW_NOTE_INTERVAL_S,
MIN_LOW_NOTE_DELAY_S,
bowls
);
startInterval(
highNotes,
MIN_HIGH_NOTE_INTERVAL_S,
MIN_HIGH_NOTE_DELAY_S,
bowls
.then(piano => {
const reverb = new Tone.Freeverb({ roomSize: 0.7 });
const delayFudge = Math.random() * 3;
const delay = new Tone.FeedbackDelay({
wet: 0.5,
delayTime: 5 + delayFudge,
feedback: 0.8 - delayFudge / 100,
});
const chorusLfo = new Tone.LFO({
frequency: Math.random() / 100,
phase: 90,
});
chorusLfo.start();
const chorus = new Tone.Chorus({ wet: 0 });
chorusLfo.connect(chorus.wet);
const autoFilter = new Tone.AutoFilter({
frequency: Math.random() / 100,
baseFrequency: 250,
]).then(([piano, violin, corAnglais]) => {
const pianoVerb = new Tone.Freeverb({ roomSize: 0.5, wet: 0.6 });
piano.chain(pianoVerb, master);
const violinVerb = new Tone.Freeverb({ roomSize: 0.9, wet: 1 });
const violinDelay = new Tone.FeedbackDelay({
feedback: 0.75,
delayTime: 0.08,
wet: 0.5,
});
violin.chain(violinVerb, violinDelay, master);
const corAnglaisVerb = new Tone.Freeverb({ roomSize: 0.9, wet: 1 });
const corAnglaisDelay1 = new Tone.FeedbackDelay({
feedback: 0.75,
delayTime: 0.5,
wet: 0.5,
});
const corAnglaisDelay2 = new Tone.FeedbackDelay({
feedback: 0.7,
delayTime: 5,
wet: 0.5,
const violinVerb = new Tone.Freeverb({ roomSize: 0.9, wet: 1 });
const violinDelay = new Tone.FeedbackDelay({
feedback: 0.75,
delayTime: 0.08,
wet: 0.5,
});
violin.chain(violinVerb, violinDelay, master);
const corAnglaisVerb = new Tone.Freeverb({ roomSize: 0.9, wet: 1 });
const corAnglaisDelay1 = new Tone.FeedbackDelay({
feedback: 0.75,
delayTime: 0.5,
wet: 0.5,
});
const corAnglaisDelay2 = new Tone.FeedbackDelay({
feedback: 0.7,
delayTime: 5,
wet: 0.5,
});
corAnglais.chain(
corAnglaisVerb,
corAnglaisDelay1,
corAnglaisDelay2,
master
);
const notes = ['C4', 'E4', 'G4', 'C5', 'E5', 'G5'];
const intervals = notes.map(() => Math.random() * 10000 + 10000);
const minInterval = Math.min(...intervals);
const timeoutsToClear = [];
const intervalsToClear = [];
Tone.Transport.scheduleOnce(() => {
playDrumLoop();
}, '+5');
const didgeridooAutoFilter = new Tone.AutoFilter({
frequency: 0.06,
octaves: 4,
filter: { type: 'bandpass' },
})
.set({ wet: 0.7 })
.start()
.connect(masterVol);
const chorus = new Tone.Chorus().connect(didgeridooAutoFilter);
const delay = new Tone.FeedbackDelay({
feedback: 0.8,
delayTime: 0.2,
}).connect(chorus);
const reverb = new Tone.Freeverb({ roomSize: 0.7, wet: 0.5 }).connect(
delay
);
const playDigeridoo = () => {
const index = Math.floor(Math.random() * didgeridooSamples.length);
const buffer = didgeridoo.get(index);
let playbackRate = 1;
if (Math.random() < 0.1) {
playbackRate -= 0.2;
}
if (Math.random() < 0.1) {
playbackRate -= 0.2;
.then(([piano, violins, cello]) => {
const volume = new Tone.Volume(-5);
const delay = new Tone.FeedbackDelay({ feedback: 0.5, delayTime: 0.44 });
const reverb = new Tone.Freeverb({
roomSize: 0.7,
wet: 1,
dampening: 6000,
});
piano.chain(reverb, delay, volume, destination);
const playableNotes = NOTES.filter(
note => Note.oct(note) < 5 || Note.pc(note) === 'C'
);
const phrase = [
playableNotes[Math.floor(Math.random() * playableNotes.length)],
];
for (let i = 1; i < Math.random() * 5 + 5; i += 1) {
phrase.push(melodyFromNote(phrase[phrase.length - 1]));
}
getSampledInstrument('vsco2-piano-mf').then(piano => {
const reverb = new Tone.Freeverb({ roomSize: 0.7 });
const delayFudge = Math.random() * 3;
const delay = new Tone.FeedbackDelay({
wet: 0.5,
delayTime: 5 + delayFudge,
feedback: 0.8 - delayFudge / 100,
});
const chorusLfo = new Tone.LFO({
frequency: Math.random() / 100,
phase: 90,
});
chorusLfo.start();
const chorus = new Tone.Chorus({ wet: 0 });
chorusLfo.connect(chorus.wet);
const autoFilter = new Tone.AutoFilter({
frequency: Math.random() / 100,
baseFrequency: 250,
Tone.setContext(audioContext);
}
const noise = new Tone.Noise('brown');
const eq = new Tone.EQ3(-15, -Infinity, -Infinity).connect(destination);
eq.lowFrequency.value = Note.freq('C1');
const lfo = new Tone.LFO({
min: -50,
max: -15,
frequency: Math.random() / 100,
phase: 45,
});
lfo.connect(eq.low);
noise.connect(eq);
lfo.start();
const delay1 = new Tone.FeedbackDelay({
feedback: 0.7,
delayTime: 0.2,
wet: 0.5,
});
const delay2 = new Tone.FeedbackDelay({
feedback: 0.6,
delayTime: Math.random() * 10 + 20,
wet: 0.5,
});
const reverb = new Tone.Freeverb({ roomSize: 0.9, wet: 0.5 });
reverb.chain(delay1, delay2, destination);
const violinReverb = new Tone.Freeverb({ roomSize: 0.8, wet: 0.5 });
const violins = new Tone.Sampler(
samples['vsco2-violins-susvib'][preferredFormat],
{
]).then(([flute, reverb]) => {
const bufferSources = [];
reverb.connect(destination);
const delay = new Tone.FeedbackDelay({
feedback: 0.7,
delayTime: 1,
wet: 0.3,
}).connect(reverb);
const fluteVolume = new Tone.Volume(-8).connect(delay);
const playbackRate = Math.random() * 0.25 + 0.5;
const playRandom = lastNote => {
const eligibleNotes = NOTES.filter(note => note !== lastNote);
const randomNote =
eligibleNotes[Math.floor(Math.random() * eligibleNotes.length)];
const source = new Tone.BufferSource(flute.get(randomNote)).set({
playbackRate,
fadeIn: 5,