Sie sind auf Seite 1von 20

2/5/13

INTRODUCTION TO COMPUTER MUSIC

FM SYNTHESIS
Roger B. Dannenberg
Professor of Computer Science, Art, and Music

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

WEEK 4, DAY 1
Frequency Modulation FM Synthesis

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

2/5/13

Frequency Modulation
Frequency 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

Copyright 2002-2013 by Roger B. Dannenberg

Frequency Modulation with Nyquist


fmosc(basic-pitch, fm-control [, table [, phase]]) fm-control is expressed as deviation in Hz hzosc(fm-control) fm-control is absolute frequency in Hz snd-compose(f, g) Computes f(g(t)) if g is non-linear, frequency changes

occur

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

2/5/13

Examples
See Code 4 (code_4.htm)

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

Why FM Synthesis?
Weve already seen wavetable or table-lookup

synthesis:

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 Copyright 2002-2013 by Roger B. Dannenberg

2/5/13

FM Synthesis
When modulation frequency is in the audio range,

interesting things happen.

Number of significant partials is roughly the ratio of modulation amp (freq dev, D) to modulation freq. Modulation Frequency (M)
Bandwidth~2(D+M)

Carrier Frequency (C)


ICM Week 4 Copyright 2002-2013 by Roger B. Dannenberg

Mathematics of FM
The exact amplitudes of the partials generated by

FM are described by Bessel functions These functions are messy, their evolution is messier, 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 Copyright 2002-2013 by Roger B. Dannenberg

2/5/13

FM and Harmonics
Generated frequencies are:

C nM
Where C = Carrier and M = Modulator Simplest case: C = M Generated frequencies are:

C+nM gives us C, 2C, 3C, 4C, What about negative frequencies?

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

FM and Harmonics (2)

Bandwidth~2(D+M)

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

10

2/5/13

FM and Harmonics (3)

Bandwidth~2(D+M)

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

11

Classic FM brass sound


Characterized by a rise in upper partials Generated by increasing depth of modulation Uses 1:1 Carrier:Modulation frequency

More partials over time

See example in code_4.htm

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

12

2/5/13

Odd Harmonics
C nM
Let M = 2C Resulting frequencies are C, 3C, 5C, Negative frequencies are -C, -3C, -5C, Try it

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

13

Other Harmonic Schemes


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

of F Try it

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

14

2/5/13

Inharmonic Partials
C nM
Let M = not i/j x C Resulting frequencies are not harmonics Negative frequencies are not harmonics Try it

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

15

Formants
Resonances (especially in the vocal tract)

emphasize frequencies around the resonant frequency We can simulate resonances (and voice) by placing a carrier near the desired resonant frequency and modulating it to create nearby harmonics:
M

C
ICM Week 4 Copyright 2002-2013 by Roger B. Dannenberg

16

2/5/13

FM Variations Summary
Change C:M ratio Place carrier at an upper partial to create

formant effect Inharmonic ratios create metalic sounds See code_4.htm for examples

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

17

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 vocal

tone can be synthesized with a small modification to the algorithm


Dannenberg, The Side Band from Fanfares for

Trumpet and Computer (AM, not FM)


ICM Week 4 Copyright 2002-2013 by Roger B. Dannenberg

18

2/5/13

Project 2 (reminder)

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

19

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 work

and talent to augment your own work and effectively plagiarizing the sample. Not good.

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

20

10

2/5/13

Summary
FM 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 Copyright 2002-2013 by Roger B. Dannenberg

21

WEEK 4, DAY 2
Behavioral Abstraction Filters

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

22

11

2/5/13

Temporal Semantics and Behavioral Abstraction


Extensions to ordinary (Lisp, SAL) semantics: Behaviors Evaluation environment Transformations Temporal combination: SEQ and SIM

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

23

Behaviors
Nyquist sound expressions denote a whole class

of behaviors
The specific sound computed by the expression

depends upon the environment


Transformations like STRETCH and

TRANSPOSE alter the behavior.


Behaviors vs. linear transformation: when you

play a longer note, you dont simply stretch the signal! The behavior concept is critical for music.
ICM Week 4 Copyright 2002-2013 by Roger B. Dannenberg

24

12

2/5/13

Evaluation Environment
To implement behavior concept, all Nyquist

expressions evaluate within an environment.


Nyquist environment includes: starting time,

stretch factor, transposition, legato factor, loudness, sample rates, and more.
Environment is hidden and changed or

accessed using special function-like constructs.

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

25

Manipulating the Environment


Example:

osc(c4) ~ 3
Within STRETCH, all expressions see altered

environment and behave accordingly


Scoping is dynamic: function tone() return osc(c4) play tone() ~ 3 <? second sound> Transformations can be nested: function tone() return osc(c4) ~ 2 play tone() ~ 3 <? second sound>
ICM Week 4 Copyright 2002-2013 by Roger B. Dannenberg

26

13

2/5/13

Manipulating the Environment


Example:

osc(c4) ~ 3
Within STRETCH, all expressions see altered

environment and behave accordingly


Scoping is dynamic: function tone() return osc(c4) play tone() ~ 3 <3 second sound> Transformations can be nested: function tone() return osc(c4) ~ 2 play tone() ~ 3 <6 second sound>
ICM Week 4 Copyright 2002-2013 by Roger B. Dannenberg

27

Absolute Transformations
You can override the inherited environment:
function tone2() return osc(c4) ~~ 2 play tone2() ~ 100 <2 second tone>

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 sound

is immutable, i.e. not subject to transformation!!!!!

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

28

14

2/5/13

The SOUND Type


this is an expression When evaluated, osc() uses the environment (especially start time and stretch factor) and returns a SOUND:
osc(c4) ~~ 2

Start time

Sample Rate

Terminate time Logical stop time

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

29

Example
begin

with x play x end function play x() !

= osc(c4) ~ 3 <? second tone> x() return osc(c4) ~ 3 <? second tone>

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

30

15

2/5/13

Example
begin

with x play x end function play x() !

= osc(c4) ~ 3 <1 second tone> x() return osc(c4) ~ 3 <3 second tone>

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

31

Transformations
STRETCH, STRETCH-ABS (~, ~~) AT, AT-ABS (@, @@) LOUD, LOUD-ABS SUSTAIN, SUSTAIN-ABS ABS-ENV use default environment See manual for others. Maybe well talk about time-varying

transformations later in semester.


ICM Week 4 Copyright 2002-2013 by Roger B. Dannenberg

32

16

2/5/13

Practical Notes
In practice, the most critical transformations are

AT (@) and STRETCH (~), which control when sounds are computed and how long they are.
Technically, transformations are not functions

because 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 XLISP
ICM Week 4 Copyright 2002-2013 by Roger B. Dannenberg

33

SEQ
How 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

Copyright 2002-2013 by Roger B. Dannenberg

34

17

2/5/13

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

set y = 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

Copyright 2002-2013 by Roger B. Dannenberg

35

SIM
SIM is exactly the same as SUM and + SIM evaluates a list of behaviors and forms their

sum (equivalent to audio mixing) sim(osc(c4), osc(g4))

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

36

18

2/5/13

Example Using @
play sim(osc(c4),

osc(e4) osc(g4) osc(b4) osc(d5)

@ @ @ @

0.1, 0.2, 0.3), 0.4))

ICM Week 4

Copyright 2002-2013 by Roger B. Dannenberg

37

Overlap With Logical Stop Times


play seq(set-logical-stop(osc(c4), 0.1),

set-logical-stop(osc(e4), set-logical-stop(osc(g4), set-logical-stop(osc(b4), set-logical-stop(osc(d5),


Logical stop time

0.1), 0.1), 0.1), 0.1))

Physical stop time

ICM Week 4

ar St im tt es
Copyright 2002-2013 by Roger B. Dannenberg

38

19

2/5/13

Scores
Weve seen scores already To evaluate a score, evaluate each sound

expression 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

Copyright 2002-2013 by Roger B. Dannenberg

39

Summary
SOUNDS 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 immutable Sim and Seq control constructs
ICM Week 4 Copyright 2002-2013 by Roger B. Dannenberg

40

20

Das könnte Ihnen auch gefallen