Filter allow only a specific range of frequency to pass through

how can i filter a song and allow only a specific range of frequency to pass through? Cuz when i use bandpass filter, it only allows me to input one frequency instead of a range(i.e. one lower frequency and one higher frequency)?

Hello,

There are resources at the p5.js website:
https://p5js.org/

https://p5js.org/reference/#/libraries/p5.sound

:)

Thanks. Actually, I had read it,including all those reference and examples, but i still couldn’t get a solution for it. Or, can u explain the solution

Hello,

It allows this:

// give the filter a narrow band (lower res = wider bandpass)

You will have to find the reference in the p5.js resources.
I have never used the p5.js library other than this exploration.

That is all I can offer you.

:)

I am trying to figure out this as well.
I’ve created a pure sinewave signal in the Audacity editor with an upgoing frequency range from 440 to 2000 Hz When I set the frequency for instance at 1000 Hz and the bandpass at 100, I suppose you would hear at that frequency at least a lower sound amplitude. But I don’t hear a difference at all. Maybe I’m just understanding it all wrong. I’ve tried the p5.LowPass which allows frequencies below the cutoff frequency to pass through, and attenuates frequencies above the cutoff. Also the.HighPass): The opposite of a lowpass filter. and the p5.BandPass which allows a range of frequencies to pass through and attenuates the frequencies below and above this frequency range.
The .res() method controls either width of the bandpass, or resonance of the low/highpass cutoff frequency.
Here’s the code:

At least I came one step further. You need to connect the filter to the sound with sound.connect(filter);
I added it to the embedded code above. Now at least I can experiment to understand how all this works.