Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Alias Suppressed Wave Shaping

DSP related issues, mathematics, processing and techniques

Alias Suppressed Wave Shaping

Postby martinvicanek » Mon Oct 14, 2024 7:23 pm

Recently I wrote a note about anti-aliased waveshaping To my surprise, one person actually read it! :o So I thought I might just as well post a demo here, would maybe reach a broader audience. :mrgreen: Basically there are two mechanisms at work, one is oversampling and the other is called ADAA (don't bother about the acronym). The nice thing is that they really do a good job when applied together. Check out the demo, and have fun!
AAshaper.fsm
(177.1 KiB) Downloaded 792 times

Oh, and should you really want to uncover the mystery of the phenomenon, here is my little note: https://vicanek.de/articles/AADistortion.pdf
Last edited by martinvicanek on Tue Oct 15, 2024 9:09 pm, edited 1 time in total.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Alias Suppressed Wave Shaping

Postby adamszabo » Tue Oct 15, 2024 8:28 am

Nice stuff, thanks! Just an observation, in the "AA Sigmoid" module the "w" constant is not declared in:

movaps xmm4,w; // w2
movaps w,xmm0;

But it should work just fine without it!
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Alias Suppressed Wave Shaping

Postby martinvicanek » Tue Oct 15, 2024 9:10 pm

Thanks, Adam, for the bug report! Fixed and uploaded to the first post.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Alias Suppressed Wave Shaping

Postby adamszabo » Wed Oct 16, 2024 11:33 am

An optimization one can do is to use reciprocals instead of the division at the end of the code like so:

Code: Select all
addps xmm0,xmm1;   // w1 + w
addps xmm1,xmm4;   // w1 + w2
rcpps xmm0,xmm0;   // 1/(w1 + w)
rcpps xmm1,xmm1;   // 1/(w1 + w2)
mulps xmm3,xmm0;   // (3*x1 + x) * (1/(w1 + w))
mulps xmm2,xmm1;   // (3*x1 + x2) * (1/(w1 + w2))
addps xmm3,xmm2;
mulps xmm3,FP25;   // y
movaps y,xmm3;


I compared them and I didnt see any difference in the spectrum!
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Alias Suppressed Wave Shaping

Postby martinvicanek » Wed Oct 16, 2024 6:28 pm

Thanks again, Adam. Indeed, rcpps and the additional multipy are cheaper than divps, but you are aware that it comes at the cost of precision loss. rcpps has a relative error of up to 1.5*2^-12, which means you have a bit more than 3 significant digits (out of nearly 7 in single precision). In other words, your headroom above noise floor shrinks to less than 70 dB (compared to some theoretically possible135 dB in single precision). I would say that is still good enugh for rock and roll, but you have to know what you are doing (I now you do!).
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Alias Suppressed Wave Shaping

Postby adamszabo » Wed Oct 16, 2024 7:14 pm

martinvicanek wrote:Thanks again, Adam. Indeed, rcpps and the additional multipy are cheaper than divps, but you are aware that it comes at the cost of precision loss. rcpps has a relative error of up to 1.5*2^-12, which means you have a bit more than 3 significant digits (out of nearly 7 in single precision). In other words, your headroom above noise floor shrinks to less than 70 dB (compared to some theoretically possible135 dB in single precision). I would say that is still good enugh for rock and roll, but you have to know what you are doing (I now you do!).


Yes, you are absolutely right about the precision loss! As I didnt hear any real world difference between the two versions, I thought it would be possible to get away with this optimization ;) but its definitely something to to keep in mind!
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Alias Suppressed Wave Shaping

Postby Spogg » Fri Nov 01, 2024 3:03 pm

Just checked this out and it’s GREAT!
Thank you so much for this Martin. :D
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England


Return to DSP

Who is online

Users browsing this forum: No registered users and 3 guests