P5 sound - connecting filters in series

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, 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)

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

		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. :slight_smile:

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.:

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

Many thanks!