Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const setup = () => {
let cnv = p5.createCanvas(400, 200, p5.WEBGL);
cnv.parent('chaos');
p5.noFill();
carrier = new P5.Oscillator('sine');
carrier.amp(0);
carrier.freq(100);
carrier.start();
modulator = new P5.Oscillator('triangle');
modulator.disconnect();
modulator.freq(5);
modulator.amp(1);
modulator.start();
carrier.freq(modulator);
analyzer = new P5.FFT();
const toggleAudio = (cnv) => {
const setup = () => {
let cnv = p5.createCanvas(400, 200, p5.WEBGL);
cnv.parent('chaos');
p5.noFill();
carrier = new P5.Oscillator('sine');
carrier.amp(0);
carrier.freq(100);
carrier.start();
modulator = new P5.Oscillator('triangle');
modulator.disconnect();
modulator.freq(5);
modulator.amp(1);
modulator.start();
carrier.freq(modulator);
analyzer = new P5.FFT();
const toggleAudio = (cnv) => {
p5.waveform = analyzer.waveform();
cnv.mouseClicked(function() {
modFreq = p5.map(p5.mouseY, p5.height, 0, modMinFreq, modMaxFreq);
modulator.freq(modFreq);