Function wave

  • Creates a wave modulator. Defaults to 5-second sine wave.

    import { wave } from 'https://unpkg.com/ixfx/dist/modulation.js';
    // Triangle wave that has a single cycle over two seconds
    const m = wave({ secs: 2, shape: `triangle`});

    // Call m() to get current value of wave, eg in
    // an animation loop
    const v = m();

    Parameters

    Returns ((feedback?: Partial<WaveShaperFeedback>) => number)

    import { wave } from 'https://unpkg.com/ixfx/dist/modulation.js';
    import { resolveFields } from 'https://unpkg.com/ixfx/dist/data.js';

    const state = {
    intensity: wave({secs: 2, shape: `sine` }),
    someOtherState: 10
    }

    const use = async () {
    const { intensity } = await resolveFields(state);
    // Do something with intensity value...
    }