diff options
author | Richard <q@1bpm.net> | 2025-04-13 18:48:02 +0100 |
---|---|---|
committer | Richard <q@1bpm.net> | 2025-04-13 18:48:02 +0100 |
commit | 9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22 (patch) | |
tree | 291bd79ce340e67affa755a8a6b4f6a83cce93ea /site/udo/cs81z.udo | |
download | apps.csound.1bpm.net-9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22.tar.gz apps.csound.1bpm.net-9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22.tar.bz2 apps.csound.1bpm.net-9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22.zip |
initial
Diffstat (limited to 'site/udo/cs81z.udo')
-rwxr-xr-x | site/udo/cs81z.udo | 208 |
1 files changed, 208 insertions, 0 deletions
diff --git a/site/udo/cs81z.udo b/site/udo/cs81z.udo new file mode 100755 index 0000000..37fd829 --- /dev/null +++ b/site/udo/cs81z.udo @@ -0,0 +1,208 @@ +#ifndef UDO_CS81Z
+#define UDO_CS81Z ##
+
+
+/*
+ license required! GPL
+*/
+
+#include "wavetables.udo"
+gitx_AR ftgen 0, 0, 32, -2, 0,647829,452377,322874,225473,160445,112801,80602,56434,40244,28328,20297,14152,10306,7237,5231,3687,2601,1765,1417,1000,822,572,440,400,380,310,278,165,135,130,125
+gitx_D1R ftgen 0,0,32,-2, -1000,3116605,2179104,1547622,1086731,778176,542607,389089,272208,450000,137953,98004,69000,48235,34239,24524,36000,27000,13859,5774,4387,3254,2040,1573,955,925,575,475,200,125,1,1
+gitx_D2R ftgen 0,0,32,-2, -1000,3101310,2168831,1551896,1084546,771475,541448,387275,270054,192173,134025,96252,67545,47431,34174,24459,17359,11987,8775,6000,4302,2885,2136,1415,1000,700,677,355,331,254,1,1
+gitx_RR ftgen 0,0,16,-2,0,1559542,779813,386094,192749,97322,48481,24041,11808,6038,2957,1570,858,350,118,1
+gitx_D1L ftgen 0,0,16,-2, 0,0.007943,0.01122,0.015849,0.022387,0.031623,0.044668,0.063096,0.089125,0.125893,0.177828,0.251189,0.358922,0.506991,0.716143,1
+gitx_alg[][] init 13, 10 ; ALGORITHMIC MATRIX CONNECTIONS
+gitx_alg fillarray 1,0,0,1,0,1,0, 0,0,0,
+ 1,0,0,1,1,0,0, 0,0,0,
+ 1,0,1,1,0,0,0, 0,0,0,
+ 1,1,0,0,0,1,0, 0,0,0,
+ 1,0,0,0,0,1,0, 0,1,0,
+ 0,0,1,0,1,1,0, 1,1,0,
+ 0,0,0,0,0,1,0, 1,1,0,
+ 0,0,0,0,0,0,0, 1,1,1,
+ 1,0,0,0,0,0,0, 0,0,0, ; only OP2 -> OP1
+ 0,0,0,0,0,0,0, 0,0,0, ; only OP1
+ 1,0,0,0,1,0,0, 0,0,0, ; OP4 -> OP2 -> OP1
+ 1,0,0,0,1,0,1, 0,0,0, ; FD(OP4) -> OP2 -> OP1
+ 1,0,0,1,1,0,1, 0,0,0 ; LATELY
+
+opcode _tx_envelope, k, iiiii
+ iAR,iD1R,iD1L,iD2R,iRR xin
+ iAR table iAR, gitx_AR
+ iD1R table iD1R, gitx_D1R
+ iD1L table iD1L, gitx_D1L
+ iD2R table iD2R, gitx_D2R
+ iRR table iRR, gitx_RR
+ iAR /= 96000
+ iD1R /= 96000
+ iD2R /= 96000
+ iRR /= 96000
+ kRR = iRR
+
+ xtratim iRR
+ kRel release
+
+ kEnv init 0
+ kSta init 0
+
+ kAdd transeg 0, 0.01, -8 ,1
+
+ if kRel > 0 kgoto Release
+ if kSta != 0 goto Next
+
+ kEnv += 1/(iAR*kr)
+ kEnv limit kEnv, 0, 1
+ if kEnv != 1 goto Out
+ kSta = 1
+
+Next:
+ if kSta != 1 goto Next2
+ if iD1R >= 0 goto Next1
+ goto Out
+Next1:
+ kEnv -= (1/(iD1R*kr))
+ kEnv limit kEnv, iD1L, 1
+ if kEnv != iD1L goto Out
+ kSta = 2
+Next2:
+ if iD2R >= 0 goto Next3
+ goto Out
+Next3:
+ kEnv -= 1/(iD2R*kr)
+ kEnv limit kEnv, 0, iD1L
+ goto Out
+Release:
+ kEnv -= 1/(kRR*kr)
+ kEnv limit kEnv, 0, 1
+Out:
+ xout kEnv^6.6*kAdd
+endop
+
+
+opcode _tx_lp, a, a
+ ;setksmps 1
+ aL xin
+ aD0 init 0
+ aD1 init 0
+ iA1 = -0.5100490981424427
+ iB0 = 1
+ iB1 = 1
+ aD2 = aD1
+ aD1 = aD0
+ aD0 = aL-aD1*iA1
+ aout = aD0*iB0+aD1*iB1
+ xout aout*0.24497545092877862
+endop
+
+opcode _tx_hp, a, a
+ ;setksmps 1
+ aL xin
+ aD0 init 0
+ aD1 init 0
+ iA1 = -0.99869495948492626
+ iB0 = 1
+ iB1 = -1
+ aD2 = aD1
+ aD1 = aD0
+ aD0 = aL-aD1*iA1
+ aout=aD0*iB0+aD1*iB1
+ xout aout*0.99934747974246307
+endop
+
+opcode _tx_filter, a, a
+ ain xin
+ xout _tx_lp(_tx_hp(ain))
+endop
+
+
+; instr tx_tbconstruct ; TABLE CONSTRUCTOR from 81z-hold
+
+
+opcode _tx_op, a, akiiiiiik
+ ;setksmps 1
+ ; iKVS - veloc sensivity level 0...7
+ aMod, kCarFreq,i1,i2,i3,i4,i5, iWave,kamp xin
+ aCarFreq = a(kCarFreq)
+ kEnv _tx_envelope i1,i2,i3,i4,i5
+ aPhase phasor aCarFreq
+ aCar tablei aPhase+aMod, iWave, 1, 0, 1
+ xout aCar * kEnv * kamp
+endop
+
+
+
+
+
+opcode tx_synth, a, k[]k[]ii[]k[]k[]i[]i[]i[]i[]i[]
+ kfreqs[], kamps[], ialgorithm, iwaves[], kindexmod[], kfdbk[], iattack[], id1rel[], id1lev[], id2rel[], id2lev[] xin
+
+ aOP4 init 0
+
+ ; ===4 OP ======
+ ; OP parameters:
+ ; mod in, car freq X, att, D1 rel, D1 lev, D2 rel, rel, Wave,KVS
+ aOP1 init 0
+ ain4 = aOP4*gitx_alg[ialgorithm][6]*kfdbk[3]
+
+ aOP4 _tx_op ain4,.5*kfreqs[0], iattack[0], id1rel[0], id1lev[0], id2rel[0], id2lev[0], iwaves[0],kamps[0]
+
+
+ aOP4 = aOP4*kindexmod[2]
+
+ ain3 = aOP4*gitx_alg[ialgorithm][5]*kfdbk[2]
+ aOP3 _tx_op ain3, kfreqs[1], iattack[1], id1rel[1], id1lev[1], id2rel[1], id2lev[1], iwaves[1],kamps[1] ;0.996
+ aOP3 = aOP3*kindexmod[1]
+
+ ain2 = (aOP3*gitx_alg[ialgorithm][3] + aOP4*gitx_alg[ialgorithm][4])*kfdbk[1]
+ aOP2 _tx_op ain2,kfreqs[2], iattack[2], id1rel[2], id1lev[2], id2rel[2], id2lev[2], iwaves[2],kamps[2]
+ aOP2 = aOP2*kindexmod[0]
+
+ ain1 = (aOP2*gitx_alg[ialgorithm][0] + aOP3*gitx_alg[ialgorithm][1] + aOP4*gitx_alg[ialgorithm][2])*kfdbk[0]
+ aOP1 _tx_op ain1,kfreqs[3], iattack[3], id1rel[3], id1lev[3], id2rel[3], id2lev[3], iwaves[3],kamps[3]
+
+ a0 = aOP1 + aOP2*gitx_alg[ialgorithm][7] + aOP3*gitx_alg[ialgorithm][8] + aOP4*gitx_alg[ialgorithm][9]
+ xout _tx_filter(a0)
+endop
+
+/*
+instr 1
+ if (gicount > 20) then
+ gifreqs[] chordmidicpsbyindex int(random(0, lenarray(gSchords)-1)), int(random:i(55, 70))
+ gicount = 0
+ else
+ gicount += 1
+ endif
+ imults[] fillarray 0.25, 0.5, 1, 1.5, 2
+
+ ibasefreq = gifreqs[int(random(0, lenarray(gifreqs)-1))]
+ iwaves[] fillarray wavetable_random(), wavetable_random(), wavetable_random(), wavetable_random()
+ kindexmod[] fillarray random(0, 3), random(0, 3), random(0, 3)
+ kfdbk[] fillarray random(0, 3), random(0, 3), random(0, 3), random(0, 3)
+ kfreqs[] fillarray ibasefreq*imults[int(random(0, lenarray(imults)-1))], ibasefreq*imults[int(random(0, lenarray(imults)-1))], ibasefreq*imults[int(random(0, lenarray(imults)-1))], ibasefreq*imults[int(random(0, lenarray(imults)-1))]
+ kamps[] fillarray random(0.5, 2), random(0.5, 2), random(0.5, 2), random(0.5, 2)
+ iattack[] fillarray random(0, 31), random(0, 31), random(0, 31), random(0, 31)
+ id1rel[] fillarray random(0, 31), random(0, 31), random(0, 31), random(0, 31)
+ id1lev[] fillarray random(0, 31), random(0, 31), random(0, 31), random(0, 31)
+ id2rel[] fillarray random(0, 15), random(0, 15), random(0, 15), random(0, 15)
+ id2lev[] fillarray random(0, 15), random(0, 15), random(0, 15), random(0, 15)
+
+ a1 tx_synth kfreqs, kamps, 4, iwaves, kindexmod, kfdbk, iattack, id1rel, id1lev, id2rel, id2lev
+
+ kamp linseg 1, p3*0.8, 1, p3*0.2, 0
+ kpan line random(0, 1), p3, random(0, 1)
+ outs a1*kamp*0.1*kpan, a1*kamp*0.1*(1-kpan)
+endin
+
+
+instr sched
+ krate random 0.2, 5
+ k1 metro krate
+ schedkwhen k1, 0, 0, 1, random:k(0, 2), random:k(1, 6)
+endin
+*.
+*/
+
+
+#end
+
|