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

filters: cutoff is scaled by CUTOFFRATIO, but hcutoff and bandf aren't #81

Open
claudeha opened this issue Mar 3, 2025 · 1 comment

Comments

@claudeha
Copy link
Collaborator

claudeha commented Mar 3, 2025

cutoff (for low pass filter, aka vcf effect) is in units that are similar to Hz at typical sample rates, while hcutoff (for high pass filter, aka hpf effect) and bandf (for band pass/reject filter) are not scaled and are expected to be less than 1

server.c:  sound->cutoff = cutoff / CUTOFFRATIO;
server.c:  sound->hcutoff = hcutoff;
server.c:  sound->bandf = bandf;

Neither is truly sample rate independent, but I wasted 30mins today wondering why hcutoff 0.001 was doing what I wanted but cutoff 0.1 wasn't.

Should we make hcutoff and bandf also scale by CUTOFFRATIO?

Should we add an additional factor of 44100.0/g_samplerate to try to make them more independent of sample rate?

These changes would change how things sound, might need to be behind a compatibility flag?

@yaxu
Copy link
Member

yaxu commented Mar 3, 2025

Oh that's odd that they're scaled differently. SuperDirt expects them all in Hz, so perhaps we should standardise on that?

Agreed making them independent of samplerate would be best.

I don't think a compatibility flag is needed.

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