Open he29-net opened 3 years ago
I'd put OpulenZ in the same category as NES, an emulation of some hardware that might very well alias. Here's some audio for anyone interested to assess the situation, first a digital recording straight off the chip: https://sid.fi/~grue/688_attack_sub_opl3_left_opl2_right_digital_rip.flac and second an analogue one: https://sid.fi/~grue/Torben_Hansen_Space13_L_opl2_R_opl3.flac
A note: most emulators do de-alias NES sound nowadays, probably because blargg pushed it (Wayback Machine link), but I'm fairly sure Nescaline doesn't. I'm fairly sure SID is also aliasing.
On the other hand, I can imagine Vibed being fine because it uses a very different type of synthesis. ... On the other hand, it probably needs a separate algorithm revamp to actually follow the algorithm it was designed around.
Monstro uses oversampling, but it doesn't use a good filtering algorithm before downsampling.
So, I fooled around with the available emulators in Adplug (which OpulenZ includes as a submodule). Four seemed reasonably working and I rendered a test piece using each one in turn. Can't say my ears can tell a difference except for one that was clearly louder. Looking at Audacitys spectrum view I selected the cleanest and dirtiest looking ones and fed them to the spectrum analyzer in LMMS.
Switching to the new and shiny aliasfree oscillators sounds like a nice idea, but if the old emulation is to be dragged along for backwards compatibility... maybe better to create an entirely new successor and let the old code rot in OpulenZ. The code as it looks now is pretty much from another planet compared to LMMS Oscillator classes.
Thanks everyone for the input. I went through some of the source files and updated the overview, dividing the plugins into 3 categories based from what I could gather so far:
Oscillator
class,
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:
Oscillator.h
but does not actually use it anywhere)Oscillator
user, basically an "OctupleOscillator")Oscillator
)B) Instruments that have aliasing artifacts, but do not (or can not) use LMMS Oscillator class, or they already have a partially working solution:
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)Oscillator.h
but does not actually use it anywhere)C) Instruments that seem to be OK or unclear:
Oscillator
, but only for noise samples?)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.