enzienaudio / heavy

heavy public issue tracker and static dsp code releases
https://enzienaudio.com
ISC License
71 stars 4 forks source link

Dynamic Filtering #200

Open diemildefreude opened 7 years ago

diemildefreude commented 7 years ago

Last September I messaged @diplojocus about wanting a filter like Extended's [vcf_bp6~], which takes audio input for the q-value, allowing for smooth, quick changes to the value. @diplojocus started writing about Heavy-compiled externals and I got a bit overwhelmed and put it aside. But during that conversation he sent me this patch, which uses Heavy-only objects and said that I could modify it to be take an audio input for the q: http://s000.tinyupload.com/?file_id=04582392836268290080

Looking at it now, I'm not sure how to do that since, as it is now, the q value goes straight into a [moses] and some triggers, which can't take audio data... if anyone has an idea of how to do that, or if any other solutions for this kind of filter have emerged, please let me know!

diplojocus commented 7 years ago

@diemildefreude yes! I actually did this recently! Let me find the patch

diplojocus commented 7 years ago

vcf~.zip

diplojocus commented 7 years ago

You can set frequency and q with signal rate inputs. I've been meaning to add this to heavylib but haven't come up with a good name yet. It requires a different object to load it, so something like:

diemildefreude commented 7 years ago

That's great, Joe. I'll have a look at it soon, I just keep running into other problems. x)

diemildefreude commented 7 years ago

OK, I just tried out your patch and I'm wondering how I can use it to approximate the [vcf_bp6~] I mentioned above. Here's a .zip with the files: http://s000.tinyupload.com/?file_id=21935706242746426856

Back then, @diplojocus , you wrote me that I should be able to hook up three of PD's [vcf~]s together to get a similar result... but I needed the audio inlet for q. Now, I'm not sure how to do it with your [vcf] and, if I were to link up multiple instances, what values to feed each one. If I feed three of your [vcf]s into eachother and put the same frequency and q values into each one, I do get a more nuanced filter, but it quickly becomes prone to amplitude spikes the higher I set the q. In contrast, both PD's [vcf~] and the [vcf_bp6] become quieter the higher the q is, which makes sense since sounds are being filtered out.

Just the one Heavy-[vcf] doesn't change much if you raise the q more than 1 * x, where x = the base frequency. Also, q = 0 is oddly quiet unlike the aforementioned PD objects, which, when set to q = 0, yield a sound of the same amplitude as the input. Is this behavior due to some kind of amplitude normalizer in your patch, or am I missing something else?

diplojocus commented 7 years ago

Is there source code for the vcf_filter~ object somewhere? If we know how they calculate the coefficients then you'll be able to re-create.

I never got round to checking if the output is the same with the signal controlled q version of vcf, looks like it is different, might be a bug somewhere.

diplojocus commented 7 years ago

Ok I doubled checked, that Q controlled vcf filter is only similar in name to Pd's version. It's actually just a signal rate copy of the [hv.filter bandpass1]. It's expected to sound different.

diplojocus commented 7 years ago

And, if your next question is can we make a signal rate Q controller version of Pd's [vcf~]? it's likely when I get round to it.

diemildefreude commented 7 years ago

Could you make a s-

And, if your next question is can we make a signal rate Q controller version of Pd's [vcf~]? it's likely when I get round to it.

Oh, great, thanks. :D Also, any tips for using this one in the meantime? Specifically, I mean volume normalization, so that it gets louder when you decrease the q (or stays the same). I imagine the equation would vary depending on the sample though...

Edit: Interestingly, even if I amplify the volume to approximate that of the input, running a sound through your [vcf] with a q of 0 still sounds somewhat filtered.

diplojocus commented 7 years ago

The usual way to tackle this is to create some volume mapping parameter from your q parameter. Either use a lookup table or some function to translate the range.

For example, it's similar to changing the volume of a synth when higher note pitches are played.

diemildefreude commented 7 years ago

Yeah, I tried volume = 15 - ( q * 7), so that at a q of 0 it has about the same volume as the input and at a q of 2 it's also about the same volume, but difference is not linear, so it gets too loud at lower q levels. I'm not so great at math though...