WITHDRAWN: elimination of per-note based clipping and the distortion originated (@ 3de1f99) #8
FulopNandor
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
elimination of per-note based clipping and the distortion originated (@ 3de1f99)
Issue
The current version of Dexed (@ e4b536d) produces distorted sounding in case of certain programs (patches) when notes are played with some higher key velocities, as the following .wav sample demonstrates it:
I-n1vinc-E0-mono-wav.zip
(Comment: this kind of distortion occurs in all three engines).
As can be heard, a soft C5 note is played repeatedly with increasing volume. However, suddenly, not only does the volume increase, but the brightness/sharpness also changes abruptly - despite the fact that an almost pure sine wave was played each time.
Its waveform is shown the figure below:
This .wav sample files was created by playing the
n1vinc-mid.zip
MIDI file with the use of
Dexed.vst3
plugin (in MS Windows 10 OS). In this MIDI file, theMidi Note 60
is played 12 times following each other, but with the increasing key velocities of 20, ... 110, 120, and 127.Into the Dexed plugin, the
maxvol-syx.zip
cartridge was loaded and its Program No 1 (labelled as
A32MAXVOL
) was selected. The other important settings of the plugin were:Master Output Level
= set to maximumCutoff
= set to maximum,Reso
= set to minimum,The program
A32MAXVOL
, being inmaxvol.syx
cartridge file, made from theINIT VOICE
with the following modifications to provide an almost pure sine output wave with maximum output amplitudes:Algorithm
= set to 32--
Switch
= set to ON--
Output Level
= set to maximum,--
Key Vel
= set to maximum.The reason of the problem
In
PluginProcessor.cpp
file, among many others, there is an inner loop between line 251 and line 271 to calculate the superposition of the samples of individual notes:The problems are the followings:
There is clipping of the int32_t samples produced by the engines in the line 263:
(1) In case of certain programs (patches), the samples produced by the engines exceed the limits
-(1 << 24)
and(1 << 24)
present here, resulting in the distortion (truncation) of the waveform.(2) Here, the value of constant
0x8000
, which is a positive value in the given context, is assigned to the variableclip_val
, when the output value of the engine (stored in the variableval
) decreases below the value of-(1 << 24)
. This results in a large jump in the amplitudes from the negative region to positive one.(3) The superposition of the individual float samples is perfomed after the clipping, in line 267. Instead, the superposition of the unclipped individual samples should be done , and their sum should be clipped later, to ensure that the resultant sound fits to the allowed output range.
The solution provided by this commit
The per-note based clipping (i.e. lines 262...267) is removed here and transferred to end of the
PluginProcessor.cpp
, after the updating of VU meter, as clipping of the resultant superposition of the active voices.As a result, the sound of the individual notes will not be distorted by the per-note based clipping when they are played with maximum key velocities, as it can be heard:
U-n1vinc-E0-mono-wav.zip
and is shown:
Beta Was this translation helpful? Give feedback.
All reactions