LFO creates high frequency noise.

Found a bug? Post it here.
Post Reply
ragingcoast
Posts: 25
Joined: Fri Feb 07, 2020 1:37 am

LFO creates high frequency noise.

Post by ragingcoast » Thu Nov 05, 2020 2:58 am

Noticed this at first when running a signal through an LFO, it was producing some weird sound artifacts.

To reproduce, create an LFO, connect it to Output and turn Generator = on. You should hear nothing since its a <30hz sine wave but there is clearly audible noise.

It seems the generated sine wave is not as smooth as it should be, some form of bitchrushing or bitdepth issue going on perhaps. It seems to affect all the LFO waveforms. It affects generator but also the regular amplitude/panning non-generator mode, to test this repeat above setup but set Generator off and connect as input an Amplifier with DC Offset = 128.

User avatar
queries
Posts: 284
Joined: Tue May 10, 2016 9:51 pm

Re: LFO creates high frequency noise.

Post by queries » Thu Nov 05, 2020 3:58 am

LFO works by looking up values from a table, which makes them very CPU efficient. (This can be seen in earlier source code of SunVox - https://github.com/warmplace/sunvox_sou ... hs_lfo.cpp)

This has the side effect of aliasing, as you noticed. At slow speeds, it's less of a pure sine wave and more of a series of linear transitions between the data points in the sine wave lookup table. Another side effect of this is that a sawtooth waveform is not pure -- it does not have a clean transition between 1 and -1, but instead has a ramp as the in-between values are interpolated. This is especially evident at lower speeds, but also presents limitations for using audio-rate LFOs as tone generators.

In fact, if you connect a slow sine wave generating LFO, to an Amplifier with "gain" set to maximum (don't connect the amp to anything else!!!) and look at the spectrum analyzer for the amplifier, you will see the distortion.

There is a discussion about this here, where Keres also brought up some philosophical points when considering whether or not LFOs should have a "scientific" mode that has more accurate waveforms at both slow speeds and audio-rate speeds. https://www.warmplace.ru/forum/viewtopi ... =17&t=5324
Attachments
Screen Shot 2020-11-04 at 16.55.35.jpeg
Screen Shot 2020-11-04 at 16.55.35.jpeg (24.27 KiB) Viewed 440 times

ragingcoast
Posts: 25
Joined: Fri Feb 07, 2020 1:37 am

Re: LFO creates high frequency noise.

Post by ragingcoast » Thu Nov 05, 2020 4:40 am

That makes sense as to what i'm seeing as well. The CPU point is reasonable. (Although, I use an LFO Generator in a swinger module I have and ended up having to put an LP filter after the LFO to cut out this distortion so there goes the CPU..)

However it would be nice to have a HQ mode without this distortion. In the end the most important thing to me is the audio that hits the speaker.

User avatar
NightRadio
Site Admin
Posts: 3469
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: LFO creates high frequency noise.

Post by NightRadio » Thu Nov 05, 2020 11:56 am

The current version of LFO can work in two modes:
1) HQ mode in versions for Windows/Linux/macOS: pure sine is used;
2) LQ mode in the other versions: lookup table is used instead of the sine;

Mode (1) has the highest quality. It's still not ideal on the low freqs (<1Hz), but it sounds close to ideal :)

Mode (2) is really rough, but it's fast.
Unfortunately you can't switch between these modes manually.
I should probably add some switch controller...

As for the audible noise on 30Hz. Hm... I don't hear any noise in desktop version.
Comparing to 30Hz tone generated in Audacity...

User avatar
queries
Posts: 284
Joined: Tue May 10, 2016 9:51 pm

Re: LFO creates high frequency noise.

Post by queries » Thu Nov 05, 2020 3:36 pm

Sorry for the misinformation! And thanks for the clarification... and the beta! :)

Post Reply