thomassidor / tinytricks

Tiny Tricks - Modules for VCV Rack
Other
26 stars 7 forks source link

weird lfo wave? #19

Closed Nowhk closed 4 years ago

Nowhk commented 4 years ago

I'm trying your fancy MG16, and sometimes I see that generated waveform are a bit "glitchy".

here's a screenshot of a "saw" waveform:

image That "jump" in the middle of the period is not intended I think (at least, seeing your code). Is it?

I'd like to understand this. Many others waveform have those "glitch" sometimes. Here's a triangle one:

image

thomassidor commented 4 years ago

Hi @Nowhk

I think what you are seeing is actually the intended behavior.

The modulation generator generates a "random" waveform each time. It's an weighted average between a square, sine, saw and triangle. The glitch you're seeing is probably because there's a bit of a square waveform in there.

Does that make sense?

Best regards, Thomas

Nowhk commented 4 years ago

Not sure I got it :) The regenerate function https://github.com/thomassidor/tinytricks/blob/master/src/modulation-generator.cpp#L26 is called once, when I click Trigger. If I click once, I would expect it select a single lfoWave. Than, on each step, is always use the same (only) waveform, no?

I mean, it will only use sin or tri or saw or sqr for each trigger https://github.com/thomassidor/tinytricks/blob/master/src/modulation-generator.cpp#L80, not mixing them :O

thomassidor commented 4 years ago

Hi again :)

Yes, lfoWave is set once - it's a random float value between 0 and 3.

But in line 79 to 84 that float value is used to create a weighted sum of the pure waves - so if lfoWave is 0.5 you'll get both a bit of a sine wave and a triangle wave.

Nowhk commented 4 years ago

Oh now I see the trick :) Thanks