Digital Simulation of the Diode Ring Modulator for Musical Applications
Total Page:16
File Type:pdf, Size:1020Kb
Proc. of the 11th Int. Conference on Digital Audio Effects (DAFx-08), Espoo, Finland, September 1-4, 2008 DIGITAL SIMULATION OF THE DIODE 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 modulation, 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 waveforms, 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 synthesizers 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 diodes and two center-tapped transformers. 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 signal contains the sums C 3 4 tant while D and D block. This is due to the carrier, which and differences of the two signals’ frequencies, 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 transformer, 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 ring modulation is typically implemented by using switches. 1:1 1:1 The carrier waveform 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 = j ± nfM ± mfC j 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 frequency 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.