Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>WebAudio example of biquad filter node</title>
</head>
<body>
       <audio src="https://mainline.i3s.unice.fr/mooc/guitarRiff1.mp3" id="biquadExample" controls loop crossorigin="anonymous"></audio>
        <br>
        <label>Frequency</label>
        <input type="range" min="0" max="22050" step="1" value="350" id="biquadFilterFrequencySlider" />
        <label>Detune</label>
        <input type="range" min="0" max="100" step="1" value="0" id="biquadFilterDetuneSlider" />
        <label>Q</label>
        <input type="range" min="0.0001" max="1000" step="0.01" value="1" id="biquadFilterQSlider" />
        <label>Type</label>
        <select id="biquadFilterTypeSelector">
            <option value="lowpass" selected>lowpass</option>
            <option value="highpass">highpass</option>
            <option value="bandpass">bandpass</option>
            <option value="lowshelf">lowshelf</option>
            <option value="highshelf">highshelf</option>
            <option value="peaking">peaking</option>
            <option value="notch">notch</option>
            <option value="allpass">allpass</option>
        </select>
</body>
</html>
 
var ctx = window.AudioContext || window.webkitAudioContext;
var audioContext = new ctx();
/* BiquadFilterNode */
var biquadExample = document.querySelector('#biquadExample');
    biquadExample.onplay = (e) => {audioContext.resume();}
var biquadFilterFrequencySlider = document.querySelector('#biquadFilterFrequencySlider');
var biquadFilterDetuneSlider = document.querySelector('#biquadFilterDetuneSlider');
var biquadFilterQSlider = document.querySelector('#biquadFilterQSlider');
var biquadFilterTypeSelector = document.querySelector('#biquadFilterTypeSelector');
var biquadExampleMediaElementSource = audioContext.createMediaElementSource(biquadExample);
var filterNode = audioContext.createBiquadFilter();
biquadExampleMediaElementSource.connect(filterNode);
filterNode.connect(audioContext.destination);
biquadFilterFrequencySlider.oninput = function(evt){
    filterNode.frequency.value = parseFloat(evt.target.value);
};
biquadFilterDetuneSlider.oninput = function(evt){
    filterNode.detune.value = parseFloat(evt.target.value);
};
biquadFilterQSlider.oninput = function(evt){
    filterNode.Q.value = parseFloat(evt.target.value);
};
biquadFilterTypeSelector.onchange = function(evt){
    filterNode.type = evt.target.value;
}
;
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
micbuffapro
0viewers