How to use the p5.Oscillator function in p5

To help you get started, we’ve selected a few p5 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LiamPKenna / js-drumz / src / js / synth.js View on Github external
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) => {
github LiamPKenna / js-drumz / src / js / synth.js View on Github external
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);

p5

[![npm version](https://badge.fury.io/js/p5.svg)](https://www.npmjs.com/package/p5)

LGPL-2.1
Latest version published 24 days ago

Package Health Score

95 / 100
Full package analysis