//matt mitchell //ccrma mobile synth workshop 6/2017 // //based on henry cowell's and léon theramin's rhythmicon //https://en.wikipedia.org/wiki/Rhythmicon // //and on a tuning system by la monte young, as described by kyle gann: //http://www.kylegann.com/PNM-WellTunedPiano.pdf // declare interface "SmartKeyboard{ 'Number of Keyboards':'3', 'Max Keyboard Polyphony':'10', 'Keyboard 0 - Number of Keys':'5', 'Keyboard 1 - Number of Keys':'5', 'Keyboard 2 - Number of Keys':'5', 'Keyboard 3 - Number of Keys':'5', 'Keyboard 4 - Number of Keys':'5', 'Keyboard 0 - Piano Keyboard' : '0', 'Keyboard 1 - Piano Keyboard' : '0', 'Keyboard 2 - Piano Keyboard' : '0', 'Keyboard 3 - Piano Keyboard' : '0', 'Keyboard 4 - Piano Keyboard' : '0', 'Keyboard 0 - Key 0 - Label':'49/32', 'Keyboard 0 - Key 1 - Label':'147/128', 'Keyboard 0 - Key 2 - Label':'441/256', 'Keyboard 0 - Key 3 - Label':'1323/1024', 'Keyboard 1 - Key 0 - Label':'7/4', 'Keyboard 1 - Key 1 - Label':'21/16', 'Keyboard 1 - Key 2 - Label':'63/32', 'Keyboard 1 - Key 3 - Label':'189/128', 'Keyboard 1 - Key 4 - Label':'567/512', 'Keyboard 2 - Key 0 - Label':'1/1', 'Keyboard 2 - Key 1 - Label':'3/2', 'Keyboard 2 - Key 2 - Label':'9/8', 'Keyboard 0 - Send X':'0', 'Keyboard 1 - Send X':'0', 'Keyboard 2 - Send X':'0', 'Keyboard 0 - Send Y':'0', 'Keyboard 1 - Send Y':'0', 'Keyboard 2 - Send Y':'0', 'Rounding Mode':'0' }"; import("stdfaust.lib"); keyboard = hslider("keyboard",0,0,2,1) : int; key = hslider("key",0,0,4,1) : int; keyID = (keyboard*5) + key; gate = button("gate") : si.smoo; pitchref = 220; timeref = hslider("timeref[acc: 0 0 -10 0 10]", 2,0.1,7,0.01) : si.smoo; drive = hslider("drive[acc: 1 3 -10 0 10]", 0,0,1,0.01) : si.smoo; ratio = (49/32) * (keyID==0) + (147/128) * (keyID==1) + (441/256) * (keyID==2) + (1323/1024) * (keyID==3) + //keyID 4 is blank (7/4) * (keyID==5) + (21/16) * (keyID==6) + (63/32) * (keyID==7) + (189/128) * (keyID==8) + (567/517) * (keyID==9) + (1/1) * (keyID==10) + (3/2) * (keyID==11) + (9/8) * (keyID==12); pan = os.osc(ratio*timeref/3.5)*0.3+0.5; process = os.sawtooth(pitchref*ratio) * (os.osc(timeref*ratio)+1)/2*gate :ef.cubicnl(drive,0) : fi.resonlp((12000)*(os.osc(ratio/7)+4)/5,7,1) <: _*pan,_*(1-pan) : dm.zita_rev1;