Skip to content

Instantly share code, notes, and snippets.

@jacobjoaquin
Created October 19, 2010 19:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacobjoaquin/634966 to your computer and use it in GitHub Desktop.
Save jacobjoaquin/634966 to your computer and use it in GitHub Desktop.
FM Synthesis with foscil
FM Synthesis with foscil
Jacob Joaquin
October 19, 2010
jacobjoaquin@gmail.com
csoundblog.com
<CsoundSynthesizer>
<CsInstruments>
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
0dbfs = 1.0
instr 1
idur = p3 ; Duration
iamp = p4 ; Amplitude
ipch = cpspch(p5) ; Pitch
icar = p6 ; Carrier ratio
imod = p7 ; Modulator ratio
i_index = p8 ; Index of modulation
kenv line i_index, idur, 0 ; Index envelope
a1 foscil iamp, ipch, icar, imod, kenv, 1, -1 ; FM oscillator
out a1
endin
</CsInstruments>
<CsScore>
; Sine table
f 1 0 8192 10 1
; Set tempo
t 0 120
; Events
i 1 0 1 0.707 7.07 1 1 1
i 1 + . . . . . 2
i 1 + . . . . . 4
i 1 + . . . . . 8
i 1 + . . . . 2 1
i 1 + . . . . . 2
i 1 + . . . . . 4
i 1 + . . . . . 8
i 1 + . . . . 3 1
i 1 + . . . . . 2
i 1 + . . . . . 4
i 1 + . . . . . 8
i 1 + . . . . 4 1
i 1 + . . . . . 2
i 1 + . . . . . 4
i 1 + . . . . . 8
i 1 + . . . . 1.05 1
i 1 + . . . . . 2
i 1 + . . . . . 4
i 1 + . . . . . 8
i 1 + . . . . 1.25 1
i 1 + . . . . . 2
i 1 + . . . . . 4
i 1 + . . . . . 8
i 1 + . . . . 1.618 1
i 1 + . . . . . 2
i 1 + . . . . . 4
i 1 + . . . . . 8
i 1 + . . . . 1.789 1
i 1 + . . . . . 2
i 1 + . . . . . 4
i 1 + . . . . . 8
</CsScore>
</CsoundSynthesizer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment