Monday, July 18, 2011

fm-gong

Here's a transliteration of the fm-gong from the CLM distribution:

Orch:
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

;
; This is fm-gong written by Paul Weineke and distributed with
; CLM (Common Lisp Music). The CLM original is in the file 
; fmex.ins. 
;


instr 1
  isinetbl      = 1
  idur          = p3
  iamp          = p4
  ifreq         = p5
  imod1fq       = ifreq * 1.16
  imod2fq       = ifreq * 3.14
  imod3fq       = ifreq * 1.005 
  indx1a        = .01 * imod1fq
  indx1b        = .30 * imod1fq
  indx1scaler   = indx1b - indx1a
  indx2a        = .01 * imod2fq
  indx2b        = .38 * imod2fq
  indx2scaler   = indx2b - indx2a
  indx3a        = .01 * imod3fq
  indx3b        = .50 * imod3fq
  indx3scaler   = indx3b - indx3a  


  ; mod1 envelope (CLM fmup)
  kmod1env  linseg  0, idur*0.75, 1, idur*.23, 1, idur*.02, 0

  ; mod2 envelope (CLM fmdwn)
  kmod2env  linseg  0, idur*.02, 1, idur*.98, 0

  ; mod3 envelope (CLM rise)
  kmod3env  linseg  0, idur*.15, 0.3, idur*.15, 1, idur*.45, 0.5, idur*.25, 0

  ; amp envelope
  kampenv   expseg .01, .002, 1, idur-.002, .01

  ; modulator1
  amod1phs  phasor  imod1fq
  amod1sig  tablei  amod1phs, isinetbl, 1, 0, 1

  amod1sig  = (indx1a + indx1scaler * kmod1env) * amod1sig

  ; modulator2
  amod2phs  phasor  imod2fq
  amod2sig  tablei  amod2phs, isinetbl, 1, 0, 1

  amod2sig  = (indx2a + indx2scaler * kmod2env) * amod2sig

  ; modulator3
  amod3phs  phasor  imod3fq
  amod3sig  tablei  amod3phs, isinetbl, 1, 0, 1

  amod3sig  = (indx3b + indx3scaler * kmod3env) * amod3sig


  ; carrier
  acarrphs  phasor  ifreq + amod1sig + amod2sig + amod3sig
  acarrsig  tablei  acarrphs, isinetbl, 1, 0, 1


            out iamp * kampenv * acarrsig


endin

Score:
; Table #1: sinewave
f 1 0 1024 10 1

; #   st   drn  amp    freq
i 1   0    3.0  20000  261.61



It was a lot easier to make this one than the fm-drum.

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.