Note I haven't given much attention to the envelopes.
sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 ; ; This is fm-tubular-bell from Nicky Hind\'s CLM tutorials: ; https://ccrma.stanford.edu/software/clm/compmus/clm-tutorials/fm2.html ; ; Note - amplitude in CLM is 0..1 in Csound it is 0..2^15 (I think...) instr 1 isinetbl = 1 idur = p3 iamp = p4 ifreq = p5 iampfrac = iamp / 32768 iamp1 = p6 ; default 0.5 iamp2 = p7 ; default 0.25 iamp3 = p8 ; default 0.25 iamp1level = iamp * iamp1 iamp2level = iamp * iamp2 iamp3level = iamp * iamp3 ic1rat = p9 ; default 2.0 im1rat = p10 ; default 5.0 ic2rat = p11 ; default 0.6 im2rat = p12 ; default 4.8 ic3rat = p13 ; default 0.22 im3rat = p14 ; default 0.83 indxmin = p15 ; default 0.15 indx1scl = p16 ; default 3.0 indx2scl = p17 ; default 2.0 indx3scl = p18 ; default 1.0 indx1max = iampfrac * indx1scl * ((261.5 / ifreq) ^ 3) indx2max = iampfrac * indx2scl * ((261.5 / ifreq) ^ 3) indx3max = iampfrac * indx3scl * ((261.5 / ifreq) ^ 3) imod1scaler = (indx1max - indxmin) * im1rat * ifreq imod2scaler = (indx2max - indxmin) * im2rat * ifreq imod3scaler = (indx3max - indxmin) * im3rat * ifreq imod1offset = indxmin * im1rat * ifreq imod2offset = indxmin * im2rat * ifreq imod3offset = indxmin * im3rat * ifreq ; index envelope kindxenv expseg 1.0, idur, .01 ; amp envelope kampenv expseg .01, .002, 1, idur-.002, .01 ; modulator 1 amod1phs phasor ifreq * im1rat amod1sig tablei amod1phs, isinetbl, 1, 0, 1 amod1sig = (imod1offset + imod1scaler * kindxenv) * amod1sig ; carrier 1 acar1phs phasor (ifreq * ic1rat) + amod1sig acar1sig tablei acar1phs, isinetbl, 1, 0, 1 acar1sig = iamp1level * kampenv * acar1sig ; modulator 2 amod2phs phasor ifreq * im2rat amod2sig tablei amod2phs, isinetbl, 1, 0, 1 amod2sig = (imod2offset + imod2scaler * kindxenv) * amod2sig ; carrier 1 acar2phs phasor (ifreq * ic2rat) + amod2sig acar2sig tablei acar2phs, isinetbl, 1, 0, 1 acar2sig = iamp2level * kampenv * acar2sig ; modulator 3 amod3phs phasor ifreq * im1rat amod3sig tablei amod3phs, isinetbl, 1, 0, 1 amod3sig = (imod3offset + imod3scaler * kindxenv) * amod3sig ; carrier 3 acar3phs phasor (ifreq * ic2rat) + amod2sig acar3sig tablei acar3phs, isinetbl, 1, 0, 1 acar3sig = iamp3level * kampenv * acar3sig out acar1sig + acar2sig + acar3sig endin
Score:
; Table #1: sinewave f 1 0 1024 10 1 ; 1 2 3 4 5 6 7 8 9 10 ; # st drn amp freq amp1 amp2 amp3 c1rat m1rat i 1 0 3.0 20000 261.61 0.5 0.25 0.25 2.0 5.0 ; 11 12 13 14 15 16 17 18 ; c2rat m2rat c3rat m3rat ixmin ixscl1 ixscl2 ixscl3 0.6 4.8 0.22 0.83 0.15 3.0 2.0 1.0 e