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

Tube stage emulation.

Post any examples or modules that you want to share here

Tube stage emulation.

Postby Emil » Mon Jul 24, 2023 11:26 am

Not long ago I came across the article "Digital Modeling of Guitar Amplifier Preamp Distortion" (https://www.ampbooks.com/mobile/dsp/preamp/). There, as an example, the waveshaper included in the Line 6 patent is given. I was interested in the transfer function consisting of three mathematical expressions. On closer examination, it turned out that the mathematical expressions presented in the article, intentionally or not, contained an inaccuracy in the description of the first function.
After some effort, this expression was refined and rewritten. Writing the triode emulation function in C++ was easy, but transferring the function to Flowstone DSP Code took much more effort. Anyway, I could not find a detailed manual on how to use Flowstone DSP. In the end, here is my solution. Spice simulation from the same article was added to the file.
Attachments
Tube stage emulation.fsm
(585.55 KiB) Downloaded 691 times
Emil
 
Posts: 16
Joined: Fri May 19, 2023 2:37 pm

Re: Tube stage emulation.

Postby martinvicanek » Mon Jul 24, 2023 7:52 pm

Hey Emil,
thanks for sharing, and welcome to the forum! Yes, FS documentation is a bit incomplete, but you seem to have succeeded anyway. :) In case of doubts you can always ask on this forum and people will be glad to help. All in all, we are a nice crowd. :D
Curious to see more from you here!
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Tube stage emulation.

Postby Emil » Mon Jul 24, 2023 9:40 pm

martinvicanek wrote:Hey Emil,
thanks for sharing, and welcome to the forum! Yes, FS documentation is a bit incomplete, but you seem to have succeeded anyway. :) In case of doubts you can always ask on this forum and people will be glad to help. All in all, we are a nice crowd. :D
Curious to see more from you here!

Thank you very much for your support! I am not a programmer, but a musician with some experience in making tube guitar amplifiers. Now the task is to improve and build the obtained waveshapers into a guitar amplifier simulator with full-fledged dynamics. But before that it is necessary to work out guitar Tone Stacks. I think 40% of the sound depends on them. Besides, there are SAG, DUMP, DEPTH, etc. in the Power amplifier. The ultimate goal is to make VST Amp Sim. That's actually why I chose FS. This is not a commercial project, so I will publish everything I create on the forum. And I would like to have feedback.
Emil
 
Posts: 16
Joined: Fri May 19, 2023 2:37 pm

Re: Tube stage emulation.

Postby martinvicanek » Tue Jul 25, 2023 6:50 pm

I agree that filtering (pre and post) is very important. In the meantime, since you asked for feedback, I have simplified your wave shaper math somewhat and also provided optimized ASM implementations. You can check the transfer curves inside. I have also included 4x oversampling. You can see that it removes aliasing at high gain quite a bit.
Keep it up!
Attachments
Tube stage emulation MVed.fsm
Simplified, optimized and oversampled
(227.71 KiB) Downloaded 711 times
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Tube stage emulation.

Postby Emil » Wed Jul 26, 2023 6:04 am

martinvicanek wrote:I agree that filtering (pre and post) is very important. In the meantime, since you asked for feedback, I have simplified your wave shaper math somewhat and also provided optimized ASM implementations. You can check the transfer curves inside. I have also included 4x oversampling. You can see that it removes aliasing at high gain quite a bit.
Keep it up!

I am impressed with the optimization of the DSP code and converting it to assembler! The FFT Display clearly shows even harmonics and the oversampling removes odd harmonics as far as possible, although it increases the CPU load. And if the number of tube stages as in modern amplifiers is 4 or 5, won't the processor be overloaded?
Emil
 
Posts: 16
Joined: Fri May 19, 2023 2:37 pm

Re: Tube stage emulation.

Postby R&R » Wed Jul 26, 2023 8:26 am

I REALLY have no business being in this thread at all since i'm not versed in these advanced matters. MV knows :)

But had to take a listen to your distortion Emil 8-) sounds nice...

Noticed also the math was very cpu taxing even after MV's magic :?
CPU spike is enough to crash my FS 3.08 on initialization of ASIO out... well, if I don't increase latency (for ASIO4ALL). But it might be a bit better performing on real ASIO sound device?
FS4 alpha handles it better but CPU is round 12% on my light laptop (11th gen i7)

Makes me curious (for my own learning as well) what operation in the math (or the logic rather) that FS has trouble with...

Emil wrote:And if the number of tube stages as in modern amplifiers is 4 or 5, won't the processor be overloaded?


Would be from the distortion/tube stages themselves. Unlikely MV's oversampling is loading on the CPU. I use atleast 3 of them in my synth plugin without even putting a dent on CPU (atleast to speak of).
All stages would be placed inbetween/inside only one 4x oversampling I guess... am I right?
R&R
 
Posts: 468
Joined: Fri Jul 15, 2022 2:28 pm

Re: Tube stage emulation.

Postby adamszabo » Wed Jul 26, 2023 9:39 am

The CPU usage is caused by the analyzers (spectrum analyzer and the scope). If you delete them I only get around 1% cpu on my very old laptop. If you use them in an actual plugin without the analyzers it shouldnt use any cpu at all.
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Tube stage emulation.

Postby martinvicanek » Wed Jul 26, 2023 9:57 am

Emil wrote:The FFT Display clearly shows even harmonics and the oversampling removes odd harmonics as far as possible
No, oversampling does not remove odd harmonics, it removes aliases. Play with the Frequency knob holding down the Shift key and watch the direction in which each of the peaks goes. Those that move backwards are aliases. You should also be able to hear it, especially those below the fundamental.
Here is a linear frequency plot:
4x_oversampling.png
4x_oversampling.png (103.61 KiB) Viewed 18058 times

no_oversampling.png
no_oversampling.png (108.7 KiB) Viewed 18058 times

The harmonics, whichever even or odd, are not affected by oversampling. The second image shows a multitude of frequencies in addition to the harmonic series. They are all aliases, the red arrows highlight the most prominent ones.
Emil wrote:if the number of tube stages as in modern amplifiers is 4 or 5, won't the processor be overloaded?
I don't think so. On my laptop readings are 1.5% for the non oversampled and 2.5% for the oversampled waveshaper. The increase is not necessarily proportional as you add more stages, and yes, the up- and downsamplers would probably be used only once, while everything in between would be oversampled. The details depend on what else you want to incorporate, but at this pont I would not be concerned about CPU load.
Oh, one thing: When you do measurements, remove everything that is not needed: the "Transfer Curves" module, the FFT and the Scope!
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Tube stage emulation.

Postby R&R » Wed Jul 26, 2023 10:40 am

adamszabo wrote:The CPU usage is caused by the analyzers (spectrum analyzer and the scope). If you delete them I only get around 1% cpu on my very old laptop. If you use them in an actual plugin without the analyzers it shouldnt use any cpu at all.


LOL :lol: :oops: bad observation, sorry about that! Yep I get only 1-2% cpu without that spectrum analyzer
R&R
 
Posts: 468
Joined: Fri Jul 15, 2022 2:28 pm

Re: Tube stage emulation.

Postby Emil » Thu Jul 27, 2023 12:09 pm

Hi all! Some time ago I read an article about replacing vintage Fender 12AX7 input stage with a solid-state (https://runoffgroove.com/fetzervalve.html#toc) and assembled the circuit shown there. I looked at the oscillogram and decided to repeat it using DSP means. Here's what I got. Oscillograms practically coincide.
Attachments
Fetzer waveshaper.fsm
(578.25 KiB) Downloaded 670 times
Emil
 
Posts: 16
Joined: Fri May 19, 2023 2:37 pm

Next

Return to User Examples

Who is online

Users browsing this forum: No registered users and 20 guests