giuliomoro Thanks for the quick reply. I was able to fix the runide error - the instrument I wanted to use had the same instr number as the default instruments (1 and 2) that are created upon starting a new project within the IDE. I just had to change my instrument to a different number.
However, I want to "play" my instrument with my MIDI keyboard. This works fine in Csound as a standalone but I'm not hearing any sound when I play my keyboard. I have an Alesis VI61 plugged into the USB port of the Bela, and upon entering "lsusb" and "amidi -l" in the Bela console, I get the following:
root@bela ~/Bela# lsusb
Bus 002 Device 002: ID 13b2:0085 Alesis
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@bela ~/Bela# amidi -l
Dir Device Name
IO hw:0,0 f_midi
IO hw:1,0,0 VI61 MIDI 1
IO hw:1,0,1 VI61 MIDI 2
This is what the console says when I run my instrument:
Building project ...
Build finished
Running project ...
0"070.937| WARNING: [main] duplicate call from main program to xenomai_init() ignored
0"071.424| WARNING: [main] (xeno-config --no-auto-init disables implicit call)
WARNING: [mError opening plugin directory '/usr/local/lib/csound/plugins-6.0': No such file or directory[m
[m0dBFS level = 32768.0
--Csound version 6.14 (float samples) Mar 11 2020
[commit: 4c7d6882d2327be60bfd183f6ac3b63b6a7327c9]
libsndfile-1.0.27
realtime mode enabled
UnifiedCSD: /root/Bela/projects/touchysines/_main.csd
STARTING FILE
Creating options
Creating orchestra
closing tag
Creating score
realtime mode enabled
sorting score ...
... done
setting dummy interface
displays suppressed
0dBFS level = 1.0
orch now loaded
audio buffered in 256 sample-frame blocks
SECTION 1:
Initialising spinlock...
Starting realtime mode queue: 0xb4a21010 thread: 0x1a28f8
1 mode switch detected on the audio thread.
And finally, here is my instrument's code:
<CsoundSynthesizer>
<CsOptions>
-m0d
</CsOptions>
<CsInstruments>
ksmps = 8
nchnls = 2
0dbfs = 1
instr 101
iamp ampmidi 1
ifreq cpsmidi
imodindx midic7 1, 0, 20
ifreqatk midic7 25, 0.00001, 1
ifreqsus = 20
imodatk midic7 23, 0.01, 3
imodsus midic7 24, 0.01, 5
iatk midic7 20, 0.01, 0.5
idec midic7 21, 0.3, 10
irel midic7 22, 0.1, 2
ichor midic7 26, 0.001, 0.1
ivibr midic7 27, 0, 10
kamp madsr iatk, idec, 0, irel
klfo lfo ivibr, 9
kfreq linsegr 20, ifreqatk, ifreq, ifreqsus, ifreq, irel, 20
kmodindx linsegr 0, imodatk, imodindx, imodsus, imodindx, idec, 0, irel, 0
aosc1 foscil iamp, kfreq+klfo, 1, 1, kmodindx, 3
aosc2 foscil iamp, (kfreq+klfo)*(1-ichor), 1, 1, kmodindx, 3
aosc3 foscil iamp, (kfreq+klfo)*(1+ichor), 1, 1, kmodindx, 3
asig = aosc1+aosc2+aosc3
asig = asig/5
outs asig*kamp, asig*kamp
endin
;------------------------------------------------------
; Audio in/out and analoge in to control gain
;------------------------------------------------------
instr 1
aL, aR ins
aGain chnget "analogIn0"
kGain = k(aGain)
outs aL * kGain,aR * kGain
endin
;------------------------------------------------------
; Digital in/out - use a switch to turn an LED
; on and off. See comments at bottom for wiring
;------------------------------------------------------
instr 2
iSwitchPin = 0
iLED_Pin = 1
kSwitch digiInBela iSwitchPin
digiOutBela kSwitch, iLED_Pin
endin
</CsInstruments>
<CsScore>
f1 0 4096 10 1 .5 .333 .25 .2 .166 .142 .125 .111 .1 .09 .083 .076 .071 .066 .062 .058 .055 .052 .05 .047 .045 .043 .041
f2 0 4096 10 1 0 .333 0 .2 0 .142 0 .111 0 .09 0 .076 0 .066 0 .058 0 .052 0 .047 0 .043
f3 0 4096 10 1
;f0 1000
i1 0 86400
i2 0 86400
</CsScore>
</CsoundSynthesizer>
Sorry for the long post; I wanted to give you as much info as possible. If you have any questions, feel free to ask! Again, thanks for your help.