Tuesday, July 19, 2011

fm-bell

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

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

; TODO - the envelopes are parametric in CLM. 
; Potentially they should be put in a table in the score. 

instr 1
  isinetbl      = 1
  idur          = p3
  iamp          = p4
  ifreq         = p5
  indx          = p6
  ifm1index     = 32.0 * ifreq
  ifm2index     = 4.0 * (8.0 - ifreq / 50.0)
  ifm3index     = ifm2index * 0.705 * (1.4 - ifreq / 250.0)
  ifm4index     = 32.0 * (20.0 - ifreq / 20.0)
  imod1freq     = ifreq * 2.0
  imod2freq     = ifreq * 1.41
  imod3freq     = ifreq * 2.82
  imod4freq     = ifreq * 2.4
  icar1freq     = ifreq
  icar2freq     = ifreq
  icar3freq     = ifreq * 2.4

  ; index envelope
  kindxenv  expseg 1.0, idur, .01


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


  ; modulator 1
  amod1phs  phasor  imod1freq
  amod1sig  tablei  amod1phs, isinetbl, 1, 0, 1

  amod1sig  = (ifm1index * indx * kindxenv) * amod1sig

  ; carrier 1
  acar1phs  phasor icar1freq + amod1sig
  acar1sig  tablei acar1phs, isinetbl, 1, 0, 1


  ; modulator 2
  amod2phs  phasor  imod2freq
  amod2sig  tablei  amod2phs, isinetbl, 1, 0, 1

  ; modulator 3
  amod3phs  phasor  imod3freq
  amod3sig  tablei  amod3phs, isinetbl, 1, 0, 1

  ; amod2sig now sums amod2sig and amod3sig
  amod2sig  = kindxenv * ((ifm2index * amod2sig) + (ifm3index * amod3sig))

  ; carrier 2
  acar2phs  phasor icar2freq + amod2sig
  acar2sig  tablei acar2phs, isinetbl, 1, 0, 1


  ; modulator 4
  amod4phs  phasor  imod4freq
  amod4sig  tablei  amod4phs, isinetbl, 1, 0, 1

  amod4sig  = (ifm4index * indx * kindxenv) * amod4sig


  ; carrier 3
  acar3phs  phasor  icar3freq + amod4sig
  acar3sig  tablei  acar3phs, isinetbl, 1, 0, 1

            out iamp * kampenv * (acar1sig + (0.15 * acar2sig) + (0.15 * acar3sig))

endin


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

; 1   2    3    4      5       6    
; #   st   drn  amp    freq    index
i 1   0    5.0  20000  233.046 0.750

e

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.