04 fm synthesis

Upload: adam-smith

Post on 03-Apr-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 04 Fm Synthesis

    1/20

    2/5/13

    1

    Copyright 2002-2013 by Roger B. Dannenberg

    INTRODUCTION TO COMPUTER MUSIC

    FM SYNTHESISRoger B. DannenbergProfessor of Computer Science, Art, and Music

    1ICM Week 4

    Copyright 2002-2013 by Roger B. Dannenberg

    WEEK 4, DAY 1

    Frequency ModulationFM Synthesis

    ICM Week 4 2

  • 7/28/2019 04 Fm Synthesis

    2/20

    2/5/13

    2

    Copyright 2002-2013 by Roger B. Dannenberg

    Frequency ModulationFrequency modulation occurs naturally:

    Voice inflection, natural jitter, and vibrato in singing Vibrato in instruments Instrumental effects, e.g. electric guitar Many tones begin low and come up to pitch Loose vibrating strings go sharp as they go louder Slide trombone, Theremin, voice, violin, etc. create

    melodies by FM (as opposed to, say, pianos)

    ICM Week 4 3

    Copyright 2002-2013 by Roger B. Dannenberg

    Frequency Modulation with Nyquist fmosc(basic-pitch,fm-control[, table[,phase]])fm-controlis expressed as deviation in Hzhzosc(fm-control)fm-controlis absolute frequency in Hzsnd-compose(f, g) Computes f(g(t)) if g is non-linear, frequency changes

    occur

    ICM Week 4 4

  • 7/28/2019 04 Fm Synthesis

    3/20

    2/5/13

    3

    Copyright 2002-2013 by Roger B. Dannenberg

    ExamplesSee Code 4 (code_4.htm)

    ICM Week 4 5

    Copyright 2002-2013 by Roger B. Dannenberg

    Why FM Synthesis?Weve already seen wavetable or table-lookupsynthesis: Very efficient Create any harmonic spectrum Simple frequency and amplitude control

    Whats missing? Time-varying control over the spectrum Inharmonic spectra

    Various Approaches: Synthesize each sinusoid separately tedious, costly Filter the output of table useful, but only harmonic output FM Synthesis

    ICM Week 4 6

  • 7/28/2019 04 Fm Synthesis

    4/20

    2/5/13

    4

    Copyright 2002-2013 by Roger B. Dannenberg

    FM SynthesisWhen modulation frequency is in the audio range,interesting things happen.

    ICM Week 4 7

    Carrier Frequency (C)

    Modulation Frequency (M)

    Number of significant

    partials is roughlythe ratio

    of modulation amp (freq

    dev, D) to modulation freq.

    Bandwidth~2(D+M)

    Copyright 2002-2013 by Roger B. Dannenberg

    Mathematics of FMThe exact amplitudes of the partials generated byFM are described by Bessel functions

    These functions are messy, their evolution ismessier, and there is no simple way to invert the

    functions

    Many lives of FM: 1967-1968 Invented by John Chowning, patented 1975 1983-1986: Yamaha DX7 160,000 sold 1990-1995: IBM PC-compatible Sound Cards 2000s: FM synthesis provides polyphonic ring tones

    ICM Week 4 8

  • 7/28/2019 04 Fm Synthesis

    5/20

    2/5/13

    5

    Copyright 2002-2013 by Roger B. Dannenberg

    FM and HarmonicsGenerated frequencies are:

    Where C = Carrier and M = ModulatorSimplest case: C = MGenerated frequencies are:

    C+nM gives us C, 2C, 3C, 4C,

    What about negative frequencies?

    ICM Week 4 9

    CnM

    Copyright 2002-2013 by Roger B. Dannenberg

    FM and Harmonics (2)

    ICM Week 4 10

    Bandwidth~2(D+M)C

    C

  • 7/28/2019 04 Fm Synthesis

    6/20

    2/5/13

    6

    Copyright 2002-2013 by Roger B. Dannenberg

    FM and Harmonics (3)

    ICM Week 4 11

    Bandwidth~2(D+M)C

    C

    Copyright 2002-2013 by Roger B. Dannenberg

    Classic FM brass soundCharacterized by a rise in upper partialsGenerated by increasing depth of modulationUses 1:1 Carrier:Modulation frequency

    See example in code_4.htm

    ICM Week 4 12

    More partials over time

  • 7/28/2019 04 Fm Synthesis

    7/20

    2/5/13

    7

    Copyright 2002-2013 by Roger B. Dannenberg

    Odd Harmonics

    ICM Week 4 13

    Let M = 2CResulting frequencies are C, 3C, 5C, Negative frequencies are -C, -3C, -5C, Try it

    CnM

    Copyright 2002-2013 by Roger B. Dannenberg

    Other Harmonic Schemes

    ICM Week 4 14

    Let M = i/j x C, for small integers i and jLet F = C/j, then M = iFC = jF, C+M = (i+j)F, C+2M = (2i+j)F, etc.All frequencies are harmonics (integer multiples)of F

    Try it

    CnM

  • 7/28/2019 04 Fm Synthesis

    8/20

    2/5/13

    8

    Copyright 2002-2013 by Roger B. Dannenberg

    Inharmonic Partials

    Let M = not i/j x CResulting frequencies are not harmonicsNegative frequencies are not harmonicsTry it

    ICM Week 4 15

    CnM

    Copyright 2002-2013 by Roger B. Dannenberg

    FormantsResonances (especially in the vocal tract)emphasize frequencies around the resonant

    frequency

    We can simulate resonances (and voice) byplacing a carrier near the desired resonant

    frequency and modulating it to create nearby

    harmonics:

    ICM Week 4 16

    C

    M

  • 7/28/2019 04 Fm Synthesis

    9/20

    2/5/13

    9

    Copyright 2002-2013 by Roger B. Dannenberg

    FM Variations SummaryChange C:M ratioPlace carrier at an upper partial to createformant effect

    Inharmonic ratios create metalic soundsSee code_4.htm for examples

    ICM Week 4 17

    Copyright 2002-2013 by Roger B. Dannenberg

    Listening FM Examples, Horner, Beauchamp, & Haken FM Examples, track 36, Current Directions, The

    importance of periodic and random vibrato in the

    perception of vocal tones is demonstrated by adding first

    a random and then a periodic vibrato.

    FM Examples, track 37, Current Directions, A male vocaltone can be synthesized with a small modification to the

    algorithm

    Dannenberg, The Side Band from Fanfares forTrumpet and Computer (AM, not FM)

    ICM Week 4 18

  • 7/28/2019 04 Fm Synthesis

    10/20

    2/5/13

    10

    Copyright 2002-2013 by Roger B. Dannenberg

    Project 2 (reminder)

    ICM Week 4 19

    Copyright 2002-2013 by Roger B. Dannenberg

    Use of Samples (Audio Taken From

    Other Recordings) Does the sample provide substantial musical material?

    Take an existing complete recording and change it with effects bad. Building a drum track from isolated snare samples ok. Processing a song beyond recognition probably ok.

    Does your piece offer a commentary on the sample? Irony? Mixing What a Wonderful World with machine gun fire: in principle this would be ok: the song

    is obviously a quote and youre making a commentary. But What a Wonderful World was

    recorded as a war protest song. Using someone elses irony as your own means the essence of

    your work is derivative.

    Is the material a quotation or a direct use? If you sample hey baby in the middle of a serene electronic soundscape, thats an obvious

    allusion to pop culture, maybe a commentary on commercialism, etc. Obviously a quotation. Its

    ok.

    If you sample hey baby in the middle of a rap tune, you are leveraging someone elses workand talent to augment your own work and effectively plagiarizing the sample. Not good.

    ICM Week 4 20

  • 7/28/2019 04 Fm Synthesis

    11/20

    2/5/13

    11

    Copyright 2002-2013 by Roger B. Dannenberg

    SummaryFM Synthesis

    Time varying spectra Low cost (simplest case is only 2 oscillators) Simple parametric control Musically useful results

    FM Control Carrier:Modulator ratio

    Harmonic or inharmonic spectra Odd or all harmonics Formants

    Depth of modulation Number of partials

    ICM Week 4 21

    Copyright 2002-2013 by Roger B. Dannenberg

    WEEK 4, DAY 2

    Behavioral AbstractionFilters

    ICM Week 4 22

  • 7/28/2019 04 Fm Synthesis

    12/20

    2/5/13

    12

    Copyright 2002-2013 by Roger B. Dannenberg

    Temporal Semantics and

    Behavioral AbstractionExtensions to ordinary (Lisp, SAL) semantics:

    Behaviors Evaluation environment Transformations Temporal combination: SEQ and SIM

    ICM Week 4 23

    Copyright 2002-2013 by Roger B. Dannenberg

    BehaviorsNyquist sound expressions denote a whole classof behaviors

    The specific sound computed by the expressiondepends upon the environment

    Transformations like STRETCH andTRANSPOSE alter the behavior.

    Behaviors vs. linear transformation: when youplay a longer note, you dont simply stretch the

    signal! The behavior concept is critical for music.

    ICM Week 4 24

  • 7/28/2019 04 Fm Synthesis

    13/20

    2/5/13

    13

    Copyright 2002-2013 by Roger B. Dannenberg

    Evaluation EnvironmentTo implement behavior concept, allNyquistexpressions evaluate within an environment.

    Nyquist environment includes: starting time,stretch factor, transposition, legato factor,

    loudness, sample rates, and more.

    Environment is hidden and changed oraccessed using special function-like constructs.

    ICM Week 4 25

    Copyright 2002-2013 by Roger B. Dannenberg

    Manipulating the EnvironmentExample:osc(c4) ~ 3

    Within STRETCH, all expressions see alteredenvironment and behave accordingly

    Scoping is dynamic:function tone() return osc(c4)

    play tone() ~ 3

  • 7/28/2019 04 Fm Synthesis

    14/20

    2/5/13

    14

    Copyright 2002-2013 by Roger B. Dannenberg

    Manipulating the EnvironmentExample:osc(c4) ~ 3

    Within STRETCH, all expressions see alteredenvironment and behave accordingly

    Scoping is dynamic:function tone() return osc(c4)

    play tone() ~ 3 Transformations can be nested:function tone() return osc(c4) ~ 2

    play tone() ~ 3 ICM Week 4 27

    Copyright 2002-2013 by Roger B. Dannenberg

    Absolute Transformations You can override the inherited environment:function tone2() return osc(c4) ~~ 2

    play tone2() ~ 100 Even though TONE2 is called with a stretch factor of 100,

    its STRETCH-ABS transformation overrides the

    environment and sets it to 2

    Once sound is computed by OSC(C4), the soundis immutable, i.e. not subject to transformation!!!!!

    ICM Week 4 28

  • 7/28/2019 04 Fm Synthesis

    15/20

    2/5/13

    15

    Copyright 2002-2013 by Roger B. Dannenberg

    The SOUND Typeosc(c4) ~~ 2 this is an expressionWhen evaluated, osc() uses the environment(especially start time and stretch factor) and

    returns a SOUND:

    ICM Week 4 29

    Start time

    Logical stop time

    Terminate timeSample Rate

    Copyright 2002-2013 by Roger B. Dannenberg

    Examplebeginwith x = osc(c4)

    play x ~ 3

  • 7/28/2019 04 Fm Synthesis

    16/20

    2/5/13

    16

    Copyright 2002-2013 by Roger B. Dannenberg

    Examplebeginwith x = osc(c4)

    play x ~ 3end

    function x() return osc(c4)play x() ~ 3 !

    ICM Week 4 31

    Copyright 2002-2013 by Roger B. Dannenberg

    Transformations

    STRETCH, STRETCH-ABS (~, ~~)AT, AT-ABS (@, @@)LOUD, LOUD-ABSSUSTAIN, SUSTAIN-ABSABS-ENV use default environmentSee manual for others.Maybe well talk about time-varyingtransformations later in semester.

    ICM Week 4 32

  • 7/28/2019 04 Fm Synthesis

    17/20

    2/5/13

    17

    Copyright 2002-2013 by Roger B. Dannenberg

    Practical NotesIn practice, the most critical transformations areAT (@) and STRETCH (~), which control when

    sounds are computed and how long they are.

    Technically, transformations are not functionsbecause they do not evaluate their arguments in

    the normal order: instead, they manipulate the

    environment, evaluate the behavior, then restore

    the environment.

    Implemented as macros in XLISPICM Week 4 33

    Copyright 2002-2013 by Roger B. Dannenberg

    SEQHow do we make a sequence of sounds:seq(osc(c4), osc(d4))

    Semantics: Evaluate osc(c4) at default time (t=0) Resulting sound has logical stop time of 1.0 Evaluate osc(d4) at start time t=1.0 Return the sum of the results

    ICM Week 4 34

  • 7/28/2019 04 Fm Synthesis

    18/20

    2/5/13

    18

    Copyright 2002-2013 by Roger B. Dannenberg

    Counterexample You MUST use seq with behavior expressions, not sound values: set x = osc(c4); compute soundssety = osc(d4);

    play seq(x, y) ; WRONG!!

    function x() return osc(c4); define

    function y() return osc(d4); behaviors

    play seq(x(), y()) ; RIGHT!!

    ICM Week 4 35

    Copyright 2002-2013 by Roger B. Dannenberg

    SIMSIMis exactly the same asSUMand +SIMevaluates a list of behaviors and forms theirsum (equivalent to audio mixing)

    sim(osc(c4), osc(g4))

    ICM Week 4 36

  • 7/28/2019 04 Fm Synthesis

    19/20

    2/5/13

    19

    Copyright 2002-2013 by Roger B. Dannenberg

    Example Using @play sim(osc(c4),

    osc(e4) @ 0.1,

    osc(g4) @ 0.2,

    osc(b4) @ 0.3),

    osc(d5) @ 0.4))

    ICM Week 4 37

    Copyright 2002-2013 by Roger B. Dannenberg

    Overlap With Logical Stop Timesplay seq(set-logical-stop(osc(c4), 0.1),

    set-logical-stop(osc(e4), 0.1),

    set-logical-stop(osc(g4), 0.1),

    set-logical-stop(osc(b4), 0.1),

    set-logical-stop(osc(d5), 0.1))

    ICM Week 4 38

    Logical stop time Physical stop time

    Starttim

    es

  • 7/28/2019 04 Fm Synthesis

    20/20

    2/5/13

    20

    Copyright 2002-2013 by Roger B. Dannenberg

    ScoresWeve seen scores alreadyTo evaluate a score, evaluate each soundexpression with the start time and stretch factor:

    {{start dur {instr parameters}} instr(parameters) ~ dur @ start

    Note: instr() ~ dur @ start instr() @ (start / dur) ~ dur

    ICM Week 4 39

    Copyright 2002-2013 by Roger B. Dannenberg

    SummarySOUNDS

    Start time Logical stop time Physical stop time

    Functions evaluated in an environment Dynamically scoped inherited across calls Modified by transformations

    Stretch (~) Shift (@)

    Results of functions (SOUNDS) are immutableSim and Seq control constructs

    ICM Week 4 40