Brian Wong44100124410012truefalsetruefalsetruetruetruetruefalsefalsetruetruetruetruefalsefalse0falseFMID-00FMID 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 36000dbfs = 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, aRtundrop363121false2h12TET12,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.02h5TET12,2,261.62558,61,1.0,0,1.14869835,0,0,1.31950791,0,1.51571657,0,1.74110113,0,0,2.00true38098carknob8866true0.0100.01.060true111144modknob15666true0.0100.01.060true179144mimin22466false0.0100.00.560true237144mimax29566false0.0100.05.060true306144bend89183false1.08.01.12246260true92261mimax1-157288false0.0100.04.060true-145366pann21183true-1.01.00.060true39261fundknob2066true0.0100.01.060true431441612attime158183false0.010.00.001060true170261dectime228183false0.010.01.726594760true239261suslvl299183false0.010.03.846609660true307261reltime367183false0.010.01.837797660true373261pan_gm2aaakain, 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, arightfalse0.01Master0.0falsefalseMasterMaster0.0falsefalsecsound -Wdo devaudio -L stdinfalsefalse-1-12.00.0GenericScore-125664640i1 0 2 3 4 52.00.0root-100662790true640false1.00518780818321878081834true0.0-1.0falsefalsefalsePCHMIDI12TET261.625582.01.01.05946311.1224621.18920711.25992111.33483981.41421351.49830711.5874011.68179291.78179741.8877486