LMMS / LMMS/lmms

Aliasing in native LMMS instruments

Open
#6,098 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
10.4k
Forks
1.3k
Avg merge
2d 13h
Merged PRs (30d)
7

Description

Alias-free wavetable oscillators #5826 were recently added to LMMS, resolving many aliasing issues in TripleOscillator. This first step was relatively time-sensitive, since the original PR was abandoned and in danger to be drowned in merge conflicts that would make it harder to resurrect later. Now that the code safely made it to the main LMMS repository, it can be gradually put into use in other affected instruments as well.

After doing some quick testing and based on the discussion below, I sorted the native instruments into several categories:

__A)__ Instruments that have aliasing artifacts, use (or could use) LMMS Oscillator class and could benefit from the new wavetable mode:
- TripleOscillator (aliasing still present in PM and PF modulation, correct wavetable must be selected based on frequecy that results from this modulation)
- BitInvader (more work: includes `Oscillator.h` but does not actually use it anywhere)
- Kicker (low priority, usually does not play notes high enough to cause trouble)
- Organic (looks like a standard `Oscillator` user, basically an "OctupleOscillator")
- sfxr (very alien and self-contained code, but possibly could be refactored to take samples from `Oscillator`)
- Watsyn (less alien, but also quite custom and perhaps more complex; hard to say of it should be A or B)

__B)__ Instruments that have aliasing artifacts, but do not (or can not) use LMMS Oscillator class, or they already have a partially working solution:
- AFP (Sinc interpolation is available for resampling; it takes care of aliasing, but it is CPU intensive and not the default. Using the `Oscillator` class may not be suitable, because the loaded sample may be quite long and take up a lot of memory if duplicated into ~128 band-limited versions)
- LB302 (low-priority, like Kicker? Already uses band-limited waves, but apparently not everywhere it needs to.)
- Monstro (PhysSong: "uses oversampling, but it doesn't use a good filtering algorithm before downsampling")
- Mallets (uses STK library https://ccrma.stanford.edu/software/stk/)
- OpulenZ (uses AdPlug library http://adplug.github.io/ and emulates a HW synth, so aliasing may be intended)
- Xpressive (generates waves based on formulas using http://www.partow.net/programming/exprtk/, probably not a good match; includes `Oscillator.h` but does not actually use it anywhere)

__C)__ Instruments that seem to be OK or unclear:
- Nescaline (seems OK, but has very noisy output, hard to see for sure; emulates HW, so aliasing may be intended; seems to be using `Oscillator`, but only for noise samples?)
- SID (behaves very strangely for the last few notes, so it's hard to say if it's also aliasing; also emulates HW and and does not use Oscillator class)
- Vibed (seems pretty much perfectly clean)
- not tested: VeSTige (depends on plugins), GIG / PAT / SF2 (probably depends on quality and number of samples in the library).

With Monstro, sfxr or Nescaline and possibly others, I'm not sure if aliasing could be even expected and intended. With Monstro it possibly contributes to "nastier" sound, and with 8-bit like instruments, well, output of the original machines probably wasn't very clean and precise in the first place, and I wouldn't be surprised if aliasing _should_ be present in a correctly emulated NES output. On the other hand, SID, for example, emulates a dedicated sound generator chip, which could have been designed to avoid aliasing. So some of these instruments may require further research.

I'm currently not actively working on this, so if anyone wants to use the new code to fix some of the affected instruments in category A, or research instruments in categories B and C, go ahead. After the refactoring dust settles, I will probably try to resolve the remaining issues in TripleOsc, since I'm already familiar with the code.

Contributor guide

No contributing guide indexed for this repository

Research direction

Begin with the alias-free wavetable oscillator work from #5826 and the named category-A instruments, especially TripleOscillator and BitInvader, checking their use of Oscillator.h. Done means selecting a scoped instrument change or research result and confirming whether aliasing is reduced without changing intended emulation behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
audio-video-rtc, desktop
Issue type
Bug
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.