Re: [music-dsp] R: R: Trapezoidal integrated optimised SVF v2

2013-11-13 Thread STEFFAN DIEDRICHSEN

On 13.11.2013, at 12:54, Vadim Zavalishin 
vadim.zavalis...@native-instruments.de wrote:

 So, after we have modelled them all, we are not gonna need any further 
 modelling.

;-)

At that time,we should offer real-time spice to let our dear customers tinker 
with their virtual circuits. We’ll offer in-app purchases like “bumble bee 
paper wax caps” or “snake oil inductors”.

Steffan 
--
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] R: R: Trapezoidal integrated optimised SVF v2

2013-11-10 Thread douglas repetto


Urs, I don't know if you're referring to music-dsp here, but this list 
is specifically not meant to be in the academic realm, but rather a 
place where people of all sorts with an interest in music and digital 
signal processing can chat. So I encourage you to share your results here!


I'm sorry there has been unpleasantness on the list recently.

best,
douglas



On 11/10/13 10:00 AM, Urs Heckmann wrote:

We had planned to write a paper about our numerical method for the
non-linear case, including a pretty fast solving algorithm that's
fundamentally more precise than Newton-Raphson. But seeing how this
won't be well received in the academic realm (seemingly too trivial),
we might just share it in more practically oriented place (KVR dev
forum).


--
... http://artbots.org
.douglas.irving http://dorkbot.org
.. http://music.columbia.edu/cmc/music-dsp
...repetto. http://music.columbia.edu/organism
... http://music.columbia.edu/~douglas


--
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] R: R: Trapezoidal integrated optimised SVF v2

2013-11-10 Thread robert bristow-johnson



On 11/9/13 6:52 PM, Andrew Simper wrote:


Marco writes:

Well, of course the s = (T/2)(z-1)/(z+1) conversion comes from discretizing
a differential equation.


but remember, that's not the only way to convert s to z.  that's the 
bilinear way to do it.


...


What I would say more about this method is that , since it is
intrinsicly a biquad, you not only have to prewarp the cutoff fc but
also the Q. In such

Are you talking about bell filters here? For a low pass resonant filter it

is hard to warp the Q since there is no

extra degree of freedom to keep its gain down, so I'm not sure how

prewarping the Q is possible in this case, but I'd love to hear if it can be
done.

Not only, but wait I could be wrong on this. I always took RBJ cookbook as a
bible and he doesn't really say that the Q cant be prewarped for LPF/HPF
starting from the analog Q. Maybe RBJ can correct me :)


frequency warping is a consequence of using BLT.  the cool thing about 
BLT that other methods that convert s to z do not have is that it maps 
the j*omega axis in the s-plane to the unit circle in the z-plane, 
similarly to how the *exact* transformation does (which is z = 
e^(s/Fs)).  and the frequency mapping is strictly increasing and close 
to the identity function for fFs.  so every bump, every feature that 
you see in the analog frequency response has a corresponding bump in the 
digital filter frequency response.  but slightly (at low f) moved in 
frequency.  at higher frequencies the effect is much more pronounced, 
which is why compensating for frequency warping (what we call 
pre-warping) is necessary.


it is an effect on *frequency*, not on amplitude.  if you have a 3 dB 
bump in the analog frequency response, there will be a 3 dB bump in the 
BLT-designed digital filter, but that bump might not be at the same 
place.  so that's why the cookbook says nothing about prewarping Q.  i 
am assuming that for a LPF, if you want to design for a resonant lip 
or bump of 1 dB, you want the same 1 dB bump in the digital filter.  so 
no compensation of that parameter.


but bandwidth is different.  bandwidth is about frequency or log of 
frequency or something else (bark scale??).  for every degree of freedom 
you have in the frequency anchor points, you can apply pre-warping and 
independently compensate each one regarding their relocation done by 
BLT.  that's why it's appropriate to pre-warp bandwidth when using the 
BLT to convert s to z.



I would love it if you are right. If RBJ can pull it off I would love
to see how as it would be ultra ultra useful!


pull exactly *what* off?


I am however loath to use the dreaded words delay-free since they
are pretty meaningless. Did you know that every single of the famous
RBJ audio eq cookbook filters are delay-free? Yes, that's right,
everyone using RBJ cookbook eqs and low pass filters can now happily
slap on their software the hollow marketing term featuring delay-free
filter technology!



i have absolutely no idea what this is about.


So delay-free is a pointless expression to me,


it has been used to discuss or advertise delay-free feedback which, to 
me, still remains an impossibility for discrete-time systems.


and i've seen the papers.  when it all boils down to it in a real-time 
filter, you are defining your current output sample in terms of the 
current input sample and previous input samples and, if it's recursive, 
the previous output samples.  but you cannot define your current output 
sample in terms of the current output sample.



  a more meaningful
thing to mention could possibly be that (non-linear) implicit
functions are being solved. For example something that has a
non-linear voltage to current mapping, or something that solves for
non-linearities placed in feedback loops, anything else is just linear
algebra that can be solved in a single step. But even then who cares
as long as it sounds good?


yup.  and at Fs=96kHz, you can make it sound very good.  and that 
single-sample delay is half of what it would be at 48 kHz.



--

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


Re: [music-dsp] R: R: Trapezoidal integrated optimised SVF v2

2013-11-10 Thread Urs Heckmann

On 11.11.2013, at 01:33, robert bristow-johnson r...@audioimagination.com 
wrote:

 but you cannot define your current output sample in terms of the current 
 output sample.

But that, with all due respect, is what has been done for quite a while. It 
isn't the major ingredient of great sound, but it arguably has its perks, 
albeit cpu smoking ones.

I agree with Andy though that the main advantage of preserving the topology is 
the possibility to insert the non-linearities at the right point. When using 
BLT, how would you insert the non-linear effects of a diode or an OpAmp into 
your model, where these things are desirable for a musical result?

- 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] R: R: Trapezoidal integrated optimised SVF v2

2013-11-10 Thread robert bristow-johnson

On 11/10/13 5:12 PM, Urs Heckmann wrote:

On 11.11.2013, at 01:33, robert bristow-johnsonr...@audioimagination.com  
wrote:


but you cannot define your current output sample in terms of the current output 
sample.

But that, with all due respect, is what has been done for quite a while.


it's been reported or *reputed* to be done for quite a while.

but when the smoke and dust clear, logic still prevails.


--

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


Re: [music-dsp] R: R: Trapezoidal integrated optimised SVF v2

2013-11-10 Thread Ezra Buchla
i hope it's ok if i sum up the main themes here with background links,
as i understand it. the thread is just such a mess...

here is the state variable filter from hal chamberlin 1985 or so:
http://t.co/SVJp7iAgqb

pierre dutilleux wrote up a nice discretized and tuned version in dafx 1998:
http://iua.upf.edu/dafx98/papers/
presumably drawing on (it can be shown that...) this much earlier
AES paper, which i have not purchased
https://secure.aes.org/forum/pubs/conventions/?elib=5937

andrew simper's suggestion is to integrate the capacitor functions
with trapezoidal approximation, allowing for some refactoring and
simplication of the dif. eq.s and  faster code.
http://cytomic.com/files/dsp/SvfLinearTrapOptimised.pdf

there seems to be some concern about distortion introduced by the
trapezoidal integration. i've tried the algo in both fixed 32 ands
float, and it seems to sound and look ok to but i have not done a
proper analysis either numerically or physically. has anyone else?

theo vereslt seems to think the distortion would be unacceptable, and
so i tend to believe that in a really high-fidelity environment it
could be an issue. additionally, he seems to imply (maybe? i'm not
sure) that not only is the optimization not worth it, but you can't
adequately suppress artifacts during coefficient change at all (which
i've always understood as the main raison for the digital SVF) without
analog components (referenced switched caps as variable R's, an
interesting trick), or more bandlimiting somewhere, or something.

the KeepTopology paper by vadim zavalishin (http://t.co/SVJp7iAgqb)
proposes modelling the SVF with digital integrators. it seems like
these would follow the behaviors of the caps pretty closely and be
amenable to parameter change at the cost of some expense of course...
wouldn't that satisfy the purists? this last exchange seems to
indicate not... but i'm not sure why. again i should just try this
myself but it's a bit more work! ha.

thank you all for the discussion and sorry for my noise

ezra b
--
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] R: R: Trapezoidal integrated optimised SVF v2

2013-11-10 Thread Ross Bencina

Hi Ezra,

A few comments:

On 11/11/2013 3:19 PM, Ezra Buchla wrote:

there seems to be some concern about distortion introduced by the
trapezoidal integration. i've tried the algo in both fixed 32 ands
float, and it seems to sound and look ok to but i have not done a
proper analysis either numerically or physically. has anyone else?


All single-step digital integration procedures will necessarily diverge 
from the analog integration.


Here's a graph of the amplitude response of various integrators:

https://docs.google.com/document/d/1O_38tHxkMIrSScLXULuzJAmNxYj01PxEKw50hhY4kkU/edit?usp=sharing

Trapezoidal is good because it is stable but as you can see it has 
high-frequency roll-off compared to some others. As noted earlier 
Simpsons rule is not usable if you want your cutoff to go near Nyquist 
but is more accurate up to pi/4, which means that if you're using 2x 
oversampling.


Trapezoidal is equivalent to the warping introduced by BLT (bilnear 
transform) I believe. One way to think about it is that a lowpass filter 
in the analog domain has gain 0 at infinite frequency, and infinite 
frequency maps to Nyquist after BLT/Trapezoidal -- so you will get some 
warping.



theo vereslt seems to think the distortion would be unacceptable, and
so i tend to believe that in a really high-fidelity environment it
could be an issue.


The usual suggestion is to oversample by 2x. Many implementations do 
this and it has been discussed here many times over the years. It is 
possible to do other tricks to match the amplitude response at 1x but 
the phase response can get screwed up and you really want something 
close to analog for both amplitude and phase responses.


My take is that for synthesis it's all about your aesthetic -- if you 
want it to sound like an analog synth that's different from if you want 
it to sound good. There's whole music genres based on commodore 64 SID 
chips or destorted noise.. so anything goes really.




additionally, he seems to imply (maybe? i'm not
sure) that not only is the optimization not worth it, but you can't
adequately suppress artifacts during coefficient change at all (which
i've always understood as the main raison for the digital SVF) without
analog components (referenced switched caps as variable R's, an
interesting trick), or more bandlimiting somewhere, or something.


I think the main point in the current discussion is that if you want to 
do *audio rate* modulation (think filter FM) then most tricks won't 
save you. You need a filter that can be modulated at audio rate and 
doesn't introduce spurious artifacts. Of course audio-rate FM will 
alias, but that's a separate issue that can be addressed by oversampling 
etc.



the KeepTopology paper by vadim zavalishin (http://t.co/SVJp7iAgqb)
proposes modelling the SVF with digital integrators. it seems like
these would follow the behaviors of the caps pretty closely and be
amenable to parameter change at the cost of some expense of course...'


All filters use digital integrators. There's just a lot of different 
types of integrators.




wouldn't that satisfy the purists? this last exchange seems to
indicate not... but i'm not sure why. again i should just try this
myself but it's a bit more work! ha.


I can recommend the following book as a gentle and no-hype low-math 
introduction to numerical integration. Written by a guy who cut his 
teeth computing trajectories on the Apollo project:


Math Toolkit for real-time programming
Jack W. Crenshaw
CMP Books.

Cheers,

Ross.






thank you all for the discussion and sorry for my noise

ezra b
--
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


--
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] R: R: Trapezoidal integrated optimised SVF v2

2013-11-10 Thread Ross Bencina

On 11/11/2013 12:21 PM, robert bristow-johnson wrote:

but you cannot define your current output sample in terms of the
current output sample.

But that, with all due respect, is what has been done for quite a while.


it's been reported or *reputed* to be done for quite a while.

but when the smoke and dust clear, logic still prevails.


I presume Urs (hi Urs!) is talking about using implicit solvers. Which 
some people have been using for a while.


I guess it depends how you define current output sample. Is it the 
trial output sample that you're refining, or the sample you actually output?


Seems logic could go either way.

Ross.
--
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] R: R: Trapezoidal integrated optimised SVF v2

2013-11-09 Thread Andrew Simper
On 9 November 2013 22:21, Marco Lo Monaco marco.lomon...@teletu.it wrote:

Hi Marco,

First up I want to thank you for your considered and useful
observations Marco, I appreciate where you are coming from and how you
can clearly communicate your ideas. This makes it possible for me to
reply to your points and offer observations in return which are
hopefully helpful to not only you, but anyone reading this thread.


 Hi Andrew,

 I think it's useful for everyone, and especially those wanting to handle
 non-linearities or other music behaviour.

 Yes, but people who are working in this field and doing virtual analog have
 known these tricks for at least 10 years ago. :)

Here is a direct quote from my first email, and similar quotes will be
found in all initial emails from me, and references to reinforce just
how not new this stuff is:

Please note there is absolutely nothing new here, this is all standard
circuit maths that has been around for ages, and all the maths behind
it was invented by people like Netwon, Leibnitz, and Euler, they
deserve all the credit and came up with ways of solving not just this
linear case but also the non-linear case.

Even if this is old news, there are plenty of people struggling along
with algorithms that don't sound as good and they aren't aware of
alternatives. I'm trying to raise the level of dsp here by pointing
out what to me is obvious and helpful, I'm not pretending to have
invented anything.

 You don't need the laplace space to apply all these different
 discretization (numerical integration)
 methods, they all come from the time domain and can be derived pretty
 quickly from first principles.

 Well, of course the s = (T/2)(z-1)/(z+1) conversion comes from discretizing
 a differential equation. Using Laplace is simply more handy IMHO. Mainly
 because once you have your state space model (or TF) representation you can
 choose (via a CAS tool) to discretize it at best. Moreover modeling an
 analog network with s-domain impedence sometimes is quicker/easier. But I
 understand it's only a routine behavior and it's a matter of tastes. I
 remember I have once modeled 50eqs linear system via KVL/KCL always
 remaining in the continuos domain and because I wanted to see different
 behavior I chose the Laplace representation. If I had to solve several times
 those linear system with different integration rules I would have gone nuts
 :)

Please note you only have to solve the numerical integration equations
once to generate a linear equivalent model of the form ic = gc vc -
iceq, then you put that linear equivalent model into your Computer
Algebra System (CAS) to solve things.

So although it may be more handy for you at the moment to do things
via the laplace domain there are compelling reasons not to, even in
the case where you don't modulate the filter at all like an eq. In
noise performance tests I've done (I don't know how to prove this
analytically, but if you do then please go ahead and work it out and
share it with us!) using direct integration on an svf delivers better
results (rms error) than any other filter realisation I've tried which
operates via the laplace transform (DF1, DF2, DF2T, Ladder (not moog),
Direct Wave, etc etc). Here are some plots of the previous method I
posted which is almost identical to the one in the newer pdf, the
ladder structure is the only one to come come close but it falls down
on some of the tests. I suggest if you are not convinced to repeat the
tests yourself (or even come up with new ones) and share the results:

http://www.cytomic.com/files/dsp/SVF-vs-DF1.pdf


  What I would say more about this method is that , since it is
  intrinsicly a biquad, you not only have to prewarp the cutoff fc but
  also the Q. In such

 Are you talking about bell filters here? For a low pass resonant filter it
 is hard to warp the Q since there is no
  extra degree of freedom to keep its gain down, so I'm not sure how
 prewarping the Q is possible in this case, but I'd love to hear if it can be
 done.

 Not only, but wait I could be wrong on this. I always took RBJ cookbook as a
 bible and he doesn't really say that the Q cant be prewarped for LPF/HPF
 starting from the analog Q. Maybe RBJ can correct me :)

I would love it if you are right. If RBJ can pull it off I would love
to see how as it would be ultra ultra useful!


  You can do all the same warping no matter if you go through the laplace
 space or
  directly integrate the circuits, and it doesn't matter what realisation
 you are using, in
 particular you can have a look at my previous workbook
  where I matched the SVF to Roberts RBJ shapes:

 I would love to see it, if you have the chance.

I missed adding the link here, sorry about that, here is the old
version with the bell shape mapped, you can use the same method on the
new version I just didn't bother adding it to the new pdf (you match
all the RBJ shapes with algebra exactly)