zueblin / Polaron

A DIY drum machine for the teensy microcontroller (hardware / software)
188 stars 9 forks source link

Vague code question - I would like to add a lowpass filter to the final mix #5

Closed ivogrig closed 3 years ago

ivogrig commented 3 years ago

First of all, I love this sequencer. Only I find the tones sometimes a bit too harsh, so I would like to insert a lowpass-filter with a fixed frequency (to keep it simple) into the final mixing stage. I skimmed through the code a bit but was not quite sure so I thought I ask. I hope I am not annoying you. It looks like the effects and filters are classes from the teensy library, so I guess I could just add one at the bottom for each track, but really only need one. I don't know anything about teensy but I might just need to get through the documentation. Any help is appreciated anyways.

zueblin commented 3 years ago

I think you could try to just add two filter objects (see teensy audio design tool for details) after mixer1 and mixer2 and before the DAC object (two, because you'll want stereo filtering) See https://github.com/zueblin/Polaron/blob/master/Software/Polaron/Polaron.ino#L72-L74 You'll also need to reconfigure the AudioConnections (you'll need two new connections) so that the signal doesn't go from mixer1/2 to DAC, but from mixer1/2 to filter1/2 and then from filter1/2 output to dac. see https://github.com/zueblin/Polaron/blob/master/Software/Polaron/Polaron.ino#L89-L90

If your unsure about the Code, just use the teensy audio design tool to create the connections and let it output the code for you. Then copy/paste (plus slightly adapt) it and add to Polaron.ino.

Hope this helps

ivogrig commented 3 years ago

Thanks for the quick reply, yes I think that helps! I will close the issue