# P5 sound - connecting filters in series

**URL:** https://discourse.processing.org/t/p5-sound-connecting-filters-in-series/36728
**Category:** Coding Questions
**Created:** [May 5, 2022, 11:05am UTC](https://discourse.processing.org/t/p5-sound-connecting-filters-in-series/36728 "2022-05-05T11:05:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![spurge](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@spurge](https://discourse.processing.org/u/spurge)
#### Post date: [May 5, 2022, 11:05am UTC](https://discourse.processing.org/t/p5-sound-connecting-filters-in-series/36728/1 "2022-05-05T11:05:19Z")

</div>

Hello,

I’m a beginner with a question regarding p5 sound. I’m looking for a proper way to cascade filters, that is connecting them in series. For now, I’m using a lowshelf and a highshelf filter.

In the example code, [reference | p5.js](https://p5js.org/reference/#/p5.Filter), the filter seems to be connected to main out automatically (this is my assumtion, please let me know if I’m wrong). Initially, I connected my fiters like this (source → lowshelf → highshelf)

```auto
source.connect(lowShelf);
lowShelf.connect(highShelf);

```

While the output from the lowshelf was ok, the highshelf did not work properly (boost was a bit less in terms of dB, attenuation was very limited, about -4dB when setting the filter to -20, which was a ceiling; and less than -20 still gave just -4).

In an attempt to fix this issue, I’ve found that using and empty bracket for the connect() method helped. I’ve also seen effects connected in ‘reverse’ (main out first, source last) here [P5.sound :: Educational material for LSU Programming Digital Media](https://pdm.lsupathways.org/6_resources/7_soundandmusic/p5.sound/)

```auto
		highShelf.connect();
		lowShelf.connect(highShelf);
		source.connect(lowShelf);

```

Is this the right way to get both filters to work properly?  
Is there any in-depth documentation that I could consult?  
I’ve not looked into phase reposes yet, but if anyone has some information (regardless of the type of filter, I may use peaking later), please share. 🙂

About disconnecting, I am also wondering about the oder, if I’d need to specify anything in (), and if I need to include everying priorly connected, e.g.:

```auto
	source.disconnect();
	highShelf.disconnect();
	lowShelf.disconnect();

```

Many thanks!
