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

Question on filter design #1

Closed
metaphorz opened this issue Nov 19, 2017 · 3 comments
Closed

Question on filter design #1

metaphorz opened this issue Nov 19, 2017 · 3 comments

Comments

@metaphorz
Copy link

I am planning on making a few modules, and really like these as examples of how modules can be created (to add to Tutorial in Rack). The "blank" module is nice! Some of these questions I am sure are basic, but hopefully apply to any module. I have questions (labeled as **) underneath each statement in Step() for the Shaper module (which seems an excellent starter because of the functions)

// normalize signal input to [-1.0...+1.0]
float x = clampf(inputs[RESHAPER_INPUT].value * 0.1f, -1.f, 1.f);

** As you point out, this normalizes the signal, but what is the incoming range for a Rack signal? Are modules always sending a signal from -10 to +10v or are input signals arbitrary in voltage?

float cv = inputs[RESHAPER_CV_INPUT].value * params[RESHAPER_CV_AMOUNT].value;

** The top knob is presumably ranging 0 to 1 in value as it is turned ?

float a = clampf(params[RESHAPER_AMOUNT].value + cv, 1.f, 50.f);

** What is the reason for ranging from 1 to 50?

// do the acid!
float out = x * (abs(x) + a) / (x * x + (a - 1) * abs(x) + 1);

** Is this a known filter design or something you've designed? I have not yet delved into the numerical methods for modular filters but I guess there are many books on the subject.

@lindenbergresearch
Copy link
Owner

Hi metaphorz,

to be honest, I tried a lot of code I found over the years for music dsp und took the well sounding... :) But I did not invented that formula at all - just adapted it a bit ;)
Some of the functions tend to be unstable outside of > -/+1.0 input, so I normalised it and ensured with clampf, that they do not exceed this. Later it's scaled back. I just measured some of the inputs to get the default values, so my scaling is kinda empiric. In generell values could be all range I think.
You can configure the ranges of the knob's, it is not always from 0..1.0.

@metaphorz
Copy link
Author

I can see the empirical approach as it makes the most sense from an artistic perspective. When attaching a scope, it seems that your waveform is nicely between -5/+5V if I am reading the
scope correctly.

@lindenbergresearch
Copy link
Owner

Yes you are right. Should be the same in real life :)

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