<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform-odac;;;RT audio out;-iadc ;;;uncomment -iadc if RT audio input is needed too; For Non-realtime ouput leave only the line below:; -o xyscale.wav -W ;;; for file output any platform; By Stefano Cucchi 2020</CsOptions><CsInstruments>sr=44100ksmps=32nchnls=20dbfs=1instr1; In the instr 1 using f1 and f2 you reach the 4 corners (values)k00=p4k10=p5k01=p6k11=p7kxoscil1,p8,p9kyoscil1,p10,p11kout1xyscalekx,ky,k00,k10,k01,k11kout2xyscalekx,ky,k00*3/2,k10*4/3,k01*5/4,k11*6/5a1buzz0.2,kout1,8,3a2buzz0.2,kout2,4,3outsa1,a2endininstr2; In the instr 2 setting the first value to 0 or 1 (p8 & p9) you can start from the corner (value) you wantk00=p4k10=p5k01=p6k11=p7kxrandomh0,1,2,2,p8; p8 is the X starting valuekyrandomh0,1,2,2,p9; p9 is the Y starting valuekout1xyscalekx,ky,k00,k10,k01,k11kout2xyscalekx,ky,k00*3/2,k10*4/3,k01*5/4,k11*6/5a1buzz0.2,kout1,8,3a2buzz0.2,kout2,4,3outsa1,a2endin</CsInstruments><CsScore>f101024-704000100140011240f201024-7020001001400110002241f301024101i10103004005006000.310.22i2101030041052063000e</CsScore></CsoundSynthesizer>
Here is another example of the xyscale opcode. It uses the file xyscale-FLTK.csd.
<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform; Audio out Audio in No messages-odac-iadc-d;;;RT audio I/O</CsOptions><CsInstruments>ksmps=128nchnls=2giwidth=400giheight=300FLpanel"FLmouse",giwidth,giheight,10,10FLpanelEndFLrun0dbfs=1instr1; We define four chords for bottom-left, bottom-right, top-left and top-right; Use the mouse to interpolate between themibl[]fillarrayntom:i("4C"),ntom:i("4Eb"),ntom:i("4G")itl[]fillarrayntom:i("4E"),ntom:i("4G#"),ntom:i("4B")ibr[]fillarrayntom:i("4G"),ntom:i("4A"),ntom:i("4B")itr[]fillarrayntom:i("4Eb"),ntom:i("4Eb+"),ntom:i("4F")kmousex,kmousey,kb1,kb2,kb3FLmouse2kx=limit(kmousex/giwidth,0,1)ky=1-limit(kmousey/giheight,0,1)printf"x: %f y: %f\n",changed(kx,ky),kx,kyiamp=0.1a0osciliiamp,mtof(xyscale(kx,ky,ibl[0],itl[0],ibr[0],itr[0]))a1osciliiamp,mtof(xyscale(kx,ky,ibl[1],itl[1],ibr[1],itr[1]))a2osciliiamp,mtof(xyscale(kx,ky,ibl[2],itl[2],ibr[2],itr[2]))aout=sum(a0,a1,a2)outsaout,aoutendin</CsInstruments><CsScore>i10120</CsScore></CsoundSynthesizer>