Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use q with a float array ? #40

Closed
SeleDreams opened this issue Dec 27, 2021 · 1 comment
Closed

Use q with a float array ? #40

SeleDreams opened this issue Dec 27, 2021 · 1 comment

Comments

@SeleDreams
Copy link

SeleDreams commented Dec 27, 2021

Hi, I am working on making a vst that performs some equalization tasks by reducing two frequency peaks and increasing two others.
I work in a run function that receives a const float **inputs and a const float **outputs and the uint32_t frame count, i'm not sure how i'm supposed to go about modifying this signal with q

I tried

cycfi::q::audio_channels<const float> inputChannels(inputs,sizeof(const float) * frames,frames);
cycfi::q::audio_channels<float> outputChannels(outputs,sizeof(float) * frames,frames);
cycfi::q::audio_stream stream;
stream.process(inputChannels,outputChannels);

which seems to compile but I am not sure yet if it is the right way to use these methods, I also am not sure about the way to go to do some EQ on the signal

@djowel
Copy link
Member

djowel commented Dec 28, 2021

It seems that you already got the answer to this question in Discord?

Generically, say you have a filter f instantiated in your class, you can mix it with the original signal s by adding to boost or subtracting to cut. The factor you apply g is your gain or cut:

   out = s + f(s) * g;

To make it clear, assume (for now) f to be to identity, meaning it simply returns the signal s passed to it. Then you can see that:

   out = s + s * g;

if for example, g is 1, then you get out = s + s * 1, hence s is doubled.
If for example g is -1, then you get out = s + s * -1, or 0 (full attenuation, s will cancel out).

Now, imagine that a bandpass filter is used, Then the same operation above applies, but only applied to the frequencies that the bandpass returns. Ditto for lowpass and highpass.

Makes sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants