SynthMaker

Amplifier Simulation?

Archive · 2005 49 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

oddson ·

Is anyone working on, or considering starting, any kind of tube amplification simulation? (Or even a more rudimentary form of distortion.)

Tom7777 ·

A while back there were some code examples of basic audio distortion which work quite well, i have made a metal guitar synth like Slayer that uses a heavy distortion and sounds like tube amplification but is not a direct emulation of the actual process, not making it available right now though, sorry 🙂

I suggest you do a search of the forum, there should be a few things already that will help 😀

sambean ·

You could try using the maths tanh function as a waveshaper.. this will give you some soft saturation/bit of warmth.. Here's the schematic for the function..

adding a small constant to the signal before will also add even harmonics and a richer sound..

Tom7777 ·

Although not exactly what you want you might want to check out the following -

Resampler

Sk ·

I was thinking of a tube distortion method as close as possible to physical reality. Though, since I've been taught electronics after year 2000, I know tubes too little. Anyway I found the electric schematic of a Hammond preamp, and I'll see what I can get out of it.

oddson ·

Hey sk!

I knew you'd be interested for your Hammond project. I don't think the circuit schematic is going to do you much good because, in my admittedly limited understanding, the interesting harmonic effects occur within the tube itself and occur due to the interaction of electrons coming off the cathode.

I think a rudimentary simulation of the main harmonic effects is the best we're going to see in SM (at least until some of the missing math functions are implemented in the CODE component and someone with more mental wattage than me applies themselves to it).

(See unkargherth's suggestion on using a Taylor series approximation for tanh, for an example.)

Which brings me to sambean...

What's inside the Pow(x,n) module?

Is it this Mono and Poly pow(x,n) modules...? How does this relate to tanh?

(Please, those who actually understand this stuff, correct me on whatever I'm saying here is just nonsence! I suspect some of it is.) 😕

sambean ·

Yeah, the power module is that of Shif's..

I'm using it for the exponential power e^x where e is 2.71828...

the defenition of tanh is:

from

http://mathworld.wolfram.com/HyperbolicTangent.html

I think I'm implementing it correctly..

the graph of the function is

with the input along the x and the output y, you can see how it will 'smooth off' loud signals giving you saturation instead of hard clipping..

Sk ·

oddson wrote: Hey sk!

I knew you'd be interested for your Hammond project. I don't think the circuit schematic is going to do you much good because, in my admittedly limited understanding, the interesting harmonic effects occur within the tube itself and occur due to the interaction of electrons coming off the cathode.

Partly right and partly wrong. The main effect of an amplifier (be it solid-state or vaccum-tube) is to amplify the signal (of course 🙂 ) while distorcing it. In particular, even if the distortion is almost none (that's the case of preamplifiers: they must have the least distortion possible, at the expenses of total amplification), any active component introduces an additive noise. To emulate the Hammond, this noise is fundamental, it's the famous leakage effect.

The characteristics of the noise depend on the physics of the active component (transistors and tubes have different profiles of noise). But the amount of noise, its amplification, the feedback along the circuitry depends on the electric disposition of the components. I'm trying to use a simulator to understand the effect of a tube amp on a clean signal, even though it will not be accurate, mainly because my simulator doesn't support tubes with seven-eight pins.

So, summing up, I'm looking for a slightly different thing: you're simulating distortion (especially through saturation, which is good for transistor amps), I'm trying to emulate noise.

oddson ·

Sk wrote: ...any active component introduces an additive noise. To emulate the Hammond, this noise is fundamental, it's the famous leakage effect.

I thought the 'leakage' effect related to the pickups getting signal from adjacent tonewheels.

I'm still not clear on the 'noise' you're looking for -- that's OK I don't need to be.

Me, I'm looking for something, I don't know what it is. Saturation on it's own isn't it. It involves adding harmonic distortion but I just don't understand it well enough.

I'm just a dilettante playing around. One day I might just understand all this. 🙂

CRU JONES ·

The Tanh function is good. sin(x) is good too. I am thinking that creating wavetables is a good idea because in real tube amps the power supplys and bias voltages are moving so much that, from my experience, one transfer curve doesn't cut it very well at all. With a wavetable you can dynamicly manipulate the index.

power supply:

cause: As input signals get bigger a class AB power amp draws more current, reduseing the voltages to the rest of the amplifier. This voltage drop also causes bias transients.

simulate: as absolute input values increase, move the input signals bias to a less steep part of the transfer curve... for instance a Tanh wavetable, you could add more value to the index to push the input signal up the curve higher. ( less y per value of x)

gain reduction:

Cause: All vacuum tubes have a gain who's formula includes as a component, the voltage supply... the higher the voltage, the higher the gain.

simulation: As input signals get bigger, overall gain drops. Kind of like a compressor. Except that compressors always sound different... wierd!

Another thing about tube amps is that haveing many stages causes phase shifts inbetween non-linear transfer functions...

and the magnetic components are cool too. Look up" B-H" curve to see what a transformers transfer function looks like.

Shifrin ·

sambean wrote: I think I'm implementing it correctly..

None of the mathworld links seem to work but it looks good to me :-

tanh = (e^2x - 1)/(e^2x + 1) which is what your schematic is doing 🙂

Shif.

rl ·

oddson wrote: Is anyone working on, or considering starting, any kind of tube amplification simulation? (Or even a more rudimentary form of distortion.)

http://www.amazon.com/gp/reader/0471490 ... &go=Go%21# has some good explanatons - see chpt. 3, starting at pg. 106 (espc. pg. 113 and following)

robrokken ·

People, come back! this is a great one!!!

About shifting the bias, this is hard, because what is the starting point for perfect bias? - 10, -4, -3 ??? It's very hard when you have different levels of guitar coming in.. one person records at one volume, the next at another... I"m really hung up on this, Because i've been trying to use the incoming volume to trigger other things, but it seems, theres too much fluctuation.. say i record at -10 one day and -6 the next, the values will all be off, further down the line... I've really been stuck with this, the last week..

~Rob.

aliasant ·

I dont think you should expect to do much about the input signal. Isnt this why a guitar amp has Input gain, Drive and Main Gain out to adjust for all this?

To control the input gain you could however use a softknee limiter/compressor or similar but that would affect the sound a lot more then wanted so to me that doesnt sound as a good way.

I dunno but I dont think controlling the input gain is what you really want?

MichaelBenjamin ·

i agree, if the quality of the input signal is reduced to just the volume (peak, rms, other?) basically you have 2 choices: 1. build an auto leveler that changes the algorithm dynamically on volume measured (complicated, progressive, lots of effort and finetuning needed) 2. include a static threshold setting, so people have to set up the value according to the volume they put in (the old standard approach, a bit boring, but easy to do).

maybe for a start into the non boring regions you can mix these two with a general threshold setting plus a simple compressor like volume detection that changes some parameters.

robrokken ·

Yeah you hit it, was trying to find a way out of having a lame "dynamics" knob or something. Really the reason, I need a good place to judge signals is for the following reasons:

The higher the db, the less bass The higher the db the more treble The higher the db, the more gain The higher the db the more bias movement

etc...

These are actually, mostly gonna be used for adding dyamics of a speaker, that cab sims, impulses don't do, but finding something stable to base these on is not easy as you've said.

~Rob.

robrokken ·

Actually, I had an idea, i have yet to take a pen and paper too..

Check every 2 samples... the db level.

IF Samplereadin2 > Samplereading 1 Then

Counter +1

Else

Counter - 1

I have to do some searches about checking the sample db, but does this sound like a good way to check to see if an audio signal is rising or falling ??

~Rob.

MichaelBenjamin ·

this would be a nice tool to get some whacky control data,and maybe its suited being a part in some custom mechanism to measure volume.

MichaelBenjamin ·

seems i was wrong, tried it out, its a lofi triangularifier. so if you need triangles for your volume measuring, it may work.

oddson ·

robrokken wrote: Actually, I had an idea, i have yet to take a pen and paper too..

Check every 2 samples... the db level.

IF Samplereadin2 > Samplereading 1 Then

Counter +1

Else

Counter - 1

I have to do some searches about checking the sample db, but does this sound like a good way to check to see if an audio signal is rising or falling ??

~Rob.

That would be meaningless.

If you have a sign wave that gets progressively louder it's still not the case that at each sample the output is greater than any before it (or even that it's absolute value is greater).

You have to have some sort of averaging that occurs at a period greater than the frequency of the audio signal.

Typically an envelope follower is used to determine the signal level. An envelope follower is essentially a low-pass filter combined with a rectifier (discards the sign so that strong negative values have the same effect as strong positive ones) and it's corner frequency should be below the audible range (<30 Hz and typically much less).

robrokken ·

Envolope follower works good, just had to modify the attack and release, as to almost make like an RMS, to smooth things out a bit. This auto leveler is crazy complicated in trying to figure out... Lets say you hooked a VU meter to the end of the Envelop Follower... I want the vu meter to stay the same reading, if the volume is -15 db, or -6 db... No matter what the db level, i would get the same readout. See I'm trying to capture the dynamic movements. I'm sure i'll think of a way to do this... its hard because there isn't a baseline anywhere!! hmmmm.... except o db.. maybe...

hmmm maybe i can somehow get the follower to shoot out float values....

~Rob.

robrokken ·

oddson, your average EG works perfect in this example:

0-1 value from stream signal?

oddson ·

Actually I haven't been following this thread very closely but it sound's like you're building a compressor. 😕

robrokken ·

Well, a compressor does have a lot of the elements... But even a compressor, if you turn the input up, the GR goes up.... in this case, i would want the gr to be the same if the signal was microscopic, or huge....

Might hang this one up for a bit.. Taking too much time and brain allocation hehehe

~Rob.

MegaHurtz ·

yust freehanded this.. but i think this should be like some sort of peak measurement. not a root mean square.

a=a+(in<signal2)&(in-a); signal2=in;

MegaHurtz ·

basicly you can acheive what you wanted to end up with by using less dynamic range on higher samplerates and curving it off. like in the other post, the tube modells even work like a limmiter yust by changing the dynamics. without using peak detection and stuff.

bootsy ·

This is an excellent overview: http://www.mitpressjournals.org/doi/pdf ... 09.33.2.85

hansdump ·

A great trend is to make use of nonlinear convolution.

Don´t know yet if its mentioned in the paper...

DAFX had some nice ones about applying exponential sinusoids as testsignal...

Surely this kind of signalgenerator could be implemented in SM.

But I see problems implementing the hammerstein model in SM.

H.

mshilarious ·

Late to this thread . . .

I did a basic single-triode into transformer simulation, didn't try for complete accuracy but it was enjoyable. You can do a lot by tweaking the Distortion and Saturation modules to fit the tube transfer curves. First, feed some DC offset into the distortion module and you'll get asymmetrical distortion (remove the DC offset after that stage). Take some care with introducing the offset, even with virtual capacitors on input and output, some hosts seemed to want to click on startup (even with soft-start on the offset). Of course you could just change the maths to treat + and - portions of the signal differently, but the offset approach was so simple and effective I stuck with it and got it to work.

Some LF emphasis into the Saturation module does a reasonable job of a transformer sim, again remove the LF emphasis after the Saturation module. You could put another Saturation module between the two without any preemphasis and a higher threshold, that is starting point for push-pull output. Then it's just a matter of tweaking the maths until they are close to the tubes you want to simulate.

Then I suppose an IR model for a speaker cabinet and you're done.

MegaHurtz ·

Assymetrical distortion sounds nice especcially with transfer curves. why dontcha post what you did so far maybe we can optimise it some more. Also you really should look up koren`s work. pretty sweet.

hansdump ·

...asymmetries make the difference!!!

If somebody wants to start with a diode in here just take the shockleys diode model and add about 0.6V there you will see!

http://en.wikipedia.org/wiki/Diode_mode ... iode_model

Vd is your input, so: Vd=0.65+input

you should not forget applying hp filtering and clipping at the output. Of course you can do clipping at certain values before and after. Or you try a curvefit of some other models 😈

input-->diode-->hp-->clipping

If you don´t take the 0.6 offset, you will hear nothing... this was a big aha-moment for me in understanding analog modeling (and if one rises a step...one sees, that the next step is much more huge).

Great events come from little cause.

So far from here...

PS: The most significant characteristics of transformers...as I know... most people call it cross-over distortion.

MegaHurtz ·

We can always trust you to get someting new on the table. Let`s have a look 🙂

MegaHurtz ·

Oopfhh, Always trusted the best analogue to the RC filter was the moving average. This would be quite the undertaking 😀

hansdump ·

http://en.wikipedia.org/wiki/Low-pass_filter

check only the Discrete-time realization!!

There you will find:

// Return RC low-pass filter output samples, given input samples, // time interval dt, and time constant RC y[i] := y[i-1] + α * (x[i] - y[i-1])

take a control and wire it to alpha! 0...1

if someone does not understand here my out of the box maybe buggy sm code:

streamin x; streamin alpha; streamout y;

float y1;

y= y1 + alpha * (x - y1); y1=y;

Your first realtime digital simulation of a RC Lowpass filter! Great 😈

H.

aliasant ·

hansdump wrote: if someone does not understand here my out of the box maybe buggy sm code:

streamin x; streamin alpha; streamout y;

float y1;

y= y1 + alpha * (x - y1); y1=y;

Your first realtime digital simulation of a RC Lowpass filter! Great 😈

H.

Thought I recognized this. Its just the old trusty lowpass filter we all have.

The code vesion I have look like this:

streamin in; streamin cutoff; streamout LP;

LP=LP+((in-LP)*cutoff);

And here is an ASM version:

streamin in; streamin cutoff; streamout LP;

movaps xmm1,in; subps xmm0,LP; mulps xmm0,cutoff; addps xmm0,LP;

movaps LP,xmm0;

Tzarls ·

A small addition to this topic. I was playing with the idea of waveshaping and came to this, a very basic OD + Power AMP setup, with some filters thrown in (Toolbox Filters by Myco) to remove harshness.

As I said before, everything here is just a couple of waveshapers to simulate the transfer curve of an OD (2 stages) and a power amp (2 stages) and some eq-ing. No tone stack, no cab resonator, nada. Let me know what you think.

MegaHurtz ·

100 % FAT_ Free Vst

Tzarls ·

Yes, tested you app today.... it acts a little like an upward compressor, right? Very much like the poweramp transfer curve stage, to some degree. I found that using a transfer curve you can achieve that in a very effective way. Have you tried my dll? I´d like you opinion.

MegaHurtz ·

I like the sound 😀 , But it`s a bit of a fiddle to get it out. since all the knobs get to 0. Never knowing what your default is. I would tweak it a little so you can go up from your default, into distortion. maybe normalising some stuff so you get close to a consistant density in sound level.

Tzarls ·

Yes, well, it´s just a test and needs maybe lots of work to make it flexible enough, but glad you like it´s sound. I wanted to know if it was possible to get some overdrive using just transfer curves.... I think I´ll send some sine waves into some of my amps and then plot the output to make some more curves and see what happens.

Tzarls ·

Here´s another version of the above experiment. Now it´s 4x oversampled, and has a switch to add even harmonics to the sound. It also sports the assymetrical 50-50 duty cycle characteristics and some kind of sag emulation. Gain controls (OD1 and OD2) go from 0 (silence) to full distortion.(4). Again no cab resonators, just a filter at the end of the chain to emulate the speaker response. To me it sound good when overdriven, but I don´t like the clean sounds (yet). I could say this one sound maybe a little more processed. Would like to hear your opinions.

robrokken ·

What is the sag based on? env follower?

Tzarls ·

Yes. It kind of push back when you attack the strings hard. Not the most elegant thing, and I´m not sure if I like it yet. 🙂

robrokken ·

Moderation is the key lol, yeah, distortion sounds real good... 🙂

Tzarls ·

Thanks. I like it too, althought sometimes I find it a little fizzy. I wanted to try some cabinet simulation after the amp, and got carried away with the convolution thing. Once I figure out how to make the conv work, I´ll return to this thing. I´ve got a couple of ideas that might make it more interesting, but we´ll see.

squareal ·

Hi guys

Im currently trying to make a classic valve amp and am in need of some assistance. The problem is trying to create a soft clip using the stereo clip component but as Im a bit green in this department I was wondering if anyone could help me out.

Many thanks

unkargherth ·

for a very basic approximation of a "valve" kind sistorsion you could use you could use an hyperbolic tangent-style curve

Check the wiki Here

oddson ·

Unk? - Three years no word and this is your big come-back post?

Nice spot that we'd let this guy's question languish.

Good to hear from you.

Now if only Sambean would stop lurking and pipe-up once in a while.

unkargherth ·

It's a bunch of fresh air in my e-life to return here....

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.