Oversampling and anti-aliasing filter for overdrives effects

need a feature, suggest here

Oversampling and anti-aliasing filter for overdrives effects

Postby Yruama_Lairba » Wed Nov 18, 2015 9:09 pm

I open this subject here because, even if I think it's a problem, it's more an important missing feature than a bug. Adding to this, the spotted problem is not intuitive and difficult to understand without knowledge in the theory and the processing of signal. If guitarix developpers ask me, i will try to give enougth details to explain what happen.

To be short, i discovered an aliasing probleme with guitarix witch is probably present in all effect that introduce non-linearities like overdrive, distortion, tube preamp ... a very noticeable example is with the 12ax7 alone with pregain and drive at maximum. If you put sinusoid signal (I use Invada Test tones) inside guitarix, and if you use different frequency, you can hear dissonnant tones (try every test tones from 1khz :p). You can put a spectrum analyzer on guitarix output (calf analyzer but i prefer the ugly jaaa because you can have very high precision when using a very low "bandwith" value and it's easier to see harmonics with a linear scale of frequency).

The reason of this problems is because non-linearities produces harmonics, even above the half of sampling frequency. if care is not taken, all harmonics the half of sampling frequency are aliased and dirty your signal. Even if it's impossible to totally supress the aliasing, you can reduce this by oversampling before non-linear effect, put appropriate lowpass filter after and finally "undersampling" to go back to the original frequency.

yes, i tried to be short :p
User avatar
Yruama_Lairba
 
Posts: 21
Joined: Sun Nov 08, 2015 6:53 pm

Re: Oversampling and anti-aliasing filter for overdrives eff

Postby brummer10 » Thu Nov 19, 2015 7:37 pm

Yruama_Lairba wrote:To be short, i discovered an aliasing probleme with guitarix witch is probably present in all effect that introduce non-linearities like overdrive, distortion, tube preamp ... a very noticeable example is with the 12ax7 alone with pregain and drive at maximum. If you put sinusoid signal (I use Invada Test tones) inside guitarix, and if you use different frequency, you can hear dissonnant tones (try every test tones from 1khz :p). You can put a spectrum analyzer on guitarix output (calf analyzer but i prefer the ugly jaaa because you can have very high precision when using a very low "bandwith" value and it's easier to see harmonics with a linear scale of frequency).


Well, I'm not really able to reproduce this problem. True, the distortion introduce harmonics into the signal, and so does the tube when it is driven hard by pregain, but I'm not able to hear aliasing artifacts when I play guitarix with my guitar.

Yruama_Lairba wrote:The reason of this problems is because non-linearities produces harmonics, even above the half of sampling frequency. if care is not taken, all harmonics the half of sampling frequency are aliased and dirty your signal. Even if it's impossible to totally supress the aliasing, you can reduce this by oversampling before non-linear effect, put appropriate lowpass filter after and finally "undersampling" to go back to the original frequency.


Well, I'm aware of this, and to be honest, I use this technique in some of the LV2 plugs, like the Gxwavesharper or the Gxjcm800pre. In guitarix we didn't use oversampling, but use lowpass filters in the non-linear loop to reduce aliasing.
And as you could see on the provided examples by users, guitarix is able to produce nice metal distortion sounds.
https://www.youtube.com/watch?v=imdNuijSe9A
Using oversampling will be a easy task, but, it will use a lot more processing power.
I could, if you like, add a new branch "oversampling" to guitarix-git with oversampled non-linear effects and amp simulations.
In fact, I've written the source already some time ago, but decide against it, because of the somewhat higher DSP load.

regards
hermann
User avatar
brummer10
Site Admin
 
Posts: 689
Joined: Thu Mar 26, 2009 6:57 pm

Re: Oversampling and anti-aliasing filter for overdrives eff

Postby ssj71 » Fri Nov 20, 2015 7:22 pm

Just a thought:

Yruama_Lairba wrote: a very noticeable example is with the 12ax7 alone with pregain and drive at maximum


This test may be a bit unreasonable. If you are using a full signal amplitude sinusoid with pregain at maximum it would be extremely loud. And thinking of the typical tube saturation curve, if driven extremely hard it makes sense that aliasing would become a problem. I might be mistaken, but this signal level seems like it doesn't represent a real world scenario. I usually have the pregain around 50% at the highest with my guitar. Have you measured any aliasing when using your guitar? (I'm all for testing, don't get me wrong, but we need to make sure tests represent reality).
User avatar
ssj71
 
Posts: 4
Joined: Thu Apr 16, 2015 3:31 pm

Re: Oversampling and anti-aliasing filter for overdrives eff

Postby Yruama_Lairba » Sat Nov 21, 2015 9:26 pm

Ooops i'm soory, i'm feel idiot, it seems that big part of what thought to be an "earable aliasing artifact", is in fact a fucking electromagnetic interference around 5khz. I didn't notice it earlier because it's not always there.

brummer10 wrote:True, the distortion introduce harmonics into the signal, and so does the tube when it is driven hard by pregain, but I'm not able to hear aliasing artifacts when I play guitarix with my guitar.


After having discovered my mistake, I tried to find an amp simulation with oversampling option to compare a guitar with and without oversampling. I found 8505 from nick crow (vst) wich have an HQ button. Indeed, with this simulation, even if am able to ear difference with high gain, it's enought sutble to not be remarquable.

to ssj71
ssj71 wrote:a very noticeable example is with the 12ax7 alone with pregain and drive at maximum


this was a deafproof example ;) . I also tried with more "reasonnable" value, i mean lower pregain an drive, and lower volume for testtones (around -12dbfs) and aliasing remain earable.

ssj71 wrote:Have you measured any aliasing when using your guitar


no, because with guitar it is not so easy to have a good capture. that why i used testtones

to hermann
brummer10 wrote: guitarix is able to produce nice metal distortion sounds

not only metal, guitarix can be awesome for other music style involving guitar or bass ;)

brummer10 wrote:Using oversampling will be a easy task, but, it will use a lot more processing power

How many ? I guess it should proportional to the oversampling factor, but i found some plugin (nick crow again) that do oversampling and the cpu consumption doesn't seems to increase proprotionnaly. it increase fast on low oversampling value and slow on high oversampling value.

brummer wrote:I could, if you like, add a new branch "oversampling" to guitarix-git with oversampled non-linear effects and amp simulations.


Only if it not involve not much effort. I'd like to test oversampling on guitarix but i'm not sure to hear difference and i don't want to bother you.
User avatar
Yruama_Lairba
 
Posts: 21
Joined: Sun Nov 08, 2015 6:53 pm

Re: Oversampling and anti-aliasing filter for overdrives eff

Postby brummer10 » Sun Nov 22, 2015 6:34 am

Yruama_Lairba wrote:Only if it not involve not much effort. I'd like to test oversampling on guitarix but i'm not sure to hear difference and i don't want to bother you.


You are welcome.
As I said, I've written the source anyway, so it's just a push to a new branch for me. And it's done.
Just run git pull
git checkout oversampling
and pull again.
In the oversampling branch the amp simulation runs on 192000 Hz internal (which means on 48000 Hz a oversampling rate of 4x), the lowpass is a 3. order butterworth at 16000 Hz. I guess that should be enough headroom to avoid any aliasing.

Please test, and let me know what your impression is.

regards
hermann
User avatar
brummer10
Site Admin
 
Posts: 689
Joined: Thu Mar 26, 2009 6:57 pm

Re: Oversampling and anti-aliasing filter for overdrives eff

Postby Yruama_Lairba » Fri Nov 27, 2015 5:43 pm

I tried the oversampling branch, but i was unable to compile anything, even after cleaning everthin using ./waf clean and git clean -f. I fact, when I launch "./waf build" it complete without any errors, but it does'nt seem to do anything ?

I also confirm that there something wrong with my config, I found presets giving me horrible sensation :x (https://musical-artifacts.com/artifacts/83), It feel like "bitdowner effect". Maybe, part of the "high frequencies" i hear sometimes is the same problem ? I don't know if it's guitarix or my soundcard driver, i don't have enought points of comparison.
User avatar
Yruama_Lairba
 
Posts: 21
Joined: Sun Nov 08, 2015 6:53 pm

Re: Oversampling and anti-aliasing filter for overdrives eff

Postby brummer10 » Sat Nov 28, 2015 5:10 am

Yruama_Lairba wrote:I tried the oversampling branch, but i was unable to compile anything, even after cleaning everthin using ./waf clean and git clean -f. I fact, when I launch "./waf build" it complete without any errors, but it does'nt seem to do anything ?


mm,
you should doe the following:

Code: Select all
git pull
git checkout oversampling
git pull


now to confirm that you are on the oversampling branch, do
Code: Select all
git branch

the output have to look like this
Code: Select all
  master
* oversampling
  redesign

now clean up th build tree with:
Code: Select all
./waf distclean

and then configure the source tree:
Code: Select all
./waf configure  --includeresampler --convolver-ffmpeg --optimization

after all that, you should be able to run:
Code: Select all
./waf build

and install.
To switch back to the master branch, follow the steps above, just checkout master instead oversampling.
Yruama_Lairba wrote:I also confirm that there something wrong with my config, I found presets giving me horrible sensation :x (https://musical-artifacts.com/artifacts/83), It feel like "bitdowner effect". Maybe, part of the "high frequencies" i hear sometimes is the same problem ? I don't know if it's guitarix or my soundcard driver, i don't have enought points of comparison.

Maybe, ensure that your mic isn't connected to the speakers, means, there should be no monitoring without you connect the mic to the speakers, or any other app, like guitarix, within jack. Turn down to zero, the PCM value of your input in Alsamixer, Select your soundcard(F6) and press F4 to get access to the input controllers.
Instead the PCM you should use the Mic, which will capture without monitoring the signal direct.

regards
hermann
User avatar
brummer10
Site Admin
 
Posts: 689
Joined: Thu Mar 26, 2009 6:57 pm

Re: Oversampling and anti-aliasing filter for overdrives eff

Postby Yruama_Lairba » Sat Nov 28, 2015 3:52 pm

Maybe, ensure that your mic isn't connected to the speakers, means, there should be no monitoring without you connect the mic to the speakers, or any other app, like guitarix, within jack. Turn down to zero, the PCM value of your input in Alsamixer, Select your soundcard(F6) and press F4 to get access to the input controllers.
Instead the PCM you should use the Mic, which will capture without monitoring the signal direct.


no monitoring, no other app, just guitarix. I'm using the pod studio UX2, and even if its drivers was integrated in linux kernel V4, the driver is not fully functionnal and sometime buggy. For example, the driver only allow 16bits/44.1khz sampling mode. that's why i think it can be a driver issue.
User avatar
Yruama_Lairba
 
Posts: 21
Joined: Sun Nov 08, 2015 6:53 pm

Re: Oversampling and anti-aliasing filter for overdrives eff

Postby Yruama_Lairba » Sat Nov 28, 2015 6:58 pm

oooops, build failed :
Code: Select all
In file included from default/src/LV2/faust/fuzzface.cc:4:0,
                 from ../src/LV2/gx_fuzzface.lv2/gx_fuzzface.cpp:26:
../src/LV2/DSP/trany.h:64:22: fatal error: SVEL34t.cc: Aucun fichier ou dossier de ce type
 #include "SVEL34t.cc"
                      ^

maybe it's because i don't have the right version of faust ? i'm using the --no-faust flag during configure.
note : the error means "no file or folder of this type"
User avatar
Yruama_Lairba
 
Posts: 21
Joined: Sun Nov 08, 2015 6:53 pm

Re: Oversampling and anti-aliasing filter for overdrives eff

Postby brummer10 » Sat Nov 28, 2015 7:21 pm

Yruama_Lairba wrote:maybe it's because i don't have the right version of faust ? i'm using the --no-faust flag during configure.
note : the error means "no file or folder of this type"


Ups, it's my fool, I've forgotten to add this file, witch is only used in the oversampling branch.
I've committed it now, please do a git pull and try again.
You only need faust when you like to develop your own guitarix plugins, otherwise, we provide all files pre-generated. (if we forget a file, it's a bug, indeed)

Yruama_Lairba wrote:I'm using the pod studio UX2, and even if its drivers was integrated in linux kernel V4, the driver is not fully functionnal and sometime buggy.

From what I know, there are a couple of bugfixes regarding the UX2 driver in kernels later then 4,0.X
which kernel version are you using?
User avatar
brummer10
Site Admin
 
Posts: 689
Joined: Thu Mar 26, 2009 6:57 pm

Next

Return to Suggestion Box

Who is online

Users browsing this forum: No registered users and 1 guest

cron