Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const loadSoundFonts = async () => {
const sendReverbGain = new Tone.Gain(0.3);
const sendReverb = new Tone.Freeverb(0.7, 1000); // Tone.JCReverb();
const melodyEQ = new Tone.EQ3(0, -5, 0);
const melodyGain = new Tone.Gain(0.6);
const melodySound = await Soundfont.instrument(
ac,
"acoustic_grand_piano",
{
soundfont: "MusyngKite",
destination: melodyEQ,
adsr: [0.02, 0.3, 0.9, 1.5]
}
);
melodyEQ.chain(melodyGain, sendReverb, sendReverbGain, Master);
melodyEQ.chain(melodyGain, Master);
console.log("Melody sounds loaded!");
player1.result(scores.DRAW);
player2.result(scores.DRAW);
break;
}
if (debug) { drawGrid(grid); }
if (debug) { console.log('RESULT: ' + checkResult(grid)) };
//if (debug) { player1.drawTree(); }
return grid;
}
let stepCount = 0;
let canStartNew = false;
var freeverb = new Tone.Freeverb().toMaster();
freeverb.dampening.value = 600;
freeverb.roomSize.value = 0.9;
let fm1 = new Tone.FMSynth({
"harmonicity" : 4 ,
"modulationIndex" : 3 ,
"detune" : 0 ,
"oscillator" : {
"type" : "sine"
} ,
"envelope" : {
"attack" : 0.003 ,
"decay" : 0.1 ,
"sustain" : 2 ,
"release" : 5
} ,
]).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,
});
p.sphere(this.sphereSizes[i]);
p.pop();
this.colors[i] -= 4;
if(this.sphereSizes[i] > 2)this.sphereSizes[i] -= 1;
}
p.pop();
this.counter += this.speed;
}
}
let r0, r1, r2, r3, r4, r5, r6;
let po = 12;
let notes = [28 + po, 40 + po, 43 + po, 45 + po, 57 + po, 60 + po, 64 + po];
var freeverb = new Tone.Freeverb().toMaster();
freeverb.dampening.value = 1500;
freeverb.roomSize.value = 0.79;
var chorus = new Tone.Chorus(0.8, 2.5, 0.2).connect(freeverb);
let synths = [];
for(let i=0; i<7; i++) {
synths.push(
new Tone.FMSynth({
"harmonicity" : 10 ,
"modulationIndex" : 80 ,
"detune" : 0 ,
"oscillator" : {
"type" : "sine"
} ,
.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 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 });
const stereoWidener = new Tone.StereoWidener();
const widenerLfo = new Tone.LFO({ frequency: Math.random() / 100 });
widenerLfo.connect(stereoWidener.width);
reverb.chain(delay1, delay2, stereoWidener, master);
const timeoutsToClear = [];
const intervalsToClear = [];
const violinReverb = new Tone.Freeverb({ roomSize: 0.8, wet: 0.5 });
const violins = new Tone.Sampler(samples['vsco2-violins-susvib'], {
release: 8,
curve: 'linear',
onload: () => {
const notes = Chord.notes('C', 'maj7').reduce(
(allNotes, pc) =>
allNotes.concat([2, 3, 4].map(octave => `${pc}${octave}`)),
[]
);
notes.forEach(note => {
const playNote = () => {
violins.triggerAttack(note, '+1');
};
const timeout = setTimeout(() => {
const interval = setInterval(() => {
playNote();
let sortedArrayA = [];
let stopA = false;
let cElementA = 0;
let arrayB = [];
for(let i=0;i
.then(piano => {
const reverb = new Tone.Freeverb({ roomSize: 0.6 });
piano.chain(reverb, destination);
playProgression(piano);
return () => {
[reverb, piano].forEach(node => node.dispose());
};
});
const sketch = (p) => {
let hexacodes = [];
let hexagrams = [];
var vol = new Tone.Volume(-70).toMaster();
var freeverb = new Tone.Freeverb().connect(vol);
freeverb.dampening.value = 10000;
freeverb.roomSize.value = 0.89;
var vol2 = new Tone.Volume(-10).toMaster();
let osc = new Tone.Oscillator(100, "sine").connect(vol2).start()
class Hexagram {
constructor(index, temppivotX, temppivotY, templineWeight) {
this.offSet = [];
this.hexList = [];
this.spacing;
this.lineLength;
this.pivotX = temppivotX;
this.pivotY = temppivotY;
this.lineWeight = templineWeight;
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],
{
release: 8,
curve: 'linear',
onload: () => {
const notes = Chord.notes('C', 'maj7').reduce(
(allNotes, pc) =>
allNotes.concat([2, 3, 4].map(octave => `${pc}${octave}`)),
[]
);
notes.forEach(note => {
Tone.Transport.scheduleRepeat(
() => violins.triggerAttack(note, '+1'),
Math.random() * 120 + 60,
30