-odac sr = 44100 ksmps = 16 nchnls = 2 nchnls_i = 1 0dbfs = 2 seed 0 #include "interop.udo" #include "bussing.udo" #include "synth_instruments.udo" #include "synth_drums.udo" #include "sounddb.udo" #include "wavetables.udo" giocsicol_harmonics sounddb_getcollectionid "Guitar.Harmonics", 1 isize = sr * 60 giocsi_fnrecord[] fillarray ftgen(0, 0, isize, 2, 0), ftgen(0, 0, isize, 2, 0) giosci_loopend = isize giocsi_instrument = 0 instr ocsi_recordstart p3 = 99999 aL, aR bus_tap "ocsi" apos lphasor 1, 0, giosci_loopend, 1 tablew aL, apos, giocsi_fnrecord[0] tablew aR, apos, giocsi_fnrecord[1] endin instr ocsi_recordstop turnoff2 "ocsi_recordstart", 0, 1 turnoff endin instr ocsi_recordclear endin opcode ocsi_defaultinput, kk, 0 kamp chnget "valY" knote chnget "note" xout kamp, knote endop instr ocsinst_blockbass kamp, knote ocsi_defaultinput aL, aR synth_fmbass1, cpsmidinn(knote) - 12 kenv linsegr 1, p3, 1, 0.2, 0 aL *= kenv * kamp aR *= kenv * kamp bus_mix("ocsi", aL, aR) endin instr ocsinst_303 ky, knote ocsi_defaultinput ifilter = (chnget:i("valY") * 50) + 50 kdistortion = (1 - ky) + 1 aout synth_303 cpsmidinn(knote), ifilter, kdistortion kenv linsegr 1, p3, 1, 0.2, 0 aout *= kenv bus_mix("ocsi", aout, aout) endin instr ocsinst_strings ky, knote ocsi_defaultinput kfreq = cpsmidinn(knote) aL synth_strings1 kfreq, 0.01 * random(0.5, 1.5) * ky * 4, 6 * random(0.5, 1.5) * ky, 0.1 * random(0.5, 1.5), 0.1 * random(0.5, 1.5) aR synth_strings1 kfreq, 0.01 * random(0.5, 1.5) * ky * 4, 6 * random(0.5, 1.5) * ky, 0.1 * random(0.5, 1.5), 0.1 * random(0.5, 1.5) kenv linsegr 1, p3, 1, 0.2, 0 aL *= kenv aR *= kenv bus_mix("ocsi", aL, aR) endin instr ocsinst_guitarharmonics ky, knote ocsi_defaultinput istartnote = chnget:i("note") knote init istartnote ifileid, ipitchratio sounddb_mel_nearestnote giocsicol_harmonics, chnget:i("note") ifn, ichannels, iduration, irmsnorm sounddb_get ifileid ipitchadjust = ipitchratio* (ftsr(ifn) / sr) kpitch = (cpsmidinn(knote) / cpsmidinn(istartnote)) * ipitchadjust krate = (ky * 10) + 1 apos = a(ky) * iduration;abs:k(oscil:k(iduration * 0.5, krate)) + (iduration * 0.1) aL, aR sndwarpst 1, apos, a(port(kpitch, 0.01, ipitchadjust)), ifn, 0, 4410, 441, 4, gifnHanning, 1 kenv linsegr 0, 0.1, 1, p3 - 0.1, 1, 0.2, 0 aL *= kenv aR *= kenv bus_mix("ocsi", aL, aR) endin instr ocsinst_guitarharmonicsfx ky, knote ocsi_defaultinput istartnote = chnget:i("note") knote init istartnote ifileid, ipitchratio sounddb_mel_nearestnote giocsicol_harmonics, chnget:i("note") ifn, ichannels, iduration, irmsnorm sounddb_get ifileid ipitchadjust = ipitchratio * (ftsr(ifn) / sr) kpitch = (cpsmidinn(knote) / cpsmidinn(istartnote)) * ipitchadjust krate = (ky * 10) + 1 apos = ((a(ky) * abs:k(oscil:k(random(0.2, 1), random(2, 10)))) + 0.1) * iduration aL, aR sndwarpst 1, apos, a(port(kpitch * 0.5, 0.01, ipitchadjust)), ifn, 0, 4410, 441, 1, gifnHanning, 1 ahL1, ahL2 hilbert2 aL, 1024, 256 amL, afmL fmanal ahL1, ahL2 aL oscil amL, afmL * 2 ahR1, ahR2 hilbert2 aR, 1024, 256 amR, afmR fmanal ahR1, ahL2 aR oscil amR, afmR * 2 aL butterhp aL, 500 aR butterhp aR, 500 ;aL reverb aL, 2 * (ky + 2) ;aR reverb aR, 2 * (ky + 2) aL tanh aL aR tanh aR kenv linsegr 1, p3 - 0.1, 1, 0.2, 0 aL *= kenv aR *= kenv bus_mix("ocsi", aL, aR) endin instr osci_recordplaystart p3 = -1 apos lphasor 1, 0, giosci_loopend, 1 aL table3 apos, giocsi_fnrecord[0] aR table3 apos, giocsi_fnrecord[1] bus_mix("bufferplay", aL, aR) endin instr osci_recordplaystop turnoff2 "osci_recordplaystart", 0, 1 turnoff endin instr ocsi_setinstrument Sinstr = strget(p4) turnoff2 giocsi_instrument, 0, 1 giocsi_instrument = nstrnum(Sinstr) turnoff endin instr ocsi_play schedule giocsi_instrument, 0, 99999 turnoff endin instr ocsi_stop turnoff2 giocsi_instrument, 0, 1 turnoff endin instr ocsi_mixer aLm, aRm bus_read "ocsi" aLb, aRb bus_read "bufferplay" aL = aLm + aLb aR = aRm + aRb outs aL, aR endin instr osci_boot schedule "ocsi_mixer", 0, -1 endin f0 z i"osci_boot" 0 1