An old message posted to the Csound list.(1999 or thereabouts). ;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 On Jan 17, 2008 4:03 AM, Jacob Joaquin wrote: > > As it would have it, I started to dabble with recreating a theremin waveform > a few days ago. Haven't gotten too far because of time restraints. I went > ahead and created a graph of the output from the Big Briar Etherwave with > various settings. You can download it here: > > http://www.thumbuki.com/images/fullsize/BigBriarEtherwaveWaveforms.gif > > Hopefully it will help. And I'm personally going to be keeping track of > this thread as I continue to move forward. > > Best, > Jake > ---- > The Csound Blog > http://www.thumbuki.com/csound/blog/ > > > > Mahound wrote: > > > > OK... we currently have three theories: > > - half-sine > > - sinusoidal through waveshaping distortion > > - filtered sawtooth > > > > -- > View this message in context: http://www.nabble.com/Theremin-sound-tp14875977p14887220.html > Sent from the Csound - General mailing list archive at Nabble.com. > > > > > Send bugs reports to this list. > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" >