Re: [music-dsp] Simulating Valve Amps

2014-06-20 Thread Tim Goetze
[Andrew Simper]
On 18 June 2014 21:01, Tim Goetze t...@quitte.de wrote:
 I absolutely agree that this looks to be the most promising approach
 in terms of realism.  However, the last time I looked into this, the
 computational cost seemed a good deal too high for a realtime
 implementation sharing a CPU with other tasks.  But perhaps I'll need
 to evaluate it again?

The computational costs of processing the filters isn't high at all, just
like with DF1 you can compute some simplified coefficients and then call
process using those. Since everything is linear you end up with a bunch of
additions and multiplies just like you do in a DF1, but the energy in your
capacitors is preserved when you change coefficients just like it is when
you change the knobs on a circuit.

Yeh's work on the Fender tonestack is just that: symbolic nodal
analysis leading to an equivalent linear digital filter.   I
mistakenly thought you were proposing nodal analysis including also
the nonlinear aspects of the circuit including valves and output
transformer (which without being too familiar with the method I
believe to lead to a system of equations that's a lot more complicated
to solve).
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Simulating Valve Amps

2014-06-20 Thread Urs Heckmann

On 20.06.2014, at 11:11, Tim Goetze t...@quitte.de wrote:

  I
 mistakenly thought you were proposing nodal analysis including also
 the nonlinear aspects of the circuit including valves and output
 transformer (which without being too familiar with the method I
 believe to lead to a system of equations that's a lot more complicated
 to solve).

Well, it might not be as straight forward, but there are various methods to 
solve non-linear systems of equations.

The main problem arises when a non-linear element occurrs on both sides of an 
equation, such as

Vout = g * ( tanh( Vin ) - tanh( Vout ) ) + iceq

As one can't solve this for Vout, there's a few different approaches to deal 
with it computationally.

The most common one is to introduce a unit delay (aka the naive method)

Vout[ n ] = g * ( tanh( Vin[ n ] ) - tanh( Vout[ n - 1 ] ) ) + iceq

This however leads to mangled phase/frequency response and worse time invariant 
properties, e.g. when sweeping g

A quick and easy method to resolve this is to only apply the unit delay to the 
effect of the non-linearity itself, but keep the system delay-less for its 
linear components:

Vout = g * ( tanh( Vin ) - f[ n-1 ] * Vout  ) + iceq
f[ n ] = tanh( Vout )/Vout;

This way the equation can be solved for Vout and the non-linearity becomes a 
factor that's applied with one sample delay.

Similar methods apply an offset and a tangent to linearize the non-linearity 
for a moment in time.

So far this is computationally easy going, but it's also a compromise in 
accuracy. To become numerically accurate one typically uses iterative methods 
to look into the future. A very simple approach is to estimate the value in 
question, calculate the equation and compare the estimate with the result. From 
there on one can refine the estimate until it converges with the result in any 
desired accuracy, such as

while ( abs( Vout_result - Vout_estimate )  0.0001 )
{
Vout_estimate = rootFindingAlgorithmOfChoice( Vout_result );
Vout_result = g * ( tanh( Vin ) - tanh( Vout_estimate ) ) + iceq
}

There you go. It's very basic and it can be optimised to run on a modern CPU.

Cheers,

- Urs

--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Simulating Valve Amps

2014-06-20 Thread Andrew Simper
On 20 June 2014 17:11, Tim Goetze t...@quitte.de wrote:

 [Andrew Simper]
 On 18 June 2014 21:01, Tim Goetze t...@quitte.de wrote:
  I absolutely agree that this looks to be the most promising approach
  in terms of realism.  However, the last time I looked into this, the
  computational cost seemed a good deal too high for a realtime
  implementation sharing a CPU with other tasks.  But perhaps I'll need
  to evaluate it again?
 
 The computational costs of processing the filters isn't high at all, just
 like with DF1 you can compute some simplified coefficients and then call
 process using those. Since everything is linear you end up with a bunch of
 additions and multiplies just like you do in a DF1, but the energy in your
 capacitors is preserved when you change coefficients just like it is when
 you change the knobs on a circuit.

 Yeh's work on the Fender tonestack is just that: symbolic nodal
 analysis leading to an equivalent linear digital filter.   I
 mistakenly thought you were proposing nodal analysis including also
 the nonlinear aspects of the circuit including valves and output
 transformer (which without being too familiar with the method I
 believe to lead to a system of equations that's a lot more complicated
 to solve).


Nodal analysis can refer to linear or non-linear, so sorry for the
confusion. I was trying to point out that the linear analysis done by Yeh
starts the circuit but then throws it away and instead uses a DF1, and a
DF1 does not store the state of each capacitor individually, so when you
turn the knob you don't get the right time varying behaviour. I am saying
you don't have to throw the circuit away, you can still get an efficient
implementation since in the linear case everything reduces to a bunch of
adds and multiplies.

For non-linear modelling you need additional steps, and depending on the
circuit there are many different methods that can be tried to find the best
fit for the particular requirements.
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Simulating Valve Amps

2014-06-20 Thread robert bristow-johnson

On 6/20/14 10:57 AM, Andrew Simper wrote:

On 20 June 2014 17:11, Tim Goetzet...@quitte.de  wrote:


[Andrew Simper]

On 18 June 2014 21:01, Tim Goetzet...@quitte.de  wrote:

I absolutely agree that this looks to be the most promising approach
in terms of realism.  However, the last time I looked into this, the
computational cost seemed a good deal too high for a realtime
implementation sharing a CPU with other tasks.  But perhaps I'll need
to evaluate it again?

The computational costs of processing the filters isn't high at all, just
like with DF1 you can compute some simplified coefficients and then call
process using those. Since everything is linear you end up with a bunch of
additions and multiplies just like you do in a DF1, but the energy in your
capacitors is preserved when you change coefficients just like it is when
you change the knobs on a circuit.

Yeh's work on the Fender tonestack is just that: symbolic nodal
analysis leading to an equivalent linear digital filter.   I
mistakenly thought you were proposing nodal analysis including also
the nonlinear aspects of the circuit including valves and output
transformer (which without being too familiar with the method I
believe to lead to a system of equations that's a lot more complicated
to solve).



Nodal analysis can refer to linear or non-linear, so sorry for the
confusion.


well, Kirchoff's laws apply to either linear or non-linear.  but the 
methods we know as node-voltage (what i prefer) or loop-current do 
*not* work with non-linear.  these circuits (that we apply the 
node-voltage method to) have dependent or independent voltage or current 
sources and impedances between the nodes.



  I was trying to point out that the linear analysis done by Yeh
starts the circuit but then throws it away and instead uses a DF1, and a
DF1 does not store the state of each capacitor individually, so when you
turn the knob you don't get the right time varying behaviour.


in the steady-state (say, a second after the knob is turned) is there 
the right behavior with the DF1?



  I am saying
you don't have to throw the circuit away, you can still get an efficient
implementation since in the linear case everything reduces to a bunch of
adds and multiplies.


and delay states.


For non-linear modelling you need additional steps, and depending on the
circuit there are many different methods that can be tried to find the best
fit for the particular requirements


if, the sample rate is high enough (and it *should* be pretty fast 
because of the aliasing issue) the deltaT used in forward differences 
or backward differences (or predictor-corrector) or whatever should be 
pretty small.  in my opinion, if you have a bunch of memoryless 
non-linear elements connected in a circuit with linear elements (with or 
without memory), it seems to me that the simple Euler's forward method 
(like we learned in undergraduate school) suffices to model it.


Andrew, i realize that you had been using something like that to emulate 
linear circuits with capacitors and resistors and op-amps.  it does make 
a difference in time-variant situations, but for the steady state (a 
second or two after the knob is twisted), i'm a little dubious of what 
difference it makes.


--

r b-j  r...@audioimagination.com

Imagination is more important than knowledge.



--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


[music-dsp] Breakthrough in mastering.

2014-06-20 Thread socialmedia

Heya.

I have a new blog up, and as some of you know, I have been working on 
DSP for a while, and my products are linked there, along with my music.


I feel that I have made a breakthrough in mastering, and would like to 
share it with you.


Introducing also The Karlsen Window, that is a minimal-phase gaussian 
filter, with the rise (fastest half) mirrored (and 1 sample truncated on 
each side, in mine.)


Featured as an option in my limiter linked on that page. And I am also 
working on a compressor, with selectable overshoot, and a gaussian 
filter, that makes very well use of the limiter.


The result is very musical.

https://www.youtube.com/watch?v=s4KvJj9x6Xk

A bit more on the blog about the compressor aswell.

Best Regards,
Ove Karlsen
Artists, researcher, engineer
Monotheo.biz



--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp