gibber-cc / gibber

An audiovisual live coding environment for the browser
MIT License
902 stars 79 forks source link

Enable setting filter frequency in hertz and notes #88

Open ianhattwick opened 1 year ago

ianhattwick commented 1 year ago

Normalizing the filter frequency to (0, 1) doesn't make sense for choosing appropriate filter settings. . .

charlieroberts commented 1 year ago

The final cutoff frequency used in synths for a given sample is determined by the cutoff value, the note being played, the envelope of the synth, and the filterMult property. So selecting an actual frequency is somewhat meaningless given the combination of all these parameters. I guess I could make the actual equation used more explicit in the docs? Alternatively you could have synths where the cutoff frequency is not changed by all these other parameters, but that becomes a question of instrument design rather than how the filter frequency is specified.

charlieroberts commented 1 year ago

Here's the relevant code for the Synth instrument. I forgot that the global loudness property of the synth also plays a role in the filter cutoff, as well as the loudness of individual notes that are triggered (this is triggerLoudness in the code). So many elements control the final cutoff frequency!

charlieroberts commented 1 year ago

oh wait, are you talking about in standalone filters? hmmm. that could make more sense. I guess the problem then becomes you get different syntax for the standalone filters vs the instrument filters.

ianhattwick commented 1 year ago

Yes - I was thinking of standalone filters. For synths I agree that something normalized makes sense as it will probably track VCO frequency.