LMMS / LMMS/lmms

Implementing oversampling in plug-ins.

Open
#3,605 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C++
Stars
10.4k
Forks
1.3k
Avg merge
2d 13h
Merged PRs (30d)
7

Description

• Synthesizers:
When playing high notes on a synthesizer using a harmonically rich wave like a saw wave, there are probably some frequencies that will go above the nyquist frequency, so aliasing occurs.

Just play the note C8 on TripleOscillator using a saw wave to hear the aliasing noise.

My idea of the UI implementation is radio buttons in the plugin tab of each synthesizer offering oversampling factors in powers of 2.

• Effect plug-ins:
There are 2 types of plug-ins that would benefit from using oversampling (as far as I know).

(1) Waveshapers, distorters, overdrivers, bitcrushers and Lo-fi effects (or anything that generates a lot of overtones).
When using any of the effects above on a sound, extra overtones are being added to it, and if these overtones go above the nyquist frequency, aliasing occurs.

Spectrum of a heavily waveshaped sine wave.
![distorted sine wave](https://cloud.githubusercontent.com/assets/25503477/26704782/30472e22-473a-11e7-9854-3ef5930b41cd.png)
Spectrum of the same sound but with 16x oversampling.
![distorted sine wave with 16x oversampling](https://cloud.githubusercontent.com/assets/25503477/26704785/34b8acd8-473a-11e7-839e-220765215709.png)

My idea of the UI implementation is a slider in each of these plug-ins mentioned earlier offering oversampling factors in powers of 2.

(2) Equalizers.
When a band (of any type) in the equalizer gets close to the nyquist frequency, its shape distorts.

A normal low-pass filter at 1000 Hz looks like this:
![lpf 1000 hz](https://cloud.githubusercontent.com/assets/25503477/26700675/ea4781d2-4726-11e7-9181-0b1ea01809da.png)
The same filter but at 16000 Hz looks like this:
![lpf 16000 hz](https://cloud.githubusercontent.com/assets/25503477/26700730/23bff5f2-4727-11e7-97f0-4439165ad109.png)

Using oversampling will prevent this distortion and improve audio quality, particularly at high frequencies.
My idea of the UI implementation is an off/on "Oversampling" button on each equalizer plug-in effect that uses a specific oversampling factor that is just enough to prevent the distortion without introducing excess CPU load.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported aliasing with a saw wave on TripleOscillator at C8, then compare the synthesizer and effect cases described in the issue. The work is done when an agreed oversampling design covers the applicable synthesizers, waveshaping effects, and equalizers without introducing unnecessary CPU load, with the proposed controls and factors clearly defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
audio-video-rtc, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.