# How do I convert this simple Laplace equation to Z-domain?

A basic model of coupled strings (eg. piano) is provided in DSP Related - JULIUS O. SMITH III - PHYSICAL AUDIO SIGNAL PROCESSING - FOR VIRTUAL MUSICAL INSTRUMENTS AND AUDIO EFFECTS- Two Coupled Strings as:

The principle is that it has two identical string simulations each formed by a delay line and LPF. The outputs of these are summed at the "bridge" in the center. The sum is multiplied by $$-H_b(s)$$ to get the bridge output, which is then subtracted from each of the string loops to simulate damping from energy lost to the bridge.

The bridge equations are:

$$V_b(s) = H_b(s) \big( V_1^+(s) + V_2^+(s) \big)$$

$$H_b(s) \triangleq \frac{2}{2+ R_b(s)/R}$$

Where $$R_b(s)$$ is the impedance of the bridge and $$R$$ is the impedance of the string.

So in order to implement this, I need to convert $$H_b(s)$$ (and/or $$V_b(s)$$) from a Laplace equation to a Z-domain equation.

I am starting to understand some of the principles of the Laplace and Z-domain but I have never converted anything before and I am not sure how to do this. How I get $$H_b(z)$$ for this usage?

Once I have $$H_b(z)$$, do I just multiply it by the sums of the two string outputs and then subtract that result from the string loops?

Also, why is the impedance of the string simply $$R$$ while the impedance of the bridge is $$R_b(s)$$? Is impedance of the bridge a Laplace function to imply that its impedance may vary with frequency? (Whereas the string impedance would be frequency independent.) If so, how might it simplify things to treat the bridge impedance as frequency independent too?

• Yes it implies it varies with frequency. You would need to have the specific transfer function as a function of s and then you can convert to z using different mapping techniques such as impulse invariance or the billinear transform. I am pretty sure there are other posts here that detail those two options. Nov 30 '19 at 17:22
• Thanks Dan. You helped me previously on this as well and I appreciate it. Let's say I don't want $Rb(s)$ to vary with frequency. ie. It is just a simple constant impedance like the string impedance is. How do I then create the z-transform? $Hb(s)$ will simply be a constant. How do you convert a constant to a z-transform?
– mike
Nov 30 '19 at 17:26
• Nothing would be needed in that case: consider a constant value in time in the continuous time domain, no matter how fast you sample it, you still get the constant value. The transform is only needed when your function has a frequency dependence (a function of a). H(s)= 5 is not a function of s in that regard (no dependance on a) Nov 30 '19 at 17:28
• But this brings back to the question I was asking in the previous thread: If $H(s)$ is 0.001 for example, and in this system, for every sample, you are taking the sum of the string outputs and multiplying them by 0.001, then subtracting this value from the string loops, doesn't sampling rate affect the result? Ie. If you are sampling at 96 kHz won't you perform the subtraction twice as often as if you are sampling at 48 kHz and won't that create twice as rapid damping?
– mike
Nov 30 '19 at 17:31
• Yes certainly and that would come from the translation to digital or the entire system (so in that regard there should be a scaling by T in that loop once the whole thing is digital but that is not from the translation of Hb(s) If it is constant but the translation of the larger system Nov 30 '19 at 17:34

I believe, mike, that the answer to your question is likely the Bilinear Transform. Make sure you identify the significant frequency (likely the resonant frequency of the LPF1 and LPF2 or $$H_b(s)$$ and apply prewarping to that frequency, so that the digital filter hits at the same place that the analog filter. Remember the transfer functions of the two delay lines are $$z^{-N_1}$$ and $$z^{-N_2}$$. Or, in the s-domain $$e^{-N_1sT}$$ and $$e^{-N_2sT}$$ , where $$T$$ is the sampling period or the reciprocal of the sample rate.

• Thanks Robert. I am first trying to simulate the simplest case and still struggling to be sure I am getting it right. Let's say $Rb(s)$ (the bridge impedance) is a constant = 50, and the string impedance $R$ is a constant = 1. $Hb(s)$ will equal a constant value of 0.03846. What should $Hb(z)$ then be based on a given sample rate? Is it just $Hb(s) / sampleRate$ in this case?
– mike
Nov 30 '19 at 20:45

The answer was there is no need to incorporate sample rate at all. Since I am using the simple case where Hb(s) is a constant, I just had to multiply that against the summed samples and subtract the result from both delay lines. It works irrespective of sample rate. I tried it with sampling at 11 kHz and 96 kHz and it sounds the same.

I don't really understand why. I would have thought if I was subtracting a percent of the sum every sample from the loops, then I would be subtracting it more often at higher sampling and thus damping the loops faster, but it doesn't seem to work this way. It's somehow all completely sample rate independent in this simple case.

Anyway thanks for all answers. I learned a lot about Laplace, etc. which I needed to know anyway. It's still been educational.

• I don’t think that is correct—- it may sound the same but perhaps the damping is not having a big impact on the sound? Have you actually reviewed the simulated results versus time to convince yourself otherwise? Dec 2 '19 at 21:05
• I am pretty sure it is correct. It can be verified. I found experimentally that if I feedback a resonating bandpass with say 0.003 times its output subtracted each sample, this functions identically to feeding it back without the subtraction while adding 1/0.003 to the Q of that bandpass (ie. 333 added to Q), where the Qdamp is added as 1/Qfinal= 1/Qprimary + 1/Qdamp. I don't understand this relationship but I found it 100% experimentally and it seems solid, which proves it is sample rate independent, as Q's are sample rate independent as well. Funny but neat as well.
– mike
Dec 4 '19 at 8:03
• Ah interesting- I thought your feedback term was a constant but you are describing it as a bandpass which is a frequency dependent element. Is your bandpass a discrete (power of z) element and if so how are you normalizing that to be sampling rate independent? Perhaps you are getting a nice cancellation buried in that math. Dec 4 '19 at 13:24
• I am doing nothing at all except in the feedback version input_to_bandpass = exciter - (output_z_1*constant_0_1). In the nonfeedback version input is just excited and I am just adding to the Qfinal as 1/Qfinal = 1/Qprimary + 1/(1/constant_0_1). Somehow these both give the exact same result. I'm not sure why but I am doing nothing specific with sample rate in either case.
– mike
Dec 4 '19 at 16:19
• Your bandpass resonator is a discrete model expressed in powers of z? Dec 4 '19 at 19:17