Tube stage emulation.

Post any examples or modules that you want to share here
Tepeix
Posts: 361
Joined: Sat Oct 16, 2021 3:11 pm

Re: Tube stage emulation.

Post by Tepeix »

That's very interesting, and the article too ! Thanks to share ! And welcome !!)

But please, do not let an asio out activated in a shared schematic.
It could cause problems when we open it, the file remember the asio parameter of your computer and try to apply it on another one.

It seams to have a little difference with the harmonics in your article.
Using a windoned fft display we could see that the 3rd harmonic is present.
(i don't know how to change that, trying yet to understand your code)
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Tube stage emulation.

Post by martinvicanek »

Emil, you are progressing fast! :geek:
I have attached a suggestion to further simplify the math. Furthermore, you use the variable y3 for streamout, then it is not good to declare it as float y3 below. I find this type of error in my own ccode quite often. :oops:

Luckily, there is an active development for the next Flowstone release 4. It is a complete overhaul with many subtantial improvements and loads of new features. For instance the above type of error would be immediately highlighted, so it is easy to find and fix.

Experienced flowstoners can test the latest alphas and report bugs to the developer in an agile process. At your pace, I can imagine you could join in, too, if you like. Ask Spogg for further details.
Attachments
Fetzer waveshaper MVed.fsm
(578.76 KiB) Downloaded 866 times
Emil
Posts: 16
Joined: Fri May 19, 2023 2:37 pm

Re: Tube stage emulation.

Post by Emil »

I tried to create a simulation of Power Amp class A and class AB and got rather complicated mathematical expressions. I did not try to simplify them cause my head is already swollen.
Attachments
Power Amps waveshapers.fsm
(249.14 KiB) Downloaded 843 times
Emil
Posts: 16
Joined: Fri May 19, 2023 2:37 pm

Re: Tube stage emulation.

Post by Emil »

Hi to all! This is DSP code of Soft clip. It's rather complicated, but it might be useful to someone.
Attachments
Soft clip.fsm
(139.76 KiB) Downloaded 808 times
R&R
Posts: 474
Joined: Fri Jul 15, 2022 2:28 pm
Contact:

Re: Tube stage emulation.

Post by R&R »

Emil wrote:Hi to all! This is DSP code of Soft clip. It's rather complicated, but it might be useful to someone.
Thanks! This is of good use for me...

Seems ideal for me as beginner, to do some refactoring and also practice at ASM... or maybe also convert to Poly. Because why not 8-)
Emil
Posts: 16
Joined: Fri May 19, 2023 2:37 pm

Re: Tube stage emulation.

Post by Emil »

Hello everyone!!! I've just made another "Soft clipper" but a softer one. For this I wrote DSP code and then optimized it according to martinvicanek's recommendations. So I have two codes: one optimized and another not. Pay attention to the video from 19 to 23 sec. The scope clearly shows "peaks" appearing chaotically when the signal is processed by "Soft clipper opt". When the signal goes through "Soft clipper" (not optimized) not. I can't understand what is this. Can anyone explain to me what is going on?
https://youtu.be/OIQYiaf-CcQ
Attachments
Softer clipper with gain factor 1.fsm
(150.05 KiB) Downloaded 795 times
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Tube stage emulation.

Post by martinvicanek »

xb gets zero for x=0.25, xt gets zero for x=-0.25. In your code there are divisions by xb and xt. Even though your piecewise definition of the curve is not supposed to use those ill-conditioned values when x is near 0.25 or -0.25, they still get evaluated, added, subtracted, masked and whatnot. The result then depends on the order of operations. In the non-optimized code you are just lucky.

Avoid divisions by zero (or even nearly zero).
Emil
Posts: 16
Joined: Fri May 19, 2023 2:37 pm

Re: Tube stage emulation.

Post by Emil »

martinvicanek wrote:xb gets zero for x=0.25, xt gets zero for x=-0.25. In your code there are divisions by xb and xt. Even though your piecewise definition of the curve is not supposed to use those ill-conditioned values when x is near 0.25 or -0.25, they still get evaluated, added, subtracted, masked and whatnot. The result then depends on the order of operations. In the non-optimized code you are just lucky.
Avoid divisions by zero (or even nearly zero).
Thanks a lot, Martin! The problem's just been solved.
Attachments
Softer clipper opt corrected.fsm
(147.55 KiB) Downloaded 915 times
Post Reply