Brian Wong 44100 1 2 44100 1 2 true false true false true true true true false false true true true true false false 0 false FMID-00 FMID is a realtime MIDI controlled basic single operator FM synth. You can set it to record to a soundfile by uncommenting the last three lines of the instrument code, however be aware that depending on your computer this may not work particularly well for fast notes or dense poiyphony. Pitchbend and modulation are both implemented and you can setup keyboard mappings for alternate tunings in the dropdown menu in the instrument editor. As examples I have setup standard 12-TET and 5-TET as options, where the 5-TET notes are only on the black keys of the keyboard and the white keys are silent. gi_tun_<INSTR_ID> ftgenonce 0,0,64,-2,<tundrop> gi_sine_<INSTR_ID> ftgenonce 0,0,16384,10,1 ; sine wave initc7 1,1,.5 ; initialize midi controller #1 on midi channel #1 to half of maximum value f 0 3600 0dbfs = 1 ; set 0dbfs ifq cpstmid gi_tun_<INSTR_ID> ; assign midi keys to tuning table kfq = ifq * <fundknob> ; fundamental frequency ratio iscale = 5000 ; scaling factor for note velocity iamp ampmidi iscale ; get midi note velocity kcar = <carknob> ; carrier ratio kmod = <modknob> ; modulator ratio iatt = <attime> ; attack time idec = <dectime> ; decay time isus = <suslvl> ; sustain level irel = <reltime> ; release time knv expsegr .0001,iatt,1,idec,isus,irel,.0001 ; apply amplitude envelope kndx ctrl7 1,1,<mimin>,<mimax> ; read midi controller 1/channel 1, and rescale for modulation index kporttime linseg 0,.001,.01,1,.01 ; ramping up function for portamento time - prevents vars gliding up at note onset kndx portk kndx, kporttime ; APPLY PORTAMENTO TO kndx TO SMOOTH ITS MOVEMENT kbend pchbend 1,<bend> ; set PITCH BEND VARIABLE size a1 foscil iamp,kfq*kbend,kcar,kmod,kndx,gi_sine_<INSTR_ID> a1 = a1 * knv ; apply amplitude modifications aLeft, aRight pan_gm2 a1,<pann> ; panning blueMixerOut aLeft,aRight ; output ; uncomment the next three lines to record in realtime ;aL,aR monitor ;fout "d:/hold/fmid0.wav",14,aL,aR ; write audio file to disk ;clear aL, aR tundrop 363 121 false 2h12TET 12,2,261.62558,60,1.0,1.05946309,1.12246205,1.18920712,1.25592105,1.33483985,1.41421356,1.49830708,1.58740105,1.68179283,1.78179744,1.88774863,2.0 2h5TET 12,2,261.62558,61,1.0,0,1.14869835,0,0,1.31950791,0,1.51571657,0,1.74110113,0,0,2.0 0 true 380 98 carknob 88 66 true 0.0 100.0 1.0 60 true 111 144 modknob 156 66 true 0.0 100.0 1.0 60 true 179 144 mimin 224 66 false 0.0 100.0 0.5 60 true 237 144 mimax 295 66 false 0.0 100.0 5.0 60 true 306 144 bend 89 183 false 1.0 8.0 1.122462 60 true 92 261 mimax1 -157 288 false 0.0 100.0 4.0 60 true -145 366 pann 21 183 true -1.0 1.0 0.0 60 true 39 261 fundknob 20 66 true 0.0 100.0 1.0 60 true 43 144 16 12 attime 158 183 false 0.0 10.0 0.0010 60 true 170 261 dectime 228 183 false 0.0 10.0 1.7265947 60 true 239 261 suslvl 299 183 false 0.0 10.0 3.8466096 60 true 307 261 reltime 367 183 false 0.0 10.0 1.8377976 60 true 373 261 pan_gm2 aa ak ain, kspace xin klast init -2 kleft init 0 kright init 0 ;from MIDI GM-2 Default Pan Curve (RP-036) ;Left Channel Gain [dB] = 20*log (cos (Pi/2* max(0,CC#10 ? 1)/126) ;Right Channel Gain [dB] = 20*log (sin (Pi /2* max(0,CC#10 ? 1)/126) if (kspace != klast) then kpercent = (kspace + 1) / 2 kleft = ampdb(20 * log(cos($M_PI_2 * kpercent))) kright = (kpercent == 0) ? 0 : ampdb(20 * log(sin($M_PI_2 * kpercent))) endif aleft = ain * kleft aright = ain * kright xout aleft, aright false 0.0 1 Master 0.0 false false Master Master 0.0 false false csound -Wdo devaudio -L stdin false false -1 -1 2.0 0.0 GenericScore -12566464 0 i1 0 2 3 4 5 2.0 0.0 root -10066279 0 true 64 0 false 1.0 0 5 1878081832 1878081834 true 0.0 -1.0 false false false PCH MIDI 12TET 261.62558 2.0 1.0 1.0594631 1.122462 1.1892071 1.2599211 1.3348398 1.4142135 1.4983071 1.587401 1.6817929 1.7817974 1.8877486