ryukau/UhhyouWebSynthesizers

SingenBD2 - Feedback bug

Closed this issue · 4 comments

Hi,

I've noticed this "bug" using an oscillator with 0 pitchdiff and higher feedback (i.e. steady signal):

https://github.com/ryukau/UhhyouWebSynthesizers/blob/main/oldsynth/SingenBD2/index.js#L115

Since this.pitchDiff = 0, 0^x will always be the same, so feedback (i.e. mod var) will do nothing, but it should, since feedback is not related with pitch envelope (i just got a steady signal, without feedback influence). Right?

Curious about your pitch env modelling: which kind of envelope is pitch = diff ^ env?

Thanks for any tips

ryukau commented

Okay, I basically forgot how I made SingenBD2. Also note that the code was written when I had no clue about DSP.

It seems like the unit of this.pitchDiff is frequency in Hz. So the pow in question is moving that frequency in log scale, like octaves and semitones. I'm pretty sure the value of pitchEnv moves from 1 to 0. So to formulate:

$$ f = f_l + f_d^{E \times M}. $$

where:

  • $t$ is time in seconds.
  • $f$ is frequency in Hz.
  • $f_l$ is this._pitchEnd in code. Defined as PitchEnd - 1.
  • $f_d$ is this.pitchDiff in code. Defined as PitchStart - PitchEnd.
  • $E$ is pitchEnv that is an decaying envelope.
  • $M$ is modulator signal, which is Head oscillator in SingenBD2.

For your expected result, the formula should be changed like following:

$$ \hat{f} = (f_l + f_d^{E})^{M}. $$

You can get the modulation in octave by solving $f_d^{E} = f_d 2^x$ for $x$. Same goes for $M$.

My conclusion is that the modulation is just a variation of "musical" tuning. I quoted the word musical, because it's clearly a mistake, but nobody was hurt. Also, I'd like to leave it as is, because those subtle difference might provide musical value, or a character.

I personally stopped using pow in more recent code, as exp2 is faster and it's sufficient most of times.

ryukau commented

Ah, the definition of $t$ was unnecessary. I deleted the notation for function of time, as it looked cluttered.

Yeah of course. Its clear the params.

What I'm trying to say is that given a 0 pitchdiff, the feedback has no effect on signal in fm mode (which should, since its a fm feedback).

ryukau commented

I added a few other FM options. The name of original tuning is changed to "Muffled FM". Also, let me know if you have a concrete code for modulation tuning. I'll add it. Or you can open PR for that.

I also recommend to try the subsequent synths like Singen0.2 ("Bassdrum" randomization) and SingenBD3 ("Dry BD" randomization).

Updated UI looks ugly, but I wouldn't like to spend too much time dealing with the code in oldsynth. If you really care, patches are welcome. The best way is to port the synth to new style of code, but it's not my priority.