04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

Embed Size (px)

Citation preview

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    1/27

    Physical modelling in SystemC-WMSand real time synthesisof electric guitar effects

    F. Gambini, Massimo Conti, S. Orcioni,DEIT, Universit Politecnica delle Marche, Ancona, Italy

    F. Ripa, M. CaldariKorg Italy, Osimo, Italy

    [email protected] w w w .deit.univpm.it

    WISES 07, Madrid, June 2007

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    2/27

    Cooperation betweenKorg Italy and University of Ancona

    in the design of ICfor high quality musical instruments

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    3/27

    OutlineOutline

    IntroductionIntroduction

    SystemCSystemC -- WMS application on sound generationWMS application on sound generationand transformationand transformation

    Application to a electric guitar distortion effectApplication to a electric guitar distortion effectgenerator: Fuzzgenerator: Fuzz -- FaceFace

    ConclusionsConclusions

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    4/27

    Sound generation andtransformation physical modeling

    Many techniques used now adays:Many techniques used now adays:Frequency Modulation,Frequency Modulation,

    Additive or Subtractive synthesis,Additive or Subtractive synthesis,

    W avetable Synthesis based on the storage of samples of W avetable Synthesis based on the storage of samples of sounds of real musical instrumentssounds of real musical instruments

    P hysical modeling identifies the physicalP hysical modeling identifies the physical

    mechanism that generates the sounds, startingmechanism that generates the sounds, startingfrom the physical law s that are on the basis of from the physical law s that are on the basis of the instrument.the instrument.

    PhysicalPhysical modellingmodellingAllow s good soundsAllow s good sounds

    Gives a natural and intuitive interaction betw een theGives a natural and intuitive interaction betw een theplayer and sound generatorplayer and sound generatorHigh computational complexityHigh computational complexity

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    5/27

    Motivations for SystemC-AMS

    Sy st em C Sy st em C is an emerging simulation environment usedto provide a virtual model of a digital IP required toverify in short time the design specifications.

    SystemC is open

    Implementation of digital and analog parts (DAC, RFfront-end ) in the same chip requires a m ix ed m ix ed - - s i g n a l s i g n a l s im u la t ion s im u la t ion .

    Analog and mixed-signal extensions are currentlymissing in SystemC

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    6/27

    SystemC-WMS

    Definition of a methodology for the description of analog blocksusing instruments and libraries provided by instruments and libraries provided by SystemC SystemC .

    No new simulation kernel No new simulation kernel is introduced.

    Therefore analog and digital modules are easily simulated easily simulated

    together together .

    analog system can be described either at a low low or or a high a high level level using analog macromodels.

    We think that a high level macromodel should be used in asystem level simulation, using a SPICE-like simulator only when a

    detailed analysis is required.

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    7/27

    The ProblemImplementation in SystemC of continuous time systems described bya signal flow graph (SFG) and by a system of non-linear ordinarydifferential equations of the type

    ( )( )

    ,,

    x f x u y g x u = =

    &

    x : state, y: output, u: input vectorDetailed description or macromodel of the analog circuit

    Solution is obtained using the explicit Euler formula

    yxu

    ( ) ( ) ( ( ), ( ))

    ( ) ( ( ), ( ))

    x t dt x t dt f x t u t

    y t g x t u t

    + = +

    =

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    8/27

    MethodologyDifferent possible time step implementations in SystemC:

    Global constant time step for all the analog processes Global constant time step for all the analog processes .(synchronous, dt constant )

    This analog simulation clock activates all the analog blocks.This solution is the simplest, but very inefficient since it requires a very small time stepto reach an accurate solution.

    analog clockConstant dt

    Analog IPsignals

    sensitive

    Analog IPsignals

    sensitive

    D/Ainterfacesignals

    sensitive

    Digital IPsignals

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    9/27

    Methodology

    Global adaptive time step for all the analog processes Global adaptive time step for all the analog processes .((synchronous, adaptive dt)

    A new global thread is necessary to calculate at each time instant the smallest timestep required to guarantee the required accuracy. This thread acts as an analog

    simulation kernel. This solution is inefficient when analog blocks with different timeconstants are present in the same system.

    analog clockadaptive dt

    Analog IPsignals

    sensitive

    Analog IPsignals

    sensitive

    D/Ainterfacesignals

    sensitive

    Digital IPsignals

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    10/27

    Methodology

    Local adaptive time step Local adaptive time step ((asynchronous, adaptive dt)

    Each analog process calculates its adaptive time step, and it passes this time stepto the blocks to which its outputs are connected. The analog inputs activate theprocess, that calculates the new state and output values. Then it sends them to the

    connected analog blocks after the minimum between its time step and the timesteps received from the input blocks.

    Localanalog

    clockadaptive dt

    Analog IPsignals

    sensitive

    Analog IPsignals

    sensitive

    D/Ainterfacesignals

    sensitive

    Digital IP

    Localanalog

    clockadaptive dt

    Localanalog

    clockadaptive dt

    signals

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    11/27

    Systems non representable with Signal Flow Graphi 1

    v 1

    i 2

    v 2a 2a 1

    b 2b 1

    Variable transformation using incident and reflected waves a,b

    ( )( )

    1 / 21

    / 2

    j j j j j

    j j j j j

    a v R i R

    b v R i R

    = +

    =

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    12/27

    Example

    1 2

    1

    2

    =

    = + +==

    L L

    L L

    L

    L

    d v L i

    dt v v R i v

    i i

    i i ( ) ( )

    1 1

    2 2

    1 2

    22

    =

    = +

    += &

    xb a

    L x

    b a L

    R x a a x L

    Current and Voltages Incident and Reflectedwaves a,b

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    13/27

    Example: pnp BJT

    i b

    i ci e

    v c

    v b

    v e

    ( ) ( ) ( 1 1 1 / ; / ; / 2 2 2b b b c c c e e ea v R i R a v R i R a v R i R= + = + = +

    ( ) ( ) ( 1 1 1 / ; / ; / 2 2 2b b b c c c e e eb v R i R b v R i R b v R i R= = =

    (1 ) (1 ) ; ;b F EC R CC c CC F EC e EC R CC i I I i I I i I I = + = =

    0 0exp 1 ; exp 1 ;e b c b

    EC E CC C

    t t

    v v v v I I I I

    v v

    = =

    System Level Design Methodology for sound

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    14/27

    .wav

    SystemC_WMSanalog model

    SystemCdiscrete time model

    SPICEcircuital model

    SystemCHW/SW refinement

    DSP FPGA

    C code VHDL

    analog hardware

    S y s

    t e m

    C d e s

    i g n e n v

    i r o n m e n

    t

    real time real time

    r e a

    l t i m e

    r e a

    l t i m e

    batch batch

    .wavbatch

    System Level Design Methodology for soundtransformation based on Physical Modeling

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    15/27

    Physical Modeling of electric guitar effect

    Fuzz Face

    - Analog distortion electronic circuit for electric guitar- Produced by Dallas Arbiter in 1966- Famous in the 60 and 70 and used by

    Jimi Hendrix, David Gilmour, Carlos Santana, Eric Clapton,- Widely used up to now.

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    16/27

    Distorsion Effect

    Input (t) Fuzz Face output (t)

    Input spectrum Fuzz Face output spectrum

    The circuit saturates for some values of the input signal,giving the effect of distorting a sinusoid into an almost square

    waveform, introducing new harmonic components.

    - 9V

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    17/27

    AC128

    Q1 AC128

    Q2

    R4

    100K

    R2

    330R38.2K

    R73

    1

    2R6

    C1

    2.2uC4

    C320u

    1 2L

    9V

    OUT

    IN

    500K log

    1K lin

    R133K

    C3

    10n

    Vfuzz

    FUZZ-FACEPICKUP FILTER

    3

    1

    2R5

    FuzzFuzz -- FaceFacecircuitcircuit

    The original and the actual analog circuit use tw o coupledThe original and the actual analog circuit use tw o coupledgermanium transistors, that are preferred due to theirgermanium transistors, that are preferred due to theirbetterbetter sound performancessound performances to the cheaper siliconto the cheaper silicontransistors.transistors.

    The germanium transistors suffer fromThe germanium transistors suffer fromstrong dependence on temperature and humidity,strong dependence on temperature and humidity,high variability of the parameters,high variability of the parameters,

    high probability of breaking during soldering,high probability of breaking during soldering,

    high cost due to obsolete germanium technology.high cost due to obsolete germanium technology.Advantage of a digital implementation based on physicalAdvantage of a digital implementation based on physicalmodelinmodelin

    SystemCSystemC - W MSW MS

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    18/27

    SystemCSystemC -- W MSW MSlow level implementationlow level implementation

    of the Fuzzof the Fuzz -- Face circuitFace circuit(15 modules, 14 channels)(15 modules, 14 channels)

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    19/27

    Analog description in SystemC-WMS usingmacroblocks

    pickup filterfuzz-face

    knobs

    parametercontrol

    ...

    gain volume

    TheThe macroblockmacroblock description of the circuit consists of 5description of the circuit consists of 5SystemCSystemC -- W MS analog modules.W MS analog modules.

    The transistor control block is used to fix the technologicalThe transistor control block is used to fix the technologicalparameter of the transistors.parameter of the transistors.

    The knobs block is used to change the gain and the volume,The knobs block is used to change the gain and the volume,that are changed by the electric guitar player during itsthat are changed by the electric guitar player during itsperformance.performance.

    S t C WMSV t (V)

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    20/27

    -0,2

    -0,1

    0

    0,1

    0,2

    5 6 7 8 9 10 11 12

    SystemC-WMSSPICE

    time (ms)

    Vout (V)

    SPICE andSPICE and SystemCSystemC (using a discrete time(using a discrete timedescription of description of macroblocksmacroblocks ) simulations of the) simulations of theFuzzFuzz -- Face circuit with a sinusoidal inputFace circuit with a sinusoidal input

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    21/27

    -0,2

    -0,1

    0

    0,1

    0,2

    4 5 6 7 8 9 10

    beta=50 70 100

    time (ms)

    Vout (V)

    SystemCSystemC simulations of the fuzzsimulations of the fuzz -- face circuitface circuitwith a sinusoidal input with different values of with a sinusoidal input with different values of

    the BJT parameterthe BJT parameter ..1=1= 2= 50, 70, 1002= 50, 70, 100

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    22/27

    adaptor guitaramplifier

    The discrete time C++ physical model of theThe discrete time C++ physical model of the

    fuzzfuzz -- face is then extracted from the SystemCface is then extracted from the SystemCenvironment and integrated with other librariesenvironment and integrated with other librariesallowing audio real time simulations.allowing audio real time simulations.

    The input waveform can be taken from a file orThe input waveform can be taken from a file ordirectly from the microphone input of the PC,directly from the microphone input of the PC,and the output can be stored into a file orand the output can be stored into a file or

    directed to the audio output of the PC.directed to the audio output of the PC.

    t t

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    23/27

    Sleep (50)

    Play Sound (sound)

    Start Record(sound)

    EffectON/OFF

    GainUP/DOWN

    start

    KeyboardHit ?

    1UP/DOWN

    VolumeUP/DOWN

    LUP/DOWN

    2UP/DOWN

    ESC

    stop

    yesno

    Physical modelling allows the definition of parameters directly related

    to the physical mechanism the generated the distortion.These parameters are changed in real time while the artist is playinghis guitar.

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    24/27

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    25/27

    originaloriginalguitar

    amplifier

    real Fuzzreal Fuzz -- FaceFace

    guitaramplifier

    virtual Fuzzvirtual Fuzz -- FaceFace

    adaptor guitar

    amplifier

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    26/27

    Starting from the golden model defined andStarting from the golden model defined andverified in previous steps, the designer canverified in previous steps, the designer cansimplify the algorithm, or define thesimplify the algorithm, or define thearchitecture implementing the algorithm andarchitecture implementing the algorithm and

    the number of bits used to represent thethe number of bits used to represent thevariables.variables.

    The next step will be the implementation inThe next step will be the implementation inhardware using FPGA or DSP.hardware using FPGA or DSP.

  • 8/4/2019 04 - Physical Modelling in SystemC-WMS and Real Time Synthesis of Electric Guitar Effects - Conti

    27/27

    ConclusionsConclusions

    This works presents a general methodology for theintegration of physical modeling of sounds in a

    system level design environment using SystemC.The methodology has been applied in particular forphysical modeling of electric guitar effects.

    The model developed has been used for a real timesynthesis of a tunable electric guitar effects

    generator on a PC.