AnalogFilter and GetBandpassValue()

Post Reply
jugwineUSA
Posts: 2
Joined: Tue Dec 24, 2024 9:02 pm

AnalogFilter and GetBandpassValue()

Post by jugwineUSA »

Hello. I'm working on an EQ module, and I can't seem to understand the logic/usage of GetBandpassValue(). A couple things:



1. GetLowpassValue and GetHighpassValue() both have signal, but GetBandpassValue() doesn't output anything. Even when Cutoff is being swept, only a _very_ faint signal can be heard _sometimes_.

2. I'm building parallel EQ, meaning I want to clamp bands to frequency ranges. After processing the clamped range, I filter it again with adjustable amp, cutoff, and q. How do I get that fully modified value now?

Assume I have three filers: hpf, lpf, and bandFilter. I pass hpf filtered value to lpf, then get lpf's lowpass signal. Then send that signal to the final filter that has adjustable cutoff. calling GetHighpass() or GetLowpass() only brings those ranges. I want the fully range. Do I need to sum those or is there another way?

Code: Select all

hpf.ProcessSample(sample);
lpf.ProcessSample(hpf.GetHighpassValue());

double clamped = lpf.GetLowpassValue();

bandFilter.ProcessSample(clamped);


// How can I get the fully filtered signal??
double filteredBand = bandFilter.Get??????


All help is appreciated. Thanks
User avatar
ChR_is
Posts: 125
Joined: Wed Sep 22, 2021 5:48 pm

Re: AnalogFilter and GetBandpassValue()

Post by ChR_is »

jugwineUSA wrote: Tue Dec 24, 2024 9:10 pm Assume I have three filers: hpf, lpf, and bandFilter. I pass hpf filtered value to lpf, then get lpf's lowpass signal. Then send that signal to the final filter that has adjustable cutoff.
what are you trying to achieve? you have a hpf and a lpf in series. that's basically a bandpass already. and then you pass that result into an actual bandpass filter? depending on what the cutoff frequency of that bandpass filter is you might be in a range where there is very little signal to begin with. even worse if the hpf is set to a high frequency and the lpf is set to a low frequency the resulting "bandpass" response from the those two filters would be very low level already.
jugwineUSA wrote: Tue Dec 24, 2024 9:10 pm 1. GetLowpassValue and GetHighpassValue() both have signal, but GetBandpassValue() doesn't output anything. Even when Cutoff is being swept, only a _very_ faint signal can be heard _sometimes_.
what do you mean by "doesn't output anything". did you listen for an output? did you look at the signal in the scope? did you actually measure the signal level?
jugwineUSA wrote: Tue Dec 24, 2024 9:10 pm 2. I'm building parallel EQ, meaning I want to clamp bands to frequency ranges. After processing the clamped range, I filter it again with adjustable amp, cutoff, and q. How do I get that fully modified value now?
Parallel EQ would imply that you sum the filter outputs so that they actually work in parallel, but you're processing all three filters in series. am i missing something?


can you provide some more context?

i've quickly whipped up an example with your approach and i get the expected result:
prototype_spectrum
prototype_spectrum
Screenshot 2024-12-25 043916.png (542.81 KiB) Viewed 6459 times

here's the relevant code for reference:

Code: Select all

      
    @Override
    public void ProcessSample()
    {
        // add your own code here

        m_hpf.SetCutoff( hpf.GetValue() );
        m_lpf.SetCutoff( lpf.GetValue() );
        m_bpf.SetCutoff( bpf.GetValue() );

        double val = in.GetValue();
        
        m_hpf.ProcessSample( val );
        val = m_hpf.GetHighpassValue();
        m_lpf.ProcessSample( val );
        val = m_lpf.GetLowpassValue();
        m_bpf.ProcessSample( val );
        val = m_bpf.GetBandpassValue();
        
        out.SetValue( val );
    }
    ...
    
        // Add your own variables and functions here
	private AnalogFilter    m_hpf = new AnalogFilter();
	private AnalogFilter    m_lpf = new AnalogFilter();
	private AnalogFilter    m_bpf = new AnalogFilter();
here's the vmod:
ForumIssue_AnalogFilter_20241225.zip
vmod
(19.13 KiB) Downloaded 198 times
please note, that this vmod file just serves as a quick example and follows very bad practices. do not use in actual production code.
ColinP
Posts: 1031
Joined: Mon Aug 03, 2020 7:46 pm

Re: AnalogFilter and GetBandpassValue()

Post by ColinP »

I agree with Chris that what you are doing is serial rather than parallel filtering.

I quickly knocked up the following to show the difference between the two approaches as it's easier to see what's going on than looking at code.


temp.png
temp.png (25.02 KiB) Viewed 6441 times
jugwineUSA
Posts: 2
Joined: Tue Dec 24, 2024 9:02 pm

Re: AnalogFilter and GetBandpassValue()

Post by jugwineUSA »

Thanks for the replies. How are you loading VSTs within VM Designer? Happy New Years!
UrbanCyborg
Posts: 640
Joined: Mon Nov 15, 2021 9:23 pm

Re: AnalogFilter and GetBandpassValue()

Post by UrbanCyborg »

In the debug module there's a pull-down menu item to add modules to your debug patch. If you want to load something other than a VM module you own, add an instance of Host or Mini Host and load it from there. That's how I load Scan in the debugger, for instance. Of course, you'll have to own either Host or Mini Host. Top of the head, I don't recall which of the VM packages includes them, but you can always buy them stand-alone.

Reid
Cyberwerks Heavy Industries -- viewforum.php?f=76
Post Reply

Return to “Module Designer”