<<

Proc. of the 11th Int. Conference on Effects (DAFx-08), Espoo, Finland, September 1-4, 2008

DIGITAL SIMULATION OF THE RING MODULATOR FOR MUSICAL APPLICATIONS

Richard Hoffmann-Burchardi Institut für Musikwissenschaft Hochschule für Musik Karlsruhe, Germany [email protected]

ABSTRACT Modulator Output In this article, a model of the diode ring modulator is devel- oped, which is based on a model from the literature, but modified to suit musical applications. After a brief introduction to analog ring , a substitute circuit for the diode ring modulator is presented and analyzed, leading to a system of ordinary differ- Carrier ential equations (ODEs) of first order. The equations are solved by using Euler’s method. The model is compared with a real ring Figure 1: Working principle of a ring modulator. modulator using the same input , showing a good match between the simulation and the real device.

2. MODEL OF THE RING MODULATOR 1. INTRODUCTION 2.1. Circuit description An audio effect which can be found in many of today’s digital audio workstations (DAWs) and is the ring modula- The diode ring modulator circuit is shown in Fig. 2. It consists tor. Originally used for transmission, ring modulators first became of four and two center-tapped . The basic idea popular in music in the early 1970s, when Stockhausen based sev- behind the circuit is that when the carrier voltage u is positive, eral of his works around the effect. C diodes D and D are conductant while D and D block [1] [2]. A ring modulator multiplies two waveforms, called carrier 1 2 3 4 When the carrier voltage u is negative, D and D are conduc- and modulator (Fig. 1). The resulting contains the sums C 3 4 tant while D and D block. This is due to the carrier, which and differences of the two , also known as the 1 2 is connected to the center taps of both transformers — the same upper and lower sideband. This follows directly from the trigono- carrier current flows through both diode pairs. Additionally this metric identity: causes the carrier currents to cancel out each other at the second , leaving only the desired modulation product at the 1 sin(f )sin(f ) = (cos(f + f ) − cos(f − f )) (1) output. M C 2 M C M C

Analog is typically implemented by using . 1:1 1:1 The carrier switches the polarity of the modulator. If the switching elements were ideal, this would only work for rectangu- D D1 lar carrier waveforms. However in practice the switching elements 4 (diodes, transistors) are not ideal. The V-I characteristic of silicon uM u diodes, for instance, follows an exponential law. Thus, arbitrary D A carrier waveforms may be used. The resultant signal will however 2 contain nonlinear distortions. In general the frequencies D3

fO = | ± nfM ± mfC | n, m = 0, 1, 2, 3... (2)

may appear at the output. The even and odd order distortion products introduced are the main difference between analog ring modulation and a digital multiplication of two signals in the time uC domain. Ring modulators are typically built either as active networks Figure 2: Ring modulator circuit. using transistors as switching elements, or as passive networks us- ing diodes. This article will focus on the latter.

DAFX-1 Proc. of the 11th Int. Conference on Digital Audio Effects (DAFx-08), Espoo, Finland, September 1-4, 2008

u4 RM u u i i 1 2 2 1 2 u 2 L C 7 u C L RA m(t) 6 u u1 2 u1 u2 2 2

u5

Ri

Cp c(t)

u3

Figure 3: Substitute circuit for the diode ring modulator.

−9 −9 2.2. Substitute circuit and analysis Technical parameters are C = 10e F , Cp = 10e F , L = 0.8H, RA = 600Ω, Ri = 50Ω and RM = 80Ω. The diode The model proposed in this paper is a modified version of the function g is a nonlinear function of the voltages across the diodes, Horneber model [3]. The original design leads to 15 differential hence the system is nonlinear. The inputs are given by the carrier equations, mainly due to the transformer model used. The simpli- signal c(t) and the modulator signal m(t). The output signal is fied substitute circuit suggested here is given in Fig. 3. It consists determined by u . C 2 of ideal transformers connected in parallel with a capacitance The original model by Horneber also simulates the leakage L and inductance . Together, they form a nonideal transformer. flux in the transformers. However, this affects only high frequen- The four diodes are replaced by voltage controlled resistors. The cies [4]. Measurements on audio transformers indicate that they C R R capacitance p is used to regularize the model. M and i are fall outside the audible range and thus need not be modelled. An- R source resistances, A is the load resistance. From Kirchhoff’s other issue is that additional artificial capacitances are needed to current law (KCL) a system of 5 ordinary differential equations of obtain explicit differential equations, greatly increasing the numer- first order is obtained: ical problems when attempting to simulate the design [5] [6] [7]. du g(u ) g(u ) g(u ) g(u ) C 1 = i − 4 + 7 + 5 − 6 dt 1 2 2 2 2 2.3. Diode model u − m(t) − 1 (3) A suitable function g is required to model the diode behavior. Real R M ring modulators use germanium diodes due to their soft slopes and du2 g(u4) g(u6) g(u5) g(u7) C = i2 + − − + fast turn-on. The V-I characteristic of germanium diodes, when dt 2 2 2 2 biased forward at a small voltage, can be well approximated by a u − 2 (4) polynomial. At reverse bias, the voltage may be set to zero. The RA following equation approximates a 1N270 germanium diode at low du3 u3 voltages (x is given in Volt, g(x) in Ampere): Cp = g(u4) + g(u5) − g(u6) − g(u7) − (5) dt Ri  4 di 0.17x if x > 0 L 1 = −u (6) g(x) = dt 1 0 if x ≤ 0 di Using silicon diode models will not work. Since the bias point of L 2 = −u (7) dt 2 the diodes is at 0V , this causes the carrier waveform to ’squash’ the modulator waveform near its zero crossings, creating harsh dis- The voltages across the diodes can be derived from Kirch- tortions at the output. It is possible, however, to shift the bias point hoff’s voltage law (KVL): of the diodes to a steeper region of the exponential curve. This is u1 u2 simply accomplished by adding a constant to the voltage applied u = − u − c(t) − (8) 4 2 3 2 to the diode. Using the model from [3] for a 1N4448 silicon diode u1 u2 300mV u = − − u − c(t) + (9) and adding a constant voltage of results in 5 2 3 2 u u g(x) = 40.67286402e−9(e17.7493332(x+0.3) − 1) u = 1 + u + c(t) + 2 (10) 6 2 3 2 Both diode models yield good results in practice. Fig. 4 shows u1 u2 u7 = − + u3 + c(t) − (11) the V-I diagram of both functions. 2 2

DAFX-2 Proc. of the 11th Int. Conference on Digital Audio Effects (DAFx-08), Espoo, Finland, September 1-4, 2008

ODE is the Forward Euler method. Applying it to Eq. 3 to 7 yields Silicon T g(u ) g(u ) Germanium u (n) = u (n − 1) + (i (n − 1) − 4 + 7 1 1 C 1 2 2 g(u ) g(u ) u (n − 1) − m(n) 0.2 + 5 − 6 − 1 ) (12) 2 2 RM T g(u ) g(u ) u (n) = u (n − 1) + (i (n − 1) + 4 − 6 2 2 C 2 2 2 g(u5) g(u7) u2(n − 1)

Current (mA) Current − + − ) (13) 0.1 2 2 RA T u3(n) = u3(n − 1) + (g(u4) + g(u5) − g(u6) Cp

u3(n − 1) −g(u7) − ) (14) 0 R -0.2 -0.1 0 0.1 0.2 i T Voltage (V) i (n) = i (n − 1) + (−u (n − 1)) (15) 1 1 L 1 T Figure 4: Diode functions. i (n) = i (n − 1) + (−u (n − 1)) (16) 2 2 L 2 where T is the time interval between samples. Eq. 8-11 remain the 2.4. Transformer model same, except that c(t) is replaced by c(n). The levels of the mod- ulator and carrier signals should be within (−200mV, +200mV ). The inductances L affect the response of the circuit, act- Since the system is stiff, any explicit method such as Forward Eu- ing like a level-dependent high-pass filter. Figure 5 shows the fre- ler requires oversampling to ensure numerical stability. The over- quency response of the circuit, setting the carrier to DC at two sampling factor required depends on the input signals. In general, different levels. Smaller values of L increase the high-pass char- higher signal levels will require a higher oversampling factor. If a acteristic, larger values decrease it. If a linear frequency response low oversampling factor with arbitrary signals is desired, implicit is desired, Eq. 6 and 7 may be removed from the ODE set entirely or semi-implicit methods [9], which possess better numerical sta- and only 3 nonlinear equations need to be solved. bility, must be used to solve the ODEs. However, they are not as easy to implement as explicit methods.

0 10 4. RESULTS AND DISCUSSION Carrier 200mV DC Carrier 100mV DC In order to compare the proposed model with a real ring modu- lator, an electric bass sound was modulated by a sinusoidal car-

-1 rier waveform of 128 Hz. The levels were chosen such that the 10 nonlinear distortions were audible, yet not objectionable. The For- ward Euler method with an oversampling factor of 128 was used to solve the ODEs. The analog ring modulator used consisted of four 1N270 germanium diodes and two Mouser TM018 transformers. Amplitude -2 Fig. 6 shows the time-domain output of the real diode ring mod- 10 ulator. The output of the model is presented in Fig. 7, showing a good match. An even better match would be possible by opti- mizing the model parameters to fit the device under test. However since real ring modulators show an asymmetric behavior (diodes

-3 and transformer coils never match exactly, causing a fraction of

10 0 1 2 3 4 5 the carrier and modulator signals to appear at the output), a perfect 10 10 10 10 10 10 Frequency (Hz) match is not necessarily desirable.

Figure 5: Frequency response at different carrier levels. 5. ACKNOWLEDGMENTS

The author would like to express his gratitude to Prof. Dr. Thomas Troge, Christian Rode and Jouni Airaksinen for their support and valuable comments on this article. 3. DISCRETIZING THE MODEL 6. REFERENCES In order to use the ring modulator model, it must be discretized. Several methods for discretizing ODEs used for audio processing [1] S. Kruse, “Theory of rectifier modulators,” in Ericsson Tech- have been recently discussed in [8]. The easiest way to solve an nics H.2, 1939, pp. 17–54.

DAFX-3 Proc. of the 11th Int. Conference on Digital Audio Effects (DAFx-08), Espoo, Finland, September 1-4, 2008

0.03

0.02

0.01

0

Amplitude (V)Amplitude -0.01

-0.02

-0.03 0 0.005 0.01 0.015 0.02 0.025 Time (s)

Figure 6: Output voltage measured on a real ring modulator.

0.03

0.02

0.01

0

Amplitude (V)Amplitude -0.01

-0.02

-0.03 0 0.005 0.01 0.015 0.02 0.025 Time (s)

Figure 7: Output voltage from the model.

[2] V. Belevitch, “Non-linear effects in ring modulators,” in Wire- ings of NUMDIFF-5 at Halle 1989. Teubner-Texte zur Mathe- less Engineer 26, 1945, p. 177. matik Bd. 121, Leipzig, Germany, 1991, pp. 305–316. [3] E. Horneber, Analyse nichtlinearer RLCÜ-Netzwerke mit [8] D.T. Yeh, J. Abel, and J.O. Smith, “Simulation of the diode Hilfe der gemischten Potentialfunktion mit einer systematis- limiter in guitar distortion circuits by numerical solution of chen Darstellung der Grundlagen der Analyse nichtlinearer ordinary differential equations,” in Proc. Digital Audio Effects dynamischer Netzwerke, PhD thesis, Universität Kaiser- (DAFx-07), Bordeaux, France, Sept. 10-15, 2007, pp. 197– slautern, Germany, 1976. 204. [4] W. M. Flanagan, Handbook of transformer design and appli- [9] E. Hairer and G. Wanner, Solving Ordinary Differential Equa- cations, 2nd edition, McGraw-Hill, New York, USA, 1986. tions II, Springer, Heidelberg, Germany, 1987. [5] M. Günther and P. Rentrop, Numerical Simulation of Electri- cal Circuits, Preprint Nr. 01/01, Universität Karlsruhe, Ger- many, 2001. [6] W. Kampowski, P. Rentrop, and W. Schmidt, “Classifica- tion and numerical simulation of electric circuits,” Surveys on Mathematics for Industry, 2(1):23-65, 1992. [7] G. Denk and P. Rentrop, “Mathematical models in electric cir- cuit simulations and their numerical treatment,” in Proceed-

DAFX-4