Simulacion de Distorsion Para Guitarra

Embed Size (px)

Citation preview

  • 7/31/2019 Simulacion de Distorsion Para Guitarra

    1/8

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

    SIMULATING GUITAR DISTORTION CIRCUITS USING WAVE DIGITAL ANDNONLINEAR STATE-SPACE FORMULATIONS

    David T. Yeh and Julius O. SmithCenter for Computer Research in Music and Acoustics (CCRMA)

    Stanford University, Stanford, CA[dtyeh|jos]@ccrma.stanford.edu

    ABSTRACT

    This work extends previous research on numerical solution of nonlinear systems in musical acoustics to the realm of nonlinearmusical circuits. Wave digital principles and nonlinear state-spacesimulators provide two alternative approaches explored in thiswork. These methods are used to simulate voltage amplica-tion stages typically used in guitar distortion or amplier circuits.Block level analysis of the entire circuit suggests a strategy basedupon the nonlinear lter composition technique for connectingamplier stages while accounting for the way these stages inter-act. Formulations are given for the bright switch, the diode clipper,a transistor amplier, and a triode amplier.

    1. INTRODUCTION

    This research attempts to model and simulate highly nonlinearcircuits used primarily for electric guitar effects. Such effortsaim to preserve the heritage of circuits whose components, suchas vacuum tubes, or particular vintage transistors, are becoming

    increasingly rare. Circuit schematics and accurate device modelequations can sufciently model circuit behavior. Using thesewith Kirchhoffs Current Law (KCL) and Kirchhoffs VoltageLaw (KVL), one can derive a system of nonlinear equations thataccurately replicates a circuits input-to-output relationship overtime. By exploiting the progress of contemporary digital comput-ing power, modeling vintage circuits based on archives of theircircuit schematics and device characteristics can ensure that theunique sound of these circuits will be available for future genera-tions of musicians.

    Numerical simulation of lumped nonlinear systems has beenstudied extensively in the literature [17]. The musical acousticsor digital audio effects community has developed two prevailingmethods for simulating ordinary differential equations with non-

    linearities based on wave digital principles or directly solving anonlinear state-space system. Both methods have been applied tothe same types of problems in nonlinear musical acoustics and arealso applicable to certain classes of nonlinear circuits used for mu-sical effects.

    This work extends attempts to simulate musical circuits basedupon solving ordinary differential equations [710]. The moti-vation for this work is to investigate block-based modeling tech-niques [11] applied to a more complete simulation of electroniccircuits used in musical effects processing. Circuits naturally di-vide into stages [12] which may interact with adjacent stages, orload them, and are apt for description as a two-way signal owdiagram as in [11]. This work presents examples of how circuitsmay be represented as blocks in such a modeling scheme. Vari-

    a

    b

    a

    R 1 2R

    b

    1 2

    21

    Figure 1: Two-port scattering element denes network blocks us-ing incident wave a , reected wave b, and port impedance R .

    ous schemes exist that account for the mutual interaction betweenblocks [4,11, 13].

    This paper reviews the wave digital formulation for represent-ing circuits as digital lters, and the K-method of computationalmusical acoustics, and then demonstrates the applicability of thesetechniques to circuits in guitar electronics: the bright switch, thediode clipper, a transistor amplier, and a triode amplier.

    2. REVIEW OF METHODS IN COMPUTATIONALMUSICAL ACOUSTICS

    2.1. Wave Digital Formulation

    The wave digital formulation [14] views the linear N-port circuitnetwork as a scattering junction, replacing voltage V and currentI variables that dene a single port by incident A and reected Bwaves, and a port impedance R 0, as depicted in Fig. 1 for atwo-port. Doing so allows instantaneous reections to be elimi-nated by matching port impedances when ports of different blocksare connected together, resulting in a computationally realizablewave digital lter (WDF) structure.

    The variable transformation to the wave domain is

    A = V + RI

    B = V RI (1)and the inverse formulation exists R 0.

    2.1.1. Wave digital elements

    In the wave digital lter, circuit elements such as resistors, capac-itors and inductors become port impedances and delay, if applica-ble, as shown in Tab. 1. They are computed by substituting ( 1)into the Kirchhoff denitions of the elements and computing thereected waves due to the change in impedance from the port tothe element. Usually the port impedance is chosen such that theinstantaneous reection is matched, resulting in a reection-freeport (RFP).

    DAFX-1

    http://ccrma.stanford.edu/http://ccrma.stanford.edu/
  • 7/31/2019 Simulacion de Distorsion Para Guitarra

    2/8

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

    Element Port impedance Reected waveResistor R R p = R b[n ] = 0Capacitor C R p = T / 2C b[n ] = a[n 1]Inductor L R p = 2 L / T b [n ] = a[n 1]Short circuit R p = X b[n] = a[n ]

    Open circuit R p = X b[n] = a[n ]Voltage source V s R p = X b[n] = a[n ] + 2 V sCurrent source I s R p = X b[n] = a[n ] + 2 R p I sTerminated V s R p = R s b[n] = V sTerminated I s R p = R s b[n] = R p I s

    RVs s+

    Terminated V s

    RIs s

    Terminated I s

    Table 1: Wave digital elements: Port impedances and reectedwaves. The last two elements are sources lumped with a resistanceas shown. Elements with unmatched port impedances can be setto any non-negative port impedance Rp = X .

    (a) Parallel

    (b) Series

    Figure 2: Three-port adaptors and corresponding circuit schematic

    2.1.2. Interconnections of elements: wave digital adaptors

    The topology of the circuit is represented by adaptors, whichcompute the scattering among connected ports given their portimpedances. Because connections can often be described in termsof series and parallel electrical arrangements, series and paralleladaptors have been studied in detail and are used for connectingelements in wave digital lters. Parallel and series adaptors in thethree-port case are shown schematically in Fig. 2. The scatteringrelations for elements and adaptors are derived by substituting (1)into the Kirchhoff equations dening the element or adaptor.

    The scattering relations for N-port parallel adaptors are givenby

    =2G

    G1 + G2 + + Gn

    ap = 1 a1 + 2 a2 + + n anb = ap a ,

    where is the scattering parameter for port , = 1 : N , ap isa parallel junction wave variable, and b is the reected wave forport .

    The scattering relations for N-port series adaptors are given by

    =2R

    R 1 + R 2 + + Rn

    a s = a1 + a2 + + anb = a a s

    where a p is a series junction wave variable, and b is the reectedwave seen at port .

    The reader is referred to the comprehensive tutorial by Fet-tweis [14] for the scattering relations of other elements and adap-tors.

    Each adaptor can have at most one reection free port (RFP),identied by a symbol T on the input terminal, whose impedanceis matched to the equivalent impedance of all the other ports com-bined. Because of this, adaptors naturally form a directed treestructure (see Figs. 4, 7 below) with the RFP oriented towards theroot of the tree.

    The entire tree in the classical WDF formulation naturallyadmits only one element with an instantaneous reection, whichmust be placed at the root of the tree. All other elements mustnot have an instantaneous reection. While the tree arrangementis suggested in [14], a more thorough development is presentedin [2].

    2.1.3. Nonlinear wave digital elements

    Nonlinear elements are also derived by substitution of (1) intothe Kirchhoff denition of the element, and solving for the re-ected wave b [15]. This often produces an instantaneous reec-tion, which in the classical WDF, must be placed at the root of thetree. Thus, WDFs can handle only a single nonlinearity, although

    modied approaches might be able to handle more [16].Wave digital lters can also implement nonlinear reactances

    such as capacitors and inductors by dening an auxiliary port tothe element whose wave variables correspond to the state vari-ables of the reactance. For example, for a nonlinear capacitorQ = C (V ) V , the wave variables at the auxiliary port would bedened in terms of charge Q and voltage V . The transformed vari-able denitions can then be used in the dening equations of thenonlinear reactance. The reader is referred to [1, 17] for detailedderivations and usage.

    2.1.4. Practical considerations

    Because WDFs are often arranged in a tree structure, with data

    dependency owing from the leaves up to the root, and then fromthe root back down to the leaves, it is convenient to label the wavesignals in terms of u for signals going up the tree (through the RFP,marked with T), and d for signals traveling down the tree [2, 11].Otherwise, naming signals in terms of incident and reected wavesbetween WDF components can quickly become unwieldy.

    Once the WDF elements and adaptors are dened, the WDFtree is sufcient to represent its computational structure. The fol-lowing examples will present their algorithms as WDF trees.

    2.1.5. Computational complexity

    WDFs take advantage of the linear complexity of parallel and se-ries adaptors to produce very compact signal processing code. In

    DAFX-2

  • 7/31/2019 Simulacion de Distorsion Para Guitarra

    3/8

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

    particular, N -port parallel and series adaptors with one reectionfree port incur a computational cost of N 1 multiplies and 2N 2adds. In comparison, general N -port scattering matrices requirea full matrix-vector multiply, and a direct implementation wouldhave N 2 multiplies and (N 1)2 adds.

    A WDFwith N elements synthesized as a binary tree of 3-portparallel and series adaptors as described in [11] would have N 23-port adaptors. The computational cost of a straightforward im-plementation of these adaptors would be 2N 4 multiplies and4N 8 adds. Thus, the linear order of complexity is preservedglobally. Clearly, if a circuit can be decomposed into parallel andseries connections, using adaptors instead of full scattering matri-ces to represent the circuit presents a great computational advan-tage.

    2.2. State-Space with Memoryless Nonlinearity (SSMN)

    Most nonlinear characteristics for devices in guitar circuits can bedescribed as memoryless nonlinearities. The circuits can there-fore be represented in state-space form with separate terms for thelinear and nonlinear parts of the system. Numerical solution of such systems results in a discrete-time state-space system with anembedded memoryless nonlinearity. This class of solvers may bereferred to as State-Space with Memoryless Nonlinearity (SSMN)solvers.

    2.2.1. K-method

    An SSMN approach was developed in computational musicalacoustics as the so-called K-method [3], using a particular matrixrepresentation of nonlinear state-space systems. Note that thevariable names are modied here from the original exposition toclarify the relationship with standard state-space formulations, andto aid interpretation for the following examples.

    The K-method deals with a broad class of systems that can beexpressed in the form

    x = Ax + Bu + Ci , (2)

    i = f (v ), v = Dx + Eu + Fi , (3)

    where x is a vector representing the state of the system, u repre-sents the input, and i represents the contribution from the nonlinearpart to the time derivative of the state. In the following examples,choosing i to be the nonlinear device currents leads to the mostconvenient derivation of ( 2), hence the choice of variable name.The devices are voltage-controlled current sources; thus v repre-sents these controlling voltages. Matrices A , B , C represent linear

    combinations of the state, inputs, and nonlinear part that affect theevolution of the state. The nonlinear contribution ( 3) is denedimplicitly with respect to i and in general also depends on a linearcombination of x and u .

    Discretizing (2) by a numerical integration method, solvingfor x n and substituting into ( 3) results in an implicit system of equations that can be solved for i . Under conditions presentedin [3] amounting to the existence of a unique solution, i can beexpressed as a function of a parameter p n .

    2.2.2. Computational algorithm

    If the trapezoidal rule is used to discretize the time derivative in(2) , state update comprises the following three-step procedure

    1. p n = DH ( I + A )x n 1 +( DHB + E )u n + DHBu n 1 +DHCi n 1

    2. in = g (p n )

    3. x n = H ( I + A )x n 1 + HB (u n + u n 1 ) + HC (in +

    in 1 )where subscripts denote the time index, H = ( I A ) 1 , =2/T if no prewarping is used, and in = g (p n ) is an implicitlydened transformation of f (v ),

    in = f (Ki n + p n ), (4)

    due to the discretization, where K = DHC + F . This is a lineartransformation of states and inputs to generate an effective inputto the original nonlinear function f . Function g (p n ) sometimescan be found analytically from ( 4), but usually needs to be solvednumerically by Newtons method or, if possible, xed point itera-tion [13]. The state update then takes the past state, present input,and nonlinear contributions to compute the present state.

    The output y is generally expressed as a linear combination of the states, inputs, and nonlinear part,

    y n = A o x n + B o u n + C o in .

    Once this procedure is dened, only the matrices A , B , C , D ,E , F , A o , B o , and C o and the function f (v ) need to be given todescribe the system under consideration.

    2.2.3. Computational complexity

    The K-method solution involves matrix multiplies, and contem-porary CPU architectures were designed with such operations inmind. The K-method approach stands to benet greatly from dataparallelism at the computer architecture level.

    If the coefcient matrices and the nonlinear function in thealgorithm outlined in Sec. (2.2.2 ) are precomputed once, the com-putational complexity for the linear parts of the system is approx-imately O`N

    2 + NM + NP , where N is the number of states,M is the number of inputs, and P is the number of nonlinear out-puts. This quadratic complexity is a disadvantage compared to theWDF, but the K-method is directly applicable to a broader rangeof circuits.

    3. APPLICATION TO VARIOUS GUITAR CIRCUITS

    The following examples apply the WDF and SSMN formulationsto various circuits found in guitar electronics. We performed all

    simulations using custom code in MATLAB and utilized Newtonsmethod to solve any nonlinear equations.

    3.1. Bright switch/lter

    The bright switch (Fig. 3) is commonly found in guitar amplica-tion circuits and sometimes in the electronics of the electric guitaritself as part of a volume knob implemented as a resistive voltagedivider. When engaged, it provides a low impedance path for highfrequencies to bypass part of the voltage divider.

    The WDF tree for the bright switch is shown in Fig. 4 andits signal processing algorithm can be derived by inspection fromthis tree. The capacitor was chosen to be at the top of the treebecause, when it is disconnected, the open circuit at the top of

    DAFX-3

  • 7/31/2019 Simulacion de Distorsion Para Guitarra

    4/8

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

    +

    C

    Rt

    Rv

    Vo

    Rs

    Vs

    Figure 3: Schematic of the bright switch from guitar electronics.

    Vs

    CP2P

    SRs

    Rt

    Rv

    Figure 4: WDF tree to implement the bright switch. Adaptor P2 isroot.

    the tree produces an instantaneous reection. Using the reection-free wave digital capacitor sets its port impedance and requires aparallel two-port adapter P2 to match the impedance of the restof the tree. The bright switch is suited to implementation as aWDF because of its switched nature. The computational blocks ina WDF correspond directly to the physical circuit elements, whichcan easily be rearranged to reect a different structure.

    Figure 5 shows the magnitude response of the bright switchsimulated using the values C = 120 pF, R t = (1 vol)M ,R v = (vol)M , R s = 100k , where vol [0, 1] is the value of the volume potentiometer.

    3.2. Two-capacitor diode clipper

    The behavior of various numerical methods applied to the sin-gle capacitor diode clipper was previously studied extensively [7].Here we consider the diode clipper including the effects of the DCblocking capacitor. The nonlinearities cause the pole of the high-pass frequency to move depending on the signal level. Becausethis pole is at low frequencies, this could have a notably audibleeffect, especially in the presence of transients.

    The two-capacitor diode clipper is shown in Fig. 6. The two

    20 200 2k 20k 60

    50

    40

    30

    20

    10

    0

    Frequency (Hz)

    M a g n i

    t u d e ( d B )

    vol=1

    vol=0.1

    vol=0.01

    vol=0.001

    Figure 5: Magnitude response of the volume attenuator with brightswitch engaged for values of volume as shown.

    Ch

    Vs

    VoRs

    +++

    Cl

    Figure 6: Schematic of the diode clipper with high-pass and low-pass capacitors.

    Vs P

    D

    RsS Cl

    Ch

    Figure 7: WDF tree of the two-capacitor diode clipper. Diode D is

    root.

    diodes are two physically separate nonlinearities but can be com-bined into a single equivalent nonlinearity summing their currentsby KCL because they are connected in parallel. In the WDF, thetwo diodes are modeled by the voltage-controlled current source

    I d (V ) = 2 I s sinh ( V/V t ) , (5)

    where I d (V ) is the current through the two diodes, I s and V t arephysical parameters of the diodes, and V is the controlling voltageacross the diodes.

    Device parameters for the following simulations are R s =2.2k, C h = 0 .47F , C l = 0 .01F , I s = 2 .52 10

    9 A, andV t = 45 .3mV.

    3.2.1. WDF implementation

    The current state of WDF technology is well suited for modelingcircuits connected in series and parallel and with a single one-portnonlinearity. The diode clipper is a prime example of this. Thetree corresponding to the computational structure of the WDF forthe diode clipper is shown in Fig. 7. The input is the voltage sourceV s and the output is the junction voltage of the parallel adaptor.

    0 5 10 15 20 25 30

    0.6

    0.4

    0.2

    0

    0.2

    0.4

    0.6

    Time (ms)

    O u t p u

    t ( V )

    Figure 8: Simulated output of two-capacitor diode clipper for sineinput with frequency 80 Hz, amplitude 4.5 V. Identical output isproduced by WDF and K-method.

    DAFX-4

  • 7/31/2019 Simulacion de Distorsion Para Guitarra

    5/8

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

    The nonlinear relationship between the incident and reectedwaves to this block in the WDF is derived by substituting the wavevariable denitions ( 1) into (5) and solving the resulting implicitlydened nonlinear function for b = f (a) using numerical methods.Specically, the nonlinear equation to be solved is

    2I s sinh a + b2V t a b2R p = 0 .Conditions for which a solution exists are given in [1, 15].

    This nonlinear relationship b = f (a ) is then placed at thetop of the tree representing the rest of the diode clipper to preventdelay-free loops in the signal processing algorithm.

    This example demonstrates the power of the WDF formula-tion to build up algorithms modularly to simulate circuits. Theadditional high-pass capacitor C h is added to the single capacitordiode clipper by replacing the original resistive voltage source (in-side the dotted box in Fig. 6) with the series combination of thesource and the capacitor. Thus, the structure of the WDF derivesdirectly from the connectivity of the modeled circuit.

    3.2.2. K-Method implementation

    The matrices for the K-method representation of the diode clip-per can be found by application of KCL at the two nodes withunknown voltages.

    These equations are

    I Ch = C h V Ch = G s (V s V x )

    C l V o = C h V Ch I d (V o ).Choosing the state variables to be the voltages across the two

    capacitors x = V o V Ch T

    with the polarity of the voltagesindicated by + on the capacitors in Fig. 6, we solve for V o and V Chusing V x = V o + V Ch to dene the intermediate node voltage in

    terms of the state variables, and set u = V s to be the input. We letthe nonlinear part i = I d (V o ), which makes v = V o the input tothe nonlinearity. The state variable V o is also the output.

    V o =G sC l

    (V s V o V Ch ) 1

    C lI d (V o )

    V Ch =GsC h

    (V s V o V Ch )

    The resulting K-method matrices are

    A = G s /C l Gs /C l Gs /C h G s /C h , D = 1 0 ,B =

    G s /C lG s /C h

    , E =

    0

    ,

    C = 1/C l0 , F = 0 .3.2.3. Simulation results

    The output of the diode clipper simulated using an input signal of 80 Hz, 4.5 V amplitude, is plotted in Fig. 8. The sampling rate was8 oversampled the audio sampling rate of 48000 Hz to reducesignal aliasing in the output. Identical output was produced by thenonlinear WDF and the K-method. Notice the rst cycle of theoutput has a different period than the steady-state response, indi-cating that the high-pass capacitor does indeed affect the responseof the circuit to transients and should be included in models.

    3.2.4. Comparative discussion

    The signal ow diagram to update the state for both methods in-volve linear operations followed by a static nonlinearity and morelinear operations. The nonlinearity is also present in the discrete-

    time feedback loop, which alters the order of the nonlinearity.Considering the nonlinearity as a separate operation of compa-rable cost, the WDF requires only 4 multiplies and 8 adds to imple-ment the diode clipper. In contrast, the K-method using a straight-forward implementation of matrix-vector multiplication requires13 multiplies and 12 adds. However, it is not straightforward toderive WDFs for the examples that follow.

    3.3. Common-emitter transistor amplier with feedback

    Figure 9 shows the common-emitter amplication stage from theBoss DS-1 [12], which employs a bipolar junction transistor (BJT)in the shunt-shunt feedback conguration, giving rise to a tran-simpedance amplier. The feedback resistor exists mainly to bias

    the base of the BJT at a desired operating point. The circuit alsofeatures mild emitter degeneration as is common with these am-pliers, which reduces the gain and improves the small-signal lin-earity of the stage. Because of the high gain from node b to nodec, this stage is highly sensitive to the DC bias voltage of node b,which is determined by the design of the circuit. Using incorrectresistor values affects the output swing, which in turn inuencesthe shape and symmetry of the clipped output.

    The design values for this circuit are R i = 100k , R c =10k, R l = 100k , R f = 470k , R e = 22 , C i = 0 .047F ,C f = 250 pF , and C o = 0 .47F .

    3.3.1. Bipolar Junction Transistor (BJT) device model

    Figure 10 depicts generic model for the bipolar junction transis-tor comprising voltage-controlled current sources. The BJT hasthree terminals, the collector, base, and emitter, whose currentsare controlled by voltages across two pairs of the terminals, V be =V b V e , V bc = V b V c . By conservation of current, only two of the terminal current denitions are needed to completely describethe current-voltage (I-V) characteristics. We use I b(V be , V bc ) andI c (V be , V bc ) here. Semiconductor devices such as the BJT alsohave nonlinear resistances and capacitors, which require more de-tailed models; however, for simplicity, we assume that we can ne-glect these effects for the signal levels of this circuit in the audiofrequency band.

    A complete, yet simple, physically derived model for com-puter simulation, the Ebers-Moll model [18] denes the followingcurrent-voltage (I-V) characteristics:

    I e =I S F

    [exp(V be /V T ) 1] I S [exp(V bc /V T ) 1] (6)

    I c = I S [exp( V be /V T ) 1] I S R

    [exp(V bc /V T ) 1] (7)

    I b =I S F

    [exp( V be /V T ) 1] +I S R

    [exp( V bc /V T ) 1] (8)

    Device parameters for this simulation are V T = 26 mV, F =200, R = 0 .1, R = R / (1 + R ), I s = 6 .734 10

    15 A. Thereader is referred to textbooks on electronic devices, e.g., [18], fordetailed interpretation of these parameters.

    DAFX-5

  • 7/31/2019 Simulacion de Distorsion Para Guitarra

    6/8

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

    VCC

    Cf

    Rf

    Ci

    Ri Re

    Rc

    Q2

    ViVo

    Co

    +

    +

    +

    Rl

    ++

    b

    c

    e

    Figure 9: Schematic of the common-emitter amplier with feed-back.

    Ic(Vbe,Vbc)

    Ib(Vbe,Vbc)

    b

    c

    e

    b

    c

    e

    Figure 10: Generic BJT device model.

    3.3.2. K-Method formulation

    Using the generic description of Fig. 10 for I-V characteristics,we nd the K-method matrices for this circuit. Again deningthe state to be the voltages across each of the three capacitors,x =

    V Ci V bc V Co

    T

    with the polarity of the voltages in-dicated by + on the capacitors in Fig. 9, we can use KCL to ndequations at each of the nodes, and solve for x . The inputs areu = V i V CC

    T , the input voltage and the supply rail. The

    nonlinearity is given by

    i = I b(V be , V bc ) I c (V be , V bc ) T ,

    the currents at the base and collector terminals of the BJT, andrequires an input v = V be V bc

    T . The output is found from

    V o = V i V Ci V bc V Co .

    The K-method matrices then give the appropriate linear combina-tions of these variables using conductance Gx = 1 /R x in place of the corresponding resistance:

    A = 264 G c + G l + G iC i

    G c + G lC i

    G lC i G c + G lC f

    G c + G l + G f C f

    G lC f G lC o

    G lC o

    G lC o

    375,

    B = 264G c + G l + G i

    C i G cC i

    G c + G lC f

    G cC f G lC o 0

    375,

    C = 24

    1/C i 1/C i0 1/C f 0 0

    35

    ,

    D = 1 0 00 1 0 ,E = 1 00 0 ,F = R e R e0 0 .

    25 26 27 28 29 305

    0

    5

    Time (ms)

    O

    u t p u

    t ( V )

    Figure 11: Output of the common-emitter amplier for sine inputof 0.2V, 1 kHz.

    The formulation given admits a generic device model. Whilethe Ebers-Moll model for a BJT is used here specically, it is asimple model that does not account for the many nonidealities of real devices. In practice, the distortion performance of the circuitis highly sensitive to the accuracy of the device models, whichusually represent some simplication of reality. This formulationallows for the use of tabulated device models obtained experimen-tally for greatest accuracy.

    3.3.3. Simulation results

    The BJT amplier was simulated at a sampling rate of 8 the au-dio rate 48000 Hz. The results are shown in Fig. 11. Note theasymmetry of the duty cycle of the output given a sine wave input.This is due to the asymmetry in the nonlinearity: one polarity clipsat a lower level than the other. This injects an offset at DC, whichis being ltered out by the DC blocking capacitor at the output,causing the the bias of the output waveform to shift downward af-ter the initial transient at 26 ms (not shown). A slowly shifting biaswould affect the distortion of subsequent nonlinear stages.

    3.4. Common-cathode triode amplier with supply bypass

    In guitar circuits, the ubiquitous common-cathode triode amplierstage (Fig. 12) provides preamplication gain. Several of thesestages can be cascaded for a high-gain amplier. This circuit isessentially the same conguration as a BJT common-emitter am-plier. The grid resistor R g and parasitic Miller capacitance C f are shown explicitly in this simulation circuit. The cathode resis-tor R k determines the operating bias point for the circuit. Often abypass capacitor C k is placed across the cathode resistor to coun-teract the effects of gain degeneration caused by the resistor, and

    gives a bandpass gain.For this simulation, the circuit design used is R g = 70k ,

    Rk = 1500 , R p = 100k , R i = 1M , C i = 0 .047F , C f =2.5 pF , C k = 25 F .

    3.4.1. Triode device model

    The triode differs slightly from the BJT in the device model. Whilethe BJT is controlled by the voltages across the base-emitter, andbase-collector ports, owing to different operating principles, thetriode is controlled by the voltages across the gate-cathode andcathode-anode ports. The triode device model is shown in Fig. 13.

    The classic Child-Langmuir triode equation for the plate cur-

    DAFX-6

  • 7/31/2019 Simulacion de Distorsion Para Guitarra

    7/8

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

    VPP

    Cf

    Ci

    Ri

    Rk

    Rp

    Vi

    Vp

    Ck

    Rg

    +

    +

    +

    +

    +

    Figure 12: Schematic of the common-cathode triode amplier.

    Ip(Vgk,Vpk)

    Ig(Vgk,Vpk)

    g

    p

    k

    p

    g

    k

    Figure 13: Generic triode device model.

    rent [19] is used here as a proof of concept:

    I p = K E d 1 + sign( E d )2 3/ 2

    , where

    E d = V gk + V pk ,and grid current I g = 0 . For the 12AX7 triode in this simulation,

    = 83 .5, K = 1 .73 10

    6 A/ V3/ 2 [20].The Child-Langmuir model allows the plate-cathode voltage

    to become negative while plate-cathode current is positive whenthe grid voltage is sufciently high. This unphysical behaviordemonstrates the inaccuracy of the model in a common region of operation for guitar distortion.

    The Child-Langmuir equation is admittedly a poor model forsimulation; however, the K-method formulation admits a generaltwo-port description of the triode, so any of the multitude of triodemodels developed for circuit simulation in SPICE can be ported tothis method. In particular, this formulation accounts for the effectsof grid conduction (not used with this model), which is claimed tobe sonically signicant [21].

    3.4.2. K-method formulationWhile a similar circuit was simulated using the wave digital formu-lation [9], the two-port nonlinear device does not yet readily admita wave digital representation, and ad-hoc means were necessary togenerate a WDF. Alternatively, the K-method allows direct simu-lation of the common-cathode circuit in Fig. 12.

    The state vector is the voltages across each of the capaci-tors x = V Ci V Cf V Ck

    T , with the polarity of the volt-

    ages indicated by + on the capacitors in Fig. 12. The inputs areu = V i V P P

    T , the input voltage and the supply rail. The

    nonlinearity is given by

    i =

    I g (V gk , V pk ) I p (V gk , V pk )

    T ,

    5 5.5 6 6.5 7 7.5 80

    100

    200

    Time (ms)

    O u t p u

    t ( V )

    Figure 14: Plate voltage of common-cathode amplier for sine in-put of 2.8V, 1000 Hz.

    the currents through the grid and plate terminals, and requires aninput v = V gk V pk

    T , the voltages across the grid-cathode,

    and plate-cathode ports. The K-method matrices, using conduc-tance Gx = 1 /R x in place of the corresponding resistance, arethen

    A = 2664

    (( G i + G g )G p + G i G g )C i (G g + G p )

    G g G pC i ( G g + G p )

    0G g G p

    C f ( G g + G p ) G g G p

    C f ( G g + G p )0

    0 0 G k

    C k

    3775,

    B = 264(( G i + G g )G p + G i G g )

    C i ( G g + G p ) G g G p

    C i (G g + G p ) G g G pC f ( G g + G p )

    G g G pC f ( G g + G p )

    0 0

    375,

    C = 264

    G gC i ( G g + G p )

    G gC i (G g + G p )

    G pC f ( G g + G p )

    G gC f ( G g + G p )

    1C k

    1C k

    375

    ,

    D = " G g

    G p + G g G p

    G p + G g 1 G gG p + G g

    G gG p + G g

    1 #,

    E = "G g

    G p + G gG p

    G p + G gG g

    G p + G gG p

    G p + G g#, F = "

    1G p + G g

    1G p + G g 1

    G p + G g 1

    G p + G g #.The output is taken to be the plate voltage and can be found by

    V pk + V k during simulation. This output contains a bias voltageand needs to be high-pass ltered for use in an audio plugin.

    3.4.3. Simulation results

    The tube preamp was simulated using the Child-Langmuir triodemodel at a sampling rate of 8 the audio rate 48000 Hz. The platevoltage for an input of 2.8 V, 1000 Hz, is plotted in Fig. 14. Noticethat this device model has an unrealistically sharp cutoff, leadingto the truncated tops of the waveforms in the gure.

    4. CONCLUSIONS

    The nonlinear methods developed for computational musicalacoustics are readily applied to musical circuits simulation. Foraccurate simulation, these methods require electronic device equa-tions that accurately model the nonlinearities. Device models forbipolar junction transistors were designed with circuit simulationin mind. This is not the case with currently available vacuum-tube

    DAFX-7

  • 7/31/2019 Simulacion de Distorsion Para Guitarra

    8/8

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

    models, which tend to result in unreliable simulations due to dis-continuities in the model or poorly behaved regions in the curvets. Vacuum-tube device models need to be improved before non-linear computer simulation of vacuum-tube circuits can becomerealistic. Once accurate, numerically robust device models are

    available, they can be readily used with these two methods forsolving nonlinear ordinary differential equations.

    Wave digital lters offer computational efciency, robustnessto coefcient quantization, and facilitate interfacing with wavevariables, making them a worthwhile subject of study. Represen-tation of multiport nonlinearities is still under investigation.

    For the K-method, states should correspond to the natural stateelements of the circuit, namely capacitors and inductors. Choosingthe appropriate state variables facilitates derivation of the nonlin-ear state-space equations and aids interpretation of the resultingsystem.

    For solving nonlinear systems, both methods are conceptuallysimilar in the overall order of operations. Both rst compute a lin-ear combination of state and inputs this is used as a parameter to

    a nonlinear function. Then to update the states they compute linearcombinations of these variables with the outputs of the nonlinear-ity.

    Circuits are made of canonical building blocks, which can beidentied. Circuits can be decomposed into stages by inspection of the schematic for these building blocks. Loading between stages (aform of feedback), and local and global feedback can be accountedfor by using nonlinear lter composition. The next step is to buildsimulations of the full signal path of a guitar distortion circuit andevaluate its real-time performance and reliability.

    Further work can be done comparing the performance of thesesimulation approaches against established circuit simulation algo-rithms.

    5. ACKNOWLEDGMENTS

    Thanks to Profs. Matti Karjalainen, Davide Rocchesso, and Au-gusto Sarti for fruitful discussions regarding the comparative mer-its of these methods. Thanks also to the AkuLab at TKK for kindlyhosting the rst authors visit during the formative period for theseideas, supported by a National Science Foundation Graduate Fel-lowship.

    6. REFERENCES

    [1] A. Sarti and G. De Poli, Toward nonlinear wave digitallters, IEEE Trans. Signal Process. , vol. 47, pp. 16541668,June 1999.

    [2] G. De Sanctis, A. Sarti, and S. Tubaro, Automatic synthe-sis strategies for object-based dynamical physical models inmusical acoustics, in Proc. of the Int. Conf. on Digital Audio Effects (DAFx-03) , London, UK, Sept. 2003.

    [3] G. Borin, G. De Poli, and D. Rocchesso, Elimination of delay-free loops in discrete-time models of nonlinear acous-tic systems, IEEE Trans. Speech and Audio Proc. , vol. 8,no. 5, pp. 597605, Sept. 2000.

    [4] F. Fontana, F. Avanzini, and D. Rocchesso, Computationof nonlinear lter networks containing delay-free paths, inProc. Conf. on Digital Audio Effects (DAFx-04) , Naples,Italy, Oct. 2004, pp. 113118.

    [5] A. Huovilainen, Enhanced digital models for analog mod-ulation effects, in Proc. of the Int. Conf. on Digital Au-dio Effects (DAFx-05) , Madrid, Spain, Sept. 20-22 2005, pp.155160.

    [6] F. Avanzini and D. Rocchesso, Efciency, accuracy, andstability issues in discrete time simulations of single reed in-struments, J. of the Acoustical Society of America , vol. 111,no. 5, pp. 22932301, May 2002.

    [7] D. T. Yeh, J. S. Abel, A. Vladimirescu, and J. O. Smith,Numerical Methods for Simulation of Guitar Distortion Cir-cuits, Computer Music Journal , vol. 32, no. 2, pp. 2342,2008.

    [8] A. Huovilainen, Nonlinear digital implementation of theMoog ladder lter, in Proc. of the Int. Conf. on Digital Au-dio Effects (DAFx-04) , Naples, Italy, Oct. 58, 2004, pp. 6164.

    [9] M. Karjalainen and J. Pakarinen, Wave digital simulationof a vacuum-tube amplier, in IEEE ICASSP 2006 Proc. ,

    Toulouse, France, 2006, vol. 5, pp. 153156.[10] J. Pakarinen, Modeling of Nonlinear and Time-Varying Phe-

    nomena in the Guitar , Ph.D. thesis, Helsinki University of Technology, 2008.

    [11] R. Rabenstein, S. Petrausch, A. Sarti, G. De Sanctis,C. Erkut, and M. Karjalainen, Block-Based Physical Mod-eling for Digital Sound Synthesis, IEEE Signal Process. Mag. , vol. 24, no. 2, pp. 4254, Mar. 2007.

    [12] D. T. Yeh, J. Abel, and J. O. Smith, Simplied, physically-informed models of distortion and overdrive guitar effectspedals, in Proc. of the Int. Conf. on Digital Audio Effects(DAFx-07) , Bordeaux, France, Sept. 1014, 2007.

    [13] F. Avanzini, F. Fontana, and D. Rocchesso, Efcient com-

    putation of nonlinear lter networks with delay-free loopsand applications to physically-based sound models, in Proc.of The Fourth Int. Wkshp. on Multidim. Sys., (NDS 2005) ,Wuppertal, Germany, July 2005, pp. 110115.

    [14] A. Fettweis, Wave digital lters: Theory and practice,Proc. IEEE , vol. 74, no. 2, pp. 270 327, Feb. 1986.

    [15] K. Meerktter and R. Scholz, Digital simulation of nonlin-ear circuits by wave digital lter principles, in Proc. IEEE Int. Symp. on Circuits and Systems , May 1989, vol. 1, pp.720723.

    [16] S. Petrausch and R. Rabenstein, Wave digital lters withmultiple nonlinearities, in XII European Sig. Proc. Conf.(EUSIPCO) , Vienna, Austria, Sept. 2004, vol. 1, pp. 7780.

    [17] T. Felderhoff, A new wave description for nonlinear ele-ments, in IEEE Int. Symp. on Circuits and Systems (ISCAS 96) , Atlanta, USA, May 1996, vol. 3, pp. 221224.

    [18] R. S. Muller, T. L. Kamins, and M. Chan, Device Electronics for Integrated Circuits , Wiley, Hoboken, NJ, 3 edition, 2002.

    [19] K. Spangenberg, Vacuum Tubes , McGraw-Hill, New York,1st edition, 1948.

    [20] W. M. Leach, SPICE Models for Vacuum-Tube Ampli-ers, J. Audio Eng. Soc. , vol. 43, no. 3, pp. 117126, May1995.

    [21] J.-C. Maillet, A generalized algebraic technique for model-ing triodes, Glass Audio , vol. 10, no. 2, pp. 29, 1998.

    DAFX-8