A General-Purpose UI for Csound on Android
Spurred on by some friends, I went on to put together a simple UI for playing with Csound on Android. Basically, I put together five sliders, five press buttons and a trackpad, plus accelerometer. This simple app can run CSD files that can tap the values in the controls, via the chnget opcode and named channels. It has a browse button that lets users load in a CSD from the filesystem.
A few user instructions are in order:
1. controls are all 0-1 except accelerometer that has much narrower range and has to be amplified by around 1000 to give significant range.
2. channel names are as in the UI (slider1 etc.). Buttons have 2 extra channels “channel_name.x” and “channel_name.y” with the touch coordinates;
trackpad has 2 also: trackpad.x and trackpad.y
3. buttons are press-down rather than trigger: 1 down 0 otherwise. Their x and y will also be 0 when there is no touch (idem with trackpad)
4. accelerometer channel names are: ”accelerometerX”, ”accelerometerY” and ”accelerometerZ”
5. On my tab the UI does not allow 2 controls to be adjusted simultaneously (I think this might be an Android limitation), so buttons etc
are “monophonic”. Trackpad is monophonic, but this might change in the next version, once I work out a channel naming scheme.
6. The on/off switch will go off at the end of the performance, if you reach it.
A very basic CSD showing an example of how to access controls is shown below. Users can supply their own Csound code to run with the app.
<CsoundSynthesizer> <CsOptions> -odac -+rtaudio=null -d </CsOptions> <CsInstruments> nchnls = 1 instr 1 idur = p3 iamp = p4*0dbfs icps = p5 iatt = p6 idec = p7 itab = p8 k3 init 1 k1 chnget "slider1" k1 port k1+1, 0.01, 1 a1 expseg 1,idur-idec,1,idec, 0.001 a2 linen a1, iatt, idur, 0.005 a3 oscili a2*iamp, icps*k1, itab k3 chnget "trackpad.x" k3 portk k3, 0.01 out a3*k3 chnmix a3*k3, "reverb" endin instr 100 asig chnget "reverb" a1,a2 freeverb asig,asig, 0.8, 0.7 out (a1+a2)*0.1 chnclear "reverb" endin </CsInstruments> <CsScore> ; example function table f 1 0 16384 10 1 ; example event ; ins st end amp cps att dec tab i 1 0 3600 0.5 440 0.01 .9 1 i 100 0 -1 </CsScore> </CsoundSynthesizer>
Finally, here is the link to the app:
The source code and Eclipse project can be found in csound5 git: