hi, is someone working on msd? I wonder why it is not possible to change the mass of a mass dynamically with something like [setMass m1 1.5( is this function not supported because it is not possible, or just because it was not implemented yet. marius.
Are you talking about some kind of mass, spring, damper equation?
We could write such a thing with just a biquad~ or fexpr~, if that makes life easier. It's just a little bit of math.
Chuck
On Sat, Mar 15, 2008 at 1:32 PM, marius schebella marius.schebella@gmail.com wrote:
hi, is someone working on msd? I wonder why it is not possible to change the mass of a mass dynamically with something like [setMass m1 1.5( is this function not supported because it is not possible, or just because it was not implemented yet. marius.
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
yes, I was talking about an external called msd. I am not sure if biquad~ or fexpr~ can help. Is it possible to create harmonic sounds by sending impulses into a biquad~? that would really help. right now I am playing with msd in a block~ 1 subpatch, which is not very efficient. marius.
Charles Henry wrote:
Are you talking about some kind of mass, spring, damper equation?
We could write such a thing with just a biquad~ or fexpr~, if that makes life easier. It's just a little bit of math.
Chuck
On Sat, Mar 15, 2008 at 1:32 PM, marius schebella marius.schebella@gmail.com wrote:
hi, is someone working on msd? I wonder why it is not possible to change the mass of a mass dynamically with something like [setMass m1 1.5( is this function not supported because it is not possible, or just because it was not implemented yet. marius.
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
marius schebella a écrit :
yes, I was talking about an external called msd. I am not sure if biquad~ or fexpr~ can help. Is it possible to create harmonic sounds by sending impulses into a biquad~?
yes, serch for resonator on this list. there was an exemple using fexpr~ (i think)
that would really help. right now I am playing with msd in a block~ 1 subpatch, which is not very efficient.
use pmpd~
cyrille
marius.
Charles Henry wrote:
Are you talking about some kind of mass, spring, damper equation?
We could write such a thing with just a biquad~ or fexpr~, if that makes life easier. It's just a little bit of math.
Chuck
On Sat, Mar 15, 2008 at 1:32 PM, marius schebella marius.schebella@gmail.com wrote:
hi, is someone working on msd? I wonder why it is not possible to change the mass of a mass dynamically with something like [setMass m1 1.5( is this function not supported because it is not possible, or just because it was not implemented yet. marius.
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
I have forgotten some things here. That's why it took so long, but I think I've got it mostly right.
There are two type of mass spring systems, depending on what kind of input you have.
force-driven: such as a loudspeaker--the coil induces a force on a permanent magent.
velocity driven: a crankshat-piston assembly--rotates with a fixed speed;classic problems for vibration isolation.
but I'm only going to cover the first one here.
these two type of inputs are similar to electronic circuits: a voltage source (force) and a current source (velocity)
so, a mechanical circuit would look like:
|-----(M)---(S)----(D)---| (F) | |----------------------------|
all in series
Suppose our output is the velocity.
F=m*a (the force on a mass is in the same direction as its acceleration) F=c*v (the damping force is in the opposite direction of velocity) F=k*d (the spring force is in opposite direction of displacement)
F(t)=m*dv/dt + c*v + k*integral(t0 to t, v*dt) Laplace transform: F(s)=(m*s+c+k/s)*V(s)
And the transfer function:
F(s) 1/k*s ------ = -------------------------------------- V(s) (m/k)*s^2 + (c/k)*s + 1
And there are three cases: underdamped, critically damped, and over damped (I'm not sure how to do the z-transform for a critically damped system, but I think we can figure it out).
poles: -0.5*c/m +/- 0.5*sqrt( (c/m)^2 - 4k/m ) zero: 0
Note, when c goes to 0, we get a harmonic oscillator at angular frequency w=k/m rad/sec, which is correct. When we increase the damping, we get terms of e^(-0.5*c/m*t) which damps the solution.
Under-damped case (the resonant system): (c/m)^2 - 4k/m < 0
I'm reluctant to try to use a bi-linear tranform, here. I'd like to look it up in a table! I've worked through these problems before, but I can't remember what you do differently with the numerator... I think it indicates a mixture of sines/cosines.
z-transform of (s+a)/ ((s+a)^2 + b^2) is (1 - z^(- 2)*e^(-aT)*cos(b*T) ) / (1 - z^(-1)*e^(-aT)*cos(b*T) + z^(-2)*e^(-2*a*T) )
T is 1/fs, our sample rate
z-transform of 1/((s+a)^2 + b^2) is
1/b * z^(-1) * e^(-aT)*sin(b*T) / (1 - z^(-1)*e^(-aT)*cos(b*T) + z^(-2)*e^(-2*a*T) )
so, s/ ((s+a)^2 + b^2) is
(1 - a/b * z^(-1) * e^(-aT)*sin(b*T) - z^(- 2)*e^(-aT)*cos(b*T) ) / (1 - z^(-1)*e^(-aT)*cos(b*T) + z^(-2)*e^(-2*a*T) )
In our case, a=0.5*c/m and b=0.5*sqrt( abs((c/m)^2 - 4k/m ))
and our biquad coefficients are: ff1=1 ff2= -a/b*e^(-aT)*sin(b*T) ff3= -e^(-aT)*cos(b*T) fb1=e^(-aT)*cos(b*T) fb2=-e^(-2*a*T)
I've put together a little patch, calculator and example biquad. This took a little more time than I expected, and I'm running out of steam here. Try it out, and see if it's what you had in mind.
There are two more cases to cover, but this is probably the one you want. I may come back to this later....
Chuck
On Sat, Mar 15, 2008 at 3:09 PM, marius schebella marius.schebella@gmail.com wrote:
yes, I was talking about an external called msd. I am not sure if biquad~ or fexpr~ can help. Is it possible to create harmonic sounds by sending impulses into a biquad~? that would really help. right now I am playing with msd in a block~ 1 subpatch, which is not very efficient. marius.
Charles Henry wrote:
Are you talking about some kind of mass, spring, damper equation?
We could write such a thing with just a biquad~ or fexpr~, if that makes life easier. It's just a little bit of math.
Chuck
On Sat, Mar 15, 2008 at 1:32 PM, marius schebella marius.schebella@gmail.com wrote:
hi, is someone working on msd? I wonder why it is not possible to change the mass of a mass dynamically with something like [setMass m1 1.5( is this function not supported because it is not possible, or just because it was not implemented yet. marius.
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
You're a hero Chuck. This tallys well with the equations in Perrys book. What I was missing is the step where you get the transfer function.
I made (attached) a little test rig. What isn't looking right is the underdamped behaviour. I was expecting to see a decaying oscillation around the top point. Maybe my test has errors.
a.
On Sat, 15 Mar 2008 19:16:29 -0500 "Charles Henry" czhenry@gmail.com wrote:
Note, when c goes to 0, we get a harmonic oscillator at angular frequency w=k/m rad/sec, which is correct. When we increase the damping, we get terms of e^(-0.5*c/m*t) which damps the solution.
made a typo here:
angular frequency w=sqrt(k/m) rad/sec and f=sqrt(k/m)/2pi Hz
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
one more. not at all cpu-friendly but a real msd. m.
Andy Farnell wrote:
You're a hero Chuck. This tallys well with the equations in Perrys book. What I was missing is the step where you get the transfer function.
I made (attached) a little test rig. What isn't looking right is the underdamped behaviour. I was expecting to see a decaying oscillation around the top point. Maybe my test has errors.
a.
On Sat, 15 Mar 2008 19:16:29 -0500 "Charles Henry" czhenry@gmail.com wrote:
Note, when c goes to 0, we get a harmonic oscillator at angular frequency w=k/m rad/sec, which is correct. When we increase the damping, we get terms of e^(-0.5*c/m*t) which damps the solution.
made a typo here:
angular frequency w=sqrt(k/m) rad/sec and f=sqrt(k/m)/2pi Hz
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
#N canvas 114 22 1068 663 10; #X obj 209 212 cnv 15 100 40 empty empty empty 20 12 0 14 -96960 -66577 0; #X obj 334 211 cnv 15 100 40 empty empty empty 20 12 0 14 -96960 -66577 0; #X obj 458 212 cnv 15 100 40 empty empty empty 20 12 0 14 -96960 -66577 0; #N canvas 335 49 771 605 subb 0; #X obj 86 308 msd; #X obj 156 558 outlet~; #X obj 86 351 unpack; #X obj 401 48 inlet; #X msg 59 283 bang , get massesPos 1; #X obj 86 329 route massesPosNo; #X msg 370 213 forceX 1 $1; #X obj 370 142 moses 20; #X obj 370 164 * 0.05; #X floatatom 478 65 5 0 0 0 - - -; #X obj 478 118 /; #X msg 478 96 1; #X obj 478 44 inlet; #X obj 571 44 inlet; #X obj 86 258 spigot; #X obj 370 272 spigot; #X floatatom 133 256 5 0 0 0 - - -; #X obj 119 234 r $0-frommet; #X floatatom 423 265 5 0 0 0 - - -; #X obj 403 239 r $0-fromnoi; #X obj 232 350 0; #X msg 247 327 0; #X obj 178 415 tabwrite $0-bu; #X obj 232 372 t f f; #X obj 232 392 + 1; #X obj 179 436 table $0-bu 64; #X obj 676 36 block~ 1; #X text 309 386 hack hack hack...; #X obj 370 122 random 10000; #N canvas 166 43 493 434 bang-64-sub 0; #X obj 94 77 bang~; #X obj 94 229 delay 0.0226757; #X obj 56 278 outlet; #X obj 272 274 outlet; #X obj 94 149 t b b b; #X obj 196 229 bang; #X msg 113 172 stop; #X connect 0 0 4 0; #X connect 1 0 5 0; #X connect 1 0 2 0; #X connect 4 0 2 0; #X connect 4 0 1 0; #X connect 4 1 6 0; #X connect 4 2 3 0; #X connect 5 0 1 0; #X connect 6 0 1 0; #X restore 59 26 pd bang-64-sub; #X obj 156 536 tabread~ $0-bu; #X obj 156 494 phasor~ 689.062; #X msg 243 472 0; #X obj 156 514 *~ 64; #X obj 86 211 inlet; #X floatatom 570 71 5 0 0 0 - - -; #X obj 370 187 * 0.01; #X connect 0 0 5 0; #X connect 2 1 22 0; #X connect 3 0 0 0; #X connect 4 0 0 0; #X connect 5 0 2 0; #X connect 6 0 15 0; #X connect 7 0 8 0; #X connect 8 0 36 0; #X connect 9 0 7 1; #X connect 9 0 10 1; #X connect 9 0 11 0; #X connect 10 0 8 1; #X connect 11 0 10 0; #X connect 12 0 9 0; #X connect 13 0 35 0; #X connect 13 0 36 1; #X connect 14 0 0 0; #X connect 15 0 0 0; #X connect 17 0 14 1; #X connect 17 0 16 0; #X connect 19 0 15 1; #X connect 19 0 18 0; #X connect 20 0 23 0; #X connect 21 0 20 1; #X connect 23 0 24 0; #X connect 23 1 22 1; #X connect 24 0 20 1; #X connect 28 0 7 0; #X connect 29 0 4 0; #X connect 29 0 20 0; #X connect 29 0 28 0; #X connect 29 1 21 0; #X connect 29 1 32 0; #X connect 30 0 1 0; #X connect 31 0 33 0; #X connect 32 0 31 1; #X connect 33 0 30 0; #X connect 34 0 14 0; #X connect 36 0 6 0; #X restore 101 461 pd subb; #X obj 102 559 dac~; #X obj 101 110 metro 400; #X obj 101 88 tgl 15 0 $0-frommet $0-tomet empty 17 7 0 10 -262144 -1 -1 0 1; #X msg 101 408 forceX 1 $1; #X floatatom 136 384 5 0 0 0 - - -; #X floatatom 153 87 5 0 0 0 - - -; #X msg 221 394 setK l $1; #X text 463 209 change damping; #X msg 244 420 setD l $1; #X obj 204 338 pack 1 1 0; #X text 336 209 change rigidity; #X text 228 184 ~ 1; #X text 605 217 (rigidity + damping together should not exceed double of mass...); #X text 180 531 can get very loud otherwise..; #X text 360 185 keep low , maybe 0.2; #X obj 614 335 hsl 151 15 0 1000 0 0 empty $0-noise empty -2 -8 0 10 -262144 -1 -1 4300 1; #X obj 614 358 hsl 151 15 0 1 0 0 empty $0-amount empty -2 -8 0 10 -262144 -1 -1 250 1; #X text 775 333 noise; #X text 775 353 amount of force; #N canvas 125 455 583 331 presets 0; #X obj 70 197 s $0-rigidity; #X obj 80 217 s $0-damping; #X obj 100 237 s $0-noise; #X obj 110 257 s $0-amount; #X obj 60 177 s $0-mass; #X obj 332 94 r $0-frommet; #X obj 422 95 r $0-fromnoi; #X obj 332 114 sel 1; #X obj 422 114 sel 1; #X msg 332 135 0; #X obj 332 160 s $0-tonoi; #X msg 422 135 0; #X obj 422 160 s $0-tomet; #X obj 60 147 unpack 0 0 0 0 0 0; #X obj 187 177 sel 1; #X msg 187 198 1; #X obj 251 232 s $0-tonoi; #X obj 185 232 s $0-tomet; #X msg 218 198 1; #X obj 77 26 inlet; #X obj 77 47 sel 0 1 2; #X msg 77 76 1 100 30 0 0 1; #X msg 94 101 1 25 30 60 0.05 0; #X msg 110 124 1 400 30 700 0.07 0; #X connect 5 0 7 0; #X connect 6 0 8 0; #X connect 7 0 9 0; #X connect 8 0 11 0; #X connect 9 0 10 0; #X connect 11 0 12 0; #X connect 13 0 4 0; #X connect 13 1 0 0; #X connect 13 2 1 0; #X connect 13 3 2 0; #X connect 13 4 3 0; #X connect 13 5 14 0; #X connect 14 0 15 0; #X connect 14 1 18 0; #X connect 15 0 7 0; #X connect 15 0 17 0; #X connect 18 0 8 0; #X connect 18 0 16 0; #X connect 19 0 20 0; #X connect 20 0 21 0; #X connect 20 1 22 0; #X connect 20 2 23 0; #X connect 21 0 13 0; #X connect 22 0 13 0; #X connect 23 0 13 0; #X restore 614 167 pd presets; #X obj 215 232 nbx 5 14 -1e+37 1e+37 0 0 empty $0-mass empty 0 -8 0 10 -262144 -1 -1 4.78 256; #X text 215 209 change mass; #X obj 345 232 nbx 5 14 -1e+37 1e+37 0 0 empty $0-rigidity empty 0 -8 0 10 -262144 -1 -1 1502 256; #X obj 475 232 nbx 5 14 -1e+37 1e+37 0 0 empty $0-damping empty 0 -8 0 10 -262144 -1 -1 1.11 256; #X obj 611 308 tgl 15 0 $0-fromnoi $0-tonoi empty 17 7 0 10 -262144 -1 -1 1 1; #X text 633 306 use noise instead of metro; #X msg 204 364 reset , mass m0 0 $1 0 , mass m1 1 $1 0 , link l 0 1 $2 $3; #X obj 541 487 dsp~; #X floatatom 541 512 5 0 0 0 - - -; #X obj 475 256 * 0.0001; #X obj 345 255 * 1e-05; #X obj 614 148 hradio 15 1 0 3 empty empty empty 0 -8 0 10 -262144 -1 -1 2; #X obj 101 388 1; #X connect 3 0 4 0; #X connect 3 0 4 1; #X connect 5 0 36 0; #X connect 6 0 5 0; #X connect 7 0 3 0; #X connect 8 0 36 1; #X connect 9 0 5 1; #X connect 10 0 3 1; #X connect 12 0 3 1; #X connect 13 0 30 0; #X connect 19 0 3 2; #X connect 20 0 3 3; #X connect 24 0 13 0; #X connect 26 0 34 0; #X connect 27 0 33 0; #X connect 30 0 3 1; #X connect 31 0 32 0; #X connect 33 0 12 0; #X connect 33 0 13 2; #X connect 34 0 13 1; #X connect 34 0 10 0; #X connect 35 0 23 0; #X connect 36 0 7 0;
hello, sorry, i don't have time, i'm not at home. so it's a short answer.
I try 2 other way to use msd as an audio generator. it's not very efficient either.
i think it should not be very difficult to make a msd~ external. anyway, for this aplication, pmpd~ external should be easier to use.
there is no message to change the mass in msd, because equations are linear. i.e mass=1, K=0.1, D=0.1, F=0.1 is the same than mass=10, K=1,D=1,F=1:
++ c marius schebella a écrit :
one more. not at all cpu-friendly but a real msd. m.
Andy Farnell wrote:
You're a hero Chuck. This tallys well with the equations in Perrys book. What I was missing is the step where you get the transfer function.
I made (attached) a little test rig. What isn't looking right is the underdamped behaviour. I was expecting to see a decaying oscillation around the top point. Maybe my test has errors.
a.
On Sat, 15 Mar 2008 19:16:29 -0500 "Charles Henry" czhenry@gmail.com wrote:
Note, when c goes to 0, we get a harmonic oscillator at angular frequency w=k/m rad/sec, which is correct. When we increase the damping, we get terms of e^(-0.5*c/m*t) which damps the solution.
made a typo here:
angular frequency w=sqrt(k/m) rad/sec and f=sqrt(k/m)/2pi Hz
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
i think it should not be very difficult to make a msd~ external.
anyway, for this aplication, pmpd~ external should be easier to use.
I thought about it as well... i think it's fairly easy and can be made
to be quite efficient - the only drawback is that one is limited with
the number of parameters that can be controlled or monitored through
signal inlets and outlets.
gr~~~
maybe it is possible to have signal inlets for all parameters and not use messages? because I don't know how to address particular masses or links without messages. but that would mean several inlets for every mass and link and that is kind of difficult. I don't see how this could be done?? marius.
Thomas Grill wrote:
i think it should not be very difficult to make a msd~ external. anyway, for this aplication, pmpd~ external should be easier to use.
I thought about it as well... i think it's fairly easy and can be made to be quite efficient - the only drawback is that one is limited with the number of parameters that can be controlled or monitored through signal inlets and outlets.
gr~~~
marius schebella a écrit :
maybe it is possible to have signal inlets for all parameters and not use messages? because I don't know how to address particular masses or links without messages. but that would mean several inlets for every mass and link and that is kind of difficult. I don't see how this could be done??
what's the problem with pmpd~ way to do this? more messages can be add (in_K, in_D) to connect audio inlet to a physical parametter, but i don't know if it's really important do change K/D/M with audio inlet : this can be dangerous.
cyrille
marius.
Thomas Grill wrote:
i think it should not be very difficult to make a msd~ external. anyway, for this aplication, pmpd~ external should be easier to use.
I thought about it as well... i think it's fairly easy and can be made to be quite efficient - the only drawback is that one is limited with the number of parameters that can be controlled or monitored through signal inlets and outlets.
gr~~~
thanks, cyrille, I did not know unpack~. also using "until" to loop 64 times at once (in the same logical time) is much easier coding. and since one vector of 64 samples is always seen as one unit, this should not make a difference in cpu load distribution. did you experience a performance difference between the unpack~ and the tabplay~ solution? marius.
cyrille henry wrote:
hello, sorry, i don't have time, i'm not at home. so it's a short answer.
I try 2 other way to use msd as an audio generator. it's not very efficient either.
i think it should not be very difficult to make a msd~ external. anyway, for this aplication, pmpd~ external should be easier to use.
there is no message to change the mass in msd, because equations are linear. i.e mass=1, K=0.1, D=0.1, F=0.1 is the same than mass=10, K=1,D=1,F=1:
++ c marius schebella a écrit :
one more. not at all cpu-friendly but a real msd. m.
Andy Farnell wrote:
You're a hero Chuck. This tallys well with the equations in Perrys book. What I was missing is the step where you get the transfer function.
I made (attached) a little test rig. What isn't looking right is the underdamped behaviour. I was expecting to see a decaying oscillation around the top point. Maybe my test has errors.
a.
On Sat, 15 Mar 2008 19:16:29 -0500 "Charles Henry" czhenry@gmail.com wrote:
Note, when c goes to 0, we get a harmonic oscillator at angular frequency w=k/m rad/sec, which is correct. When we increase the damping, we get terms of e^(-0.5*c/m*t) which damps the solution.
made a typo here:
angular frequency w=sqrt(k/m) rad/sec and f=sqrt(k/m)/2pi Hz
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
marius schebella a écrit :
thanks, cyrille, I did not know unpack~. also using "until" to loop 64 times at once (in the same logical time) is much easier coding. and since one vector of 64 samples is always seen as one unit, this should not make a difference in cpu load distribution. did you experience a performance difference between the unpack~ and the tabplay~ solution?
i was expecting a deference, but i did not see one. both are 10 (or more) time slower than pmpd~ for the same physical model.
cyrille
marius.
cyrille henry wrote:
hello, sorry, i don't have time, i'm not at home. so it's a short answer.
I try 2 other way to use msd as an audio generator. it's not very efficient either.
i think it should not be very difficult to make a msd~ external. anyway, for this aplication, pmpd~ external should be easier to use.
there is no message to change the mass in msd, because equations are linear. i.e mass=1, K=0.1, D=0.1, F=0.1 is the same than mass=10, K=1,D=1,F=1:
++ c marius schebella a écrit :
one more. not at all cpu-friendly but a real msd. m.
Andy Farnell wrote:
You're a hero Chuck. This tallys well with the equations in Perrys book. What I was missing is the step where you get the transfer function.
I made (attached) a little test rig. What isn't looking right is the underdamped behaviour. I was expecting to see a decaying oscillation around the top point. Maybe my test has errors.
a.
On Sat, 15 Mar 2008 19:16:29 -0500 "Charles Henry" czhenry@gmail.com wrote:
Note, when c goes to 0, we get a harmonic oscillator at angular frequency w=k/m rad/sec, which is correct. When we increase the damping, we get terms of e^(-0.5*c/m*t) which damps the solution.
made a typo here:
angular frequency w=sqrt(k/m) rad/sec and f=sqrt(k/m)/2pi Hz
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
wow, thanks chuck and andy, I had a much more practical approach, do the theory afterwards. the problem is only that I found out that bang~ is not working for blocksizes <=64, so I cannot trigger the msd (will write another mail for that.) which means the msd patch is broken. (attached). m.
Charles Henry wrote:
I have forgotten some things here. That's why it took so long, but I think I've got it mostly right.
There are two type of mass spring systems, depending on what kind of input you have.
force-driven: such as a loudspeaker--the coil induces a force on a permanent magent.
velocity driven: a crankshat-piston assembly--rotates with a fixed speed;classic problems for vibration isolation.
but I'm only going to cover the first one here.
these two type of inputs are similar to electronic circuits: a voltage source (force) and a current source (velocity)
so, a mechanical circuit would look like:
|-----(M)---(S)----(D)---| (F) | |----------------------------|
all in series
Suppose our output is the velocity.
F=m*a (the force on a mass is in the same direction as its acceleration) F=c*v (the damping force is in the opposite direction of velocity) F=k*d (the spring force is in opposite direction of displacement)
F(t)=m*dv/dt + c*v + k*integral(t0 to t, v*dt) Laplace transform: F(s)=(m*s+c+k/s)*V(s)
And the transfer function:
F(s) 1/k*s ------ = -------------------------------------- V(s) (m/k)*s^2 + (c/k)*s + 1
And there are three cases: underdamped, critically damped, and over damped (I'm not sure how to do the z-transform for a critically damped system, but I think we can figure it out).
poles: -0.5*c/m +/- 0.5*sqrt( (c/m)^2 - 4k/m ) zero: 0
Note, when c goes to 0, we get a harmonic oscillator at angular frequency w=k/m rad/sec, which is correct. When we increase the damping, we get terms of e^(-0.5*c/m*t) which damps the solution.
Under-damped case (the resonant system): (c/m)^2 - 4k/m < 0
I'm reluctant to try to use a bi-linear tranform, here. I'd like to look it up in a table! I've worked through these problems before, but I can't remember what you do differently with the numerator... I think it indicates a mixture of sines/cosines.
z-transform of (s+a)/ ((s+a)^2 + b^2) is (1 - z^(- 2)*e^(-aT)*cos(b*T) ) / (1 - z^(-1)*e^(-aT)*cos(b*T) + z^(-2)*e^(-2*a*T) )
T is 1/fs, our sample rate
z-transform of 1/((s+a)^2 + b^2) is
1/b * z^(-1) * e^(-aT)*sin(b*T) / (1 - z^(-1)*e^(-aT)*cos(b*T) + z^(-2)*e^(-2*a*T) )
so, s/ ((s+a)^2 + b^2) is
(1 - a/b * z^(-1) * e^(-aT)*sin(b*T) - z^(- 2)*e^(-aT)*cos(b*T) ) / (1 - z^(-1)*e^(-aT)*cos(b*T) + z^(-2)*e^(-2*a*T) )
In our case, a=0.5*c/m and b=0.5*sqrt( abs((c/m)^2 - 4k/m ))
and our biquad coefficients are: ff1=1 ff2= -a/b*e^(-aT)*sin(b*T) ff3= -e^(-aT)*cos(b*T) fb1=e^(-aT)*cos(b*T) fb2=-e^(-2*a*T)
I've put together a little patch, calculator and example biquad. This took a little more time than I expected, and I'm running out of steam here. Try it out, and see if it's what you had in mind.
There are two more cases to cover, but this is probably the one you want. I may come back to this later....
Chuck
On Sat, Mar 15, 2008 at 3:09 PM, marius schebella marius.schebella@gmail.com wrote:
yes, I was talking about an external called msd. I am not sure if biquad~ or fexpr~ can help. Is it possible to create harmonic sounds by sending impulses into a biquad~? that would really help. right now I am playing with msd in a block~ 1 subpatch, which is not very efficient. marius.
Charles Henry wrote:
Are you talking about some kind of mass, spring, damper equation?
We could write such a thing with just a biquad~ or fexpr~, if that makes life easier. It's just a little bit of math.
Chuck
On Sat, Mar 15, 2008 at 1:32 PM, marius schebella marius.schebella@gmail.com wrote:
hi, is someone working on msd? I wonder why it is not possible to change the mass of a mass dynamically with something like [setMass m1 1.5( is this function not supported because it is not possible, or just because it was not implemented yet. marius.
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
I would be interested to see an example of that Chuck
Assuming Marius and I fairly understand LTIs, how would we end up with coefficients for Biquad starting with units like mass, Youngs modulus etc?
And biquads are quite efficient, so if we had a little helper abstraction that calculated an MSD type behaviour that would be very nice.
If I remember the msd externals are bit hungry.
On Sat, 15 Mar 2008 14:20:56 -0500 "Charles Henry" czhenry@gmail.com wrote:
Are you talking about some kind of mass, spring, damper equation?
We could write such a thing with just a biquad~ or fexpr~, if that makes life easier. It's just a little bit of math.
Chuck
On Sat, Mar 15, 2008 at 1:32 PM, marius schebella marius.schebella@gmail.com wrote:
hi, is someone working on msd? I wonder why it is not possible to change the mass of a mass dynamically with something like [setMass m1 1.5( is this function not supported because it is not possible, or just because it was not implemented yet. marius.
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
ok, I can create some nice sounds with biquad~ and fexpr~, but with biquad~ I still have the problem, that I cannot change the settings dynamically. otoh fexpr~ might be a solution. uhmm, andy, I do *not* (yet?) fairly understand the maths behind that. I kind of avoided biquad~ and filters, I guess it's now or never. marius.
Charles Henry wrote:
Are you talking about some kind of mass, spring, damper equation?
We could write such a thing with just a biquad~ or fexpr~, if that makes life easier. It's just a little bit of math.
Chuck
On Sat, Mar 15, 2008 at 1:32 PM, marius schebella marius.schebella@gmail.com wrote:
hi, is someone working on msd? I wonder why it is not possible to change the mass of a mass dynamically with something like [setMass m1 1.5( is this function not supported because it is not possible, or just because it was not implemented yet. marius.
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hi marius and others,
Adding the setM function should not be difficult. I've no time to do that at the moment, but if someone with a cvs access wants to add it feel free to do so.
Otherwise, I could do it in a few days. I'll keep you aware of the evolution.
Greetings,
Nicolas
marius schebella a écrit :
hi, is someone working on msd? I wonder why it is not possible to change the mass of a mass dynamically with something like [setMass m1 1.5( is this function not supported because it is not possible, or just because it was not implemented yet. marius.
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hi,
I've added a "setM" function as you wanted. It works as the "setD" function. The new sources are on svn.
Greetings,
Nicolas
marius schebella a écrit :
hi, is someone working on msd? I wonder why it is not possible to change the mass of a mass dynamically with something like [setMass m1 1.5( is this function not supported because it is not possible, or just because it was not implemented yet. marius.
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list