sono


    import sono from 'sono';

    const sound = sono.create({
        src: ['dnb-loop-3.ogg', 'dnb-loop-3.mp3'],
        loop: true,
        volume: 1
    });

current browser


    controls

    
        // set volume to 50%
        sound.volume = 0.5;
        // add panning control to the sound
        import panner from 'sono/effects/panner';
        const pan = sound.effects.add(panner());
        // pan fully left
        pan.set(-1);
        // set playback rate to 50%
        sound.playbackRate = 0.5;
        // toggle loop
        sound.loop = true;
        // reverse the sound
        sono.utils.reverseBuffer(sound.data);
    
    

    echo

    
        import 'sono/effects';
    
        const echo = sound.effects.add(sono.echo({
            delay: 0,
            feedback: 0
        }));
    
        // change delay time and feedback amount
        echo.delay = 1;
        echo.feedback = 1;
    
        // change both at once
        echo.update({
            delay: 1,
            feedback: 1
        });
    
    

    distortion

    
        import distortion from 'sono/effects/distortion';
    
        const distort = sound.effects.add(distortion({
            level: 0.5
        }));
    
        // change amount of distortion
        distort.level = 1;
    
    

    reverb

    
        import 'sono/effects';
    
        const reverb = sound.effects.add(sono.reverb({
            time: 1,
            decay: 5
        }));
    
        // update values
        reverb.update({
            time: 2,
            decay: 6,
            reverse: true
        });
    
    

    flanger

    
        import flanger from 'sono/effects/flanger';
    
        const flange = sound.effects.add(flanger({
            stereo: true,
            delay: 0.003
        }));
    
        // update values
        flange.delay = 0.003;
        flange.gain = 0.005;
        flange.frequency = 0.5;
        flange.feedback = 0.5;
    
    

    fade

    
        // fade sound volume to 0 over 1 second
        sound.fade(0, 1);
        // fade master volume to 0 over 1 second
        sono.fade(0, 1);
    
    

    highpass filter

    
        import 'sono/effects';
    
        const highpass = sound.effects.add(sono.highpass());
        highpass.frequency = 400;
        highpass.peak = 20;
        highpass.detune = 100;
    
    

    lowshelf filter

    
        // bass boost
        import 'sono/effects';
    
        const lowshelf = sound.effects.add(sono.lowshelf());
        lowshelf.frequency = 80;
        lowshelf.boost = 20;
        lowshelf.gain = 10;
    
    

    waveformer

    
        import analyser from 'sono/effects/analyser';
        import waveformer from 'sono/utils/waveformer';
    
        const analyse = sound.effects.add(analyser({
            fftSize: 256,
            smoothing: 0.7
        }));
    
        const waveform = waveformer({
            width: 250,
            height: 250,
            shape: 'circular',
            style: 'fill',
            lineWidth: 1.5,
            waveform: analyse.getFrequencies(false),
            color: (position, length) => {
                const hue = (position / length) * 360;
                return `hsl(${hue}, 100%, 40%)`;
            },
            transform: value => value / 256
        });
    
        function update() {
            window.requestAnimationFrame(update);
            analyse.getFrequencies();
            waveform();
        }
    
        update();
    
    

    examples

    effects examples

    links