| Some time ago, well actually last year, there was some question about a
theremin orc/sco.
I made an attempt to simulate a theremin, but lost it in a disc-crash.
Here is a recreated version. I made it in Cecilia and modified the orc/sco
a little, so sorry for the long tables.
I had a frequency shifter also which used an am-modulated wave instead of the
stable oscilator, but I haven't recreated it yet.
Comments anyone?
Roger Klaveness
Here it comes, beware of wraping !!
;--------------------------------------------------------------------------------
;THEREMIN ORCHESTRA
sr = 44100
kr = 4410.0
ksmps = 10
nchnls = 1
gisintab ftgen 0,0,4096,10,1 ;sinwave
gipulltab ftgen 0,0,4096,9,0.5,1,0 ;for pulling distortion, see below
instr 1
;------------------------------------------------------------------------
;Theremin simulation instrument, Roger Klaveness Nov.-1998,
;Converted to Cecilia and back again Jan.-1999
;----------------------------------------------------------------------
;Control parameters
;Originaly generated by Cecilia global instrument
kpitch oscil1i 0,1,p3,1 ; 51 points
kvib oscil1i 0,1,p3,3 ; 101 points
kamp oscil1i 0,1,p3,2 ; 37 points
kvibfreq oscil1i 0,1,p3,4 ; 51 points
;---------------------------------------------
;random amp variation, for shaky hands
kshakeamphand randh 0.1,10
kamp = ampdb(kamp+kshakeamphand)
kvib oscil kvib,kvibfreq,gisintab
;random pitch variation, for shaky hands
kshakepitchhand randh 0.01,10
kpitch = cpsoct(kpitch+kvib+kshakepitchhand)
;-----------------------------------------------------------------------
;Simulation of real theremin
;To oscilators in radiofreq are combined with heterodyning to make an audible difference wave
;One could use a high samplerate to make it more like the real thing but that requires
;something like sr=400kHz , and that is probably not necesarry
;the freqspace is divided in 3
;0 - sr/6 : Audio freq we want, Diff-freq from modulation
;sr/6 - 2*sr/6 : Fixed and variable oscilator
;2*sr/6 - 3*sr/6 : Aliased Sum-freq from modulation
;Fixed oscilator sr/3
;Variable oscilator should be in range sr/3 -> sr/3-2000
;freq over sr/6 is filtered out
;---------------------------------------------
;oscilators
a1 oscil 1, sr/3, gisintab ; Fixed oscillator
a2 oscili 1, (sr/3)-kpitch, gisintab ; Variable oscillator
;---------------------------------------------
;pulling distorton
;look at http://www.paia.com/thereton.htm
;the two oscilators are mutualy influencing the other
;which causes distortion of their waveform
;this effect becomes greater as the freq get lower
;this is just experimentation from my side, and do probably
;not reflects the physics in this process
kpull = ((2000/kpitch)-1)/80 ;more effect at low freq, no eff > 2000Hz = sinwave
kpull = (kpull < 0 ? 0 : kpull)
kpull = (kpull > 0.5 ? 0.5 : kpull) ; not greater than 0.5 pull-factor
ap1shape table abs(a1),gipulltab,1 ; The osc get more affected at 45 degrees, just looked like that in illustration.
ap2shape table abs(a2),gipulltab,1 ; One could experiment with different phases of gipulltab to get different waveform, or maybe modulate it also
ap1 = a1+kpull*ap1shape*(a2*0.5+0.5)
ap2 = a2+kpull*ap2shape*(a1*0.5+0.5)
;---------------------------------------------
; Heterodyning = amplitudemodulation
ap1 = (0.5*ap1)+0.5
amix = (ap1*ap2)*kamp
;------------------------------------------------------------------------
;filter out unwanted freq
;10.order butterworth-lp, sr/6
ibgain=0.00001
iagain=-1
aout zfilter2 amix,1,1,10,10,ibgain*.0027,ibgain*.0273,ibgain*.1230,ibgain*.3281,ibgain*.5742,ibgain*.6891,ibgain*.5742,ibgain*.3281,ibgain*.1230,ibgain*.0273,ibgain*.0027,iagain*-7.4907,iagain*25.4989,iagain*-51.8964,iagain*69.8813,iagain*-65.0115,iagain*42.2946,iagain*-18.9909,iagain*5.6301,iagain*-0.9948,iagain*0.0795
;passing frequencies above 25Hz , get away dc
aout butterhp aout, 25
aout balance aout,amix
;------------------------------------------------------------------------
;some tube-overdrive simulation
anorm = aout / 32767
aout = aout - (anorm*anorm*anorm)*10922; some distortion : x-(x^3)/3
;------------------------------------------------------------------------
;output
out aout
;------------------------------------------------------------------------
endin
;--------------------------------------------------------------------------------
;THEREMIN SCORE
;control tables from Cecilia
f 1 0 8192 -7 3.36000 163.840 3.39406 163.840 3.49572 163.840 3.66336 163.840 3.89435 163.840 4.18504 163.840 4.53084 163.840 4.92631 163.840 5.36521 163.840 5.84061 163.840 6.34503 163.840 6.87049 163.840 7.40872 163.840 7.95123 163.840 8.48946 163.840 9.01493 163.840 9.51934 163.840 9.99475 163.840 10.43365 163.840 10.82913 163.840 11.17494 163.840 11.46563 163.840 11.69662 163.840 11.86427 163.840 11.96593 163.840 12.00000 163.840 11.96594 163.840 11.86429 163.840 11.69665 163.840 11.46566 163.840 11.17497 163.840 10.82917 163.840 10.43370 163.840 9.99480 163.840 9.51940 163.840 9.01499 163.840 8.48952 163.840 7.95129 163.840 7.40878 163.840 6.87055 163.840 6.34508 163.840 5.84067 163.840 5.36526 163.840 4.92636 163.840 4.53088 163.840 4.18507 163.840 3.89437 163.840 3.66338 163.840 3.49573 163.840 3.39407 163.840 3.36000 ; pitch
f 3 0 8192 -7 0.01323 81.920 0.01095 81.920 0.02491 81.920 0.05155 81.920 0.08411 81.920 0.11431 81.920 0.13449 81.920 0.13951 81.920 0.12810 81.920 0.10316 81.920 0.07102 81.920 0.03986 81.920 0.01758 81.920 0.00985 81.920 0.01864 81.920 0.04171 81.920 0.07319 81.920 0.10510 81.920 0.12932 81.920 0.13970 81.920 0.13359 81.920 0.11257 81.920 0.08195 81.920 0.04953 81.920 0.02354 81.920 0.01059 81.920 0.01396 81.920 0.03280 81.920 0.06233 81.920 0.09503 81.920 0.12260 81.920 0.13804 81.920 0.13742 81.920 0.12090 81.920 0.09268 81.920 0.05992 81.920 0.03096 81.920 0.01314 81.920 0.01101 81.920 0.02509 81.920 0.05181 81.920 0.08439 81.920 0.11454 81.920 0.13460 81.920 0.13948 81.920 0.12794 81.920 0.10290 81.920 0.07074 81.920 0.03962 81.920 0.01744 81.920 0.00986 81.920 0.01878 81.920 0.04195 81.920 0.07348 81.920 0.10535 81.920 0.12947 81.920 0.13971 81.920 0.13347 81.920 0.11233 81.920 0.08167 81.920 0.04927 81.920 0.02337 81.920 0.01055 81.920 0.01406 81.920 0.03302 81.920 0!
!
.06261 81.920 0.09530 81.920 0.12280 81.920 0.13811 81.920 0.13735 81.920 0.12070 81.920 0.09241 81.920 0.05965 81.920 0.03075 81.920 0.01306 81.920 0.01106 81.920 0.02527 81.920 0.05208 81.920 0.08467 81.920 0.11476 81.920 0.13471 81.920 0.13945 81.920 0.12777 81.920 0.10265 81.920 0.07045 81.920 0.03938 81.920 0.01731 81.920 0.00986 81.920 0.01893 81.920 0.04220 81.920 0.07376 81.920 0.10560 81.920 0.12963 81.920 0.13973 81.920 0.13335 81.920 0.11210 81.920 0.08139 81.920 0.04901 81.920 0.02320 81.920 0.01051 81.920 0.01416 ; vib
f 2 0 8192 -7 0.00000 407.689 67.38916 242.065 76.92118 726.196 74.70443 420.429 72.26601 165.624 67.38916 50.961 63.17734 116.956 59.78982 163.840 51.61728 163.840 51.73783 163.840 60.08530 163.840 72.07724 163.840 81.13053 163.840 82.27526 163.840 74.88301 163.840 63.01185 163.840 53.17860 163.840 50.78133 163.840 57.13606 163.840 68.75428 163.840 79.25803 163.840 82.88115 163.840 77.63468 163.840 66.39874 163.840 55.34143 163.840 50.53279 163.840 54.61259 163.840 65.34117 163.840 76.82894 163.840 82.76956 163.840 79.90185 229.835 70.49261 242.065 62.51232 331.247 51.87192 318.507 76.25616 879.079 69.82759 293.026 0.00000 ; amp
f 4 0 8192 -7 7.75670 163.840 7.86874 163.840 8.04935 163.840 8.22465 163.840 8.02721 163.840 8.27651 163.840 7.91253 163.840 8.27002 163.840 8.63073 163.840 8.84151 163.840 8.83530 163.840 8.74292 163.840 8.53288 163.840 8.36684 163.840 8.10824 163.840 7.87147 163.840 7.54927 163.840 7.90565 163.840 8.27201 163.840 8.13383 163.840 7.94557 163.840 7.56107 163.840 7.51721 163.840 7.45809 163.840 7.23735 163.840 7.28621 163.840 7.68450 163.840 8.02240 163.840 7.79029 163.840 7.68422 163.840 7.86449 163.840 8.25488 163.840 8.01998 163.840 8.40820 163.840 8.39779 163.840 8.43364 163.840 8.79206 163.840 8.96129 163.840 9.27505 163.840 9.08682 163.840 9.42215 163.840 9.49660 163.840 9.33687 163.840 9.39254 163.840 9.27586 163.840 9.21725 163.840 9.47389 163.840 9.53438 163.840 9.32429 163.840 9.53184 163.840 9.38217 ; vibfreq
;theremin sweep
i1 0 28.4 |