csounder As a test example, you could just use the previous example with the 'ins' opcode

which one please? I am not sure I understand which one you are referring to.

In the meantime, you can try 6.15-bela3 release:

  • restores MIDI functionality (or at least it should, let me know)
  • adds support for Trill Craft. You have to specify 30 "touches", and the touch size for each will be the reading from each individual pad ( I think -- completely untested)

    giuliomoro I will try the latest version, and solder up my Trill Crafts for those tests too!

    Here is a working MIDI .csd, in the CsOptions section, you will see command lines for:
    previous Bela 6.15 (with no multiple MIDI support, but excellent MIDI)
    Bela 6.15 v2 (with multiple MIDI support, working!... but many Mode switches and Dropped blocks)
    the command line settings I use on the Mac, to run Csound with multiple MIDI devices in the terminal

    As you will see from the .csd below, it is reading MIDI CCs 1-9 (typically from my nanoControl)

    <CsoundSynthesizer>
    <CsOptions>
    ;-Mhw:1,0,0 -+rtmidi=NULL --daemon -dm0 ; Bela 6.15 v1
    ;-Mhw:1,0,0 --daemon -dm0 ; Bela 6.15 v2
    -Mhw:1,0,0 -Ma --daemon -dm0 ; Bela 6.15 v2 (multiple MIDI devices)
    ;csound -+rtaudio=pa_cb -iadc1 -odac1 -+rtmidi=portmidi -Ma --env:CSNOSTOP=yes ; Mac commandline
    </CsOptions>
    <CsInstruments>
    
    sr		= 44100
    ksmps	= 16
    nchnls	= 2
    0dbfs	= 1
    
    gaRvb	init 0
    
    ctrlinit	1,   1,100, 2,0, 3,0, 4,64, 5,1, 6,10, 7,100, 8,10, 9,76
    
    		instr	1
    icps	cpsmidi
    iamp	ampmidi .5
    
    kamp	midic7 1, 0,1
    kamp	port 	kamp,.1	
    kcar	midic7 2, 1,4
    kcar	port 	kcar,.01
    kmod	midic7 3, 1,10
    kmod	port 	kmod,.01
    kindx	midic7 4, 1,13
    kindx	port	kindx,.01
    iatk	midic7 5, .001,1
    idec	midic7 6, .01,1
    isus	midic7 7, 0,1
    irel	midic7 8, .01,2
    kWet	midic7 9, 0,1
    
    asig	foscil	kamp*iamp, icps, kcar, 1+(kmod), kindx, 1
    kmgate	mxadsr	iatk, idec, isus, irel
    
    aDry	=	asig * kmgate
    
    		vincr 	gaRvb, aDry * kWet
    
    		outs		aDry, aDry
    		endin
    
    		instr 99
    		denorm	gaRvb
    awetL,awetR freeverb gaRvb, gaRvb, .9, .5
    		outs awetL, awetR
    		clear gaRvb
    		endin
    
    </CsInstruments>
    
    <CsScore>
    f1	0	16384	10	1
    i 1  0 z
    i 99 0 z
    </CsScore>
    
    </CsoundSynthesizer>

    giuliomoro to test and see/hear if realtime audio in is working again, you would use the version of the stereo-delay instrument that includes the two uncommented lines (and plug in your iPhone or a Microphone):

    ainL, ainR ins
    ain = ainL+ainR

    to test if the soundin opcode is working, you need to add your own mono sample to the project and uncomment
    the ain line with the soundin opcode.

    ;ain soundin "sp_hellorcb.aif" ; Does NOT work on Bela.

    • you should replace "sp_hellorcb.aif" with the name of your uploaded mono sample.
      It can be either a wave or aiff - for instance

    ain soundin "sp_hellogiulio.wav"

    and if instead, you were to uncomment the line using diskin opcode, you will hear/see that it does work

    ain diskin "sp_hellorcb.aif", 1 ; WORKS on Bela

    I will try your latest build now.

    Best,

    -dB

      giuliomoro I would love to provide several additional example instruments that would show additional ways of working with the Bela and Csound - and that sound great too! I will pull them together and you can see which you might like to include.

      giuliomoro I am trying the 6.15-bela3 release now.

      Are these the messages that you would expect to appear in my terminal when updating?

      apt install ~/Bela/projects/updateCsound/csound-6.0.0-Linux-bela3.deb
      Reading package lists... Done
      Building dependency tree

      Reading state information... Done
      Note, selecting 'csound:amd64' instead of '/root/Bela/projects/updateCsound/csound-6.0.0-Linux-bela3.deb'
      The following packages will be REMOVED:
      csound
      The following NEW packages will be installed:
      csound:amd64
      0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
      Need to get 0 B/7531 kB of archives.
      After this operation, 1024 B of additional disk space will be used.
      Do you want to continue? [Y/n] Y
      Get:1 /root/Bela/projects/updateCsound/csound-6.0.0-Linux-bela3.deb csound amd64 6.0.0 [7531 kB]
      perl: warning: Setting locale failed.
      perl: warning: Please check that your locale settings:
      LANGUAGE = (unset),
      LC_ALL = (unset),
      LANG = "en_US.UTF-8"
      are supported and installed on your system.
      perl: warning: Falling back to the standard locale ("C").
      locale: Cannot set LC_CTYPE to default locale: No such file or directory
      locale: Cannot set LC_MESSAGES to default locale: No such file or directory
      locale: Cannot set LC_ALL to default locale: No such file or directory
      dpkg: error processing archive /root/Bela/projects/updateCsound/csound-6.0.0-Linux-bela3.deb (--unpack):
      package architecture (amd64) does not match system (armhf)
      Errors were encountered while processing:
      /root/Bela/projects/updateCsound/csound-6.0.0-Linux-bela3.deb
      E: Sub-process /usr/bin/dpkg returned an error code (1)
      root@bela:~#

        giuliomoro 6.15-bela3 release - initial test

        1. not sure it was installed correctly? sorry
        2. as I noted previously, in 6.15-bela2, realtime audio-in does not work so...
          2a. I rolled back to 6.15-bela1, and... realtime audio-in WORKS (yes!) - in this version, and also...
          2b. To my surprise, multiple MIDI inputs WORK with this older version (?)

        with the following command line in the csOptions:

        -Mhw:1,0,0 -Ma --daemon ; -dm0

        The console still reports a lot of dropouts and a lot of ModeSwitch changes, but not as many as in 6.15 v2

        =====

        Building project ...
        Build finished
        Running project ...
        0"058.644| WARNING: [main] duplicate call from main program to xenomai_init() ignored
        0"058.939| WARNING: [main] (xeno-config --no-auto-init disables implicit call)
        0dBFS level = 32768.0
        --Csound version 6.15 (float samples) Oct 15 2020
        [commit: c329d91b2527e96f05ecb47837e2bfd3b68f5be7]
        libsndfile-1.0.27
        Device type: Bar (1)
        Address: 0x20
        Firmware version: 2
        Device type: Square (2)
        Address: 0x28
        Firmware version: 2
        Device type: Ring (4)
        Address: 0x38
        Firmware version: 2
        Device type: Hex (5)
        Address: 0x40
        Firmware version: 2
        realtime mode enabled
        WARNING: [mcould not open library '/usr/lib/csound/plugins-6.0/libfluidOpcodes.so' (libfluidsynth.so.1: cannot open shared object file: No such file or directory)
        WARNING: could not open library '/usr/lib/csound/plugins-6.0/libosc.so' (liblo.so.7: cannot open shared object file: No such file or directory)[m
        [mUnifiedCSD: /root/Bela/projects/Oct25/MIDI-FMcc1-8.csd
        STARTING FILE
        Creating options
        Creating orchestra
        closing tag
        Creating score
        realtime mode enabled
        rtmidi: ALSA Raw MIDI module enabled
        sorting score ...
        ... done
        setting dummy interface
        midi channel 1 using instr 1
        midi channel 2 using instr 1

        midi channel 63 using instr 1
        midi channel 64 using instr 1
        displays suppressed
        0dBFS level = 1.0
        ALSA midi: Using all devices.
        ALSA: opened MIDI input device 'hw:0,0'
        ALSA: opened MIDI input device 'hw:1,0'
        ALSA: opened MIDI input device 'hw:2,0'
        orch now loaded
        audio buffered in 256 sample-frame blocks
        SECTION 1:
        Initialising spinlock...
        Starting realtime mode queue: 0xb5027010 thread: 0xdabb78
        Underrun detected: 39 blocks dropped
        Underrun detected: 1 blocks dropped

        Underrun detected: 1 blocks dropped
        2135 mode switches detected on the audio thread.
        Underrun detected: 1 blocks dropped
        Underrun detected: 1 blocks dropped
        Und

        Underrun detected: 1 blocks dropped
        Underrun detected: 1 blocks dropped
        Underrun detected: 1 blocks dropped
        Underrun detected: 1 blocks dropped

        Underrun detected: 1 blocks dropped
        Underrun detected: 1 blocks dropped
        10695 mode switches detected on the audio thread.
        Underrun detected: 1 blocks dropped

        Underrun detected: 1 blocks dropped
        backtrace() returned 0 addresses
        Csound tidy up: Terminated
        Makefile:595: recipe for target 'runide' failed
        make: *** [runide] Terminated
        Underrun detected: 1 blocks dropped
        15004 mode switches detected on the audio thread.
        inactive allocs returned to freespace
        end of score. overall amps: 0.41622 0.35189
        overall samples out of range: 0 0
        0 errors in performance
        Bela stopped
        root@bela ~/Bela#

        csounder Are these the messages that you would expect to appear in my terminal when updating?

        no. Something was broken in the package. I uploaded another bela4 version that fixes that.

        csounder
        to test if the soundin opcode is working, you need to add your own mono sample to the project and uncomment
        the ain line with the soundin opcode.

        ;ain soundin "sp_hellorcb.aif" ; Does NOT work on Bela.

        OK, I can reproduce that this doesn't work. In the source code of soundin I see a comment that says soundin now uses diskin2 VL 24-12-16. Not sure if that means anything to you?

          giuliomoro the comment in the code is by Victor Lazzarini - it would be great if you contacted him about this (on the Bela at least) bug. It does confirm that the console is reporting this fact (feature? bug?) when the .csd is loaded and it reports that diskin2 has loaded the sample "sp_hellorcb.aif" - when the soundin opcode is used in the .csd file - but, then... there is silence, no sound, as if the file is loaded and there is no 'error' but the rest of the instrument can't find it. curious. I am sure Victor will have a suggestion and an explanation.

          giuliomoro testing 615-bela5 now.

          Awesome.

          All seems to be working very very well. THANKS!

          (I will report on the Trills in the next post - my Trill Craft is soldered and ready, but that test will wait until tomorrow)

          Here are some details (30 or so models tested - NoteList, Generative, MIDI, Audio Processing, MIDI with Audio)

          Warnings in the console about missing libraries - gone! - check
          Audio IN - check
          MIDI IN - check
          - even Multiple Simultaneous MIDI controllers plugged into a USB HUB (are powered and working) - check
          (when using the: -Ma command line flag)
          MIDI and Audio at the same time - check (controlling Audio FX from MIDI sliders and knobs)

          now, in some MIDI instruments, there do still seem to be an ever-increasing number of mode switching in the audio thread happening, especially when I am using real-time MIDI in, and even more when I have Multiple MIDI in set (-Ma), or without -Ma, but when I am playing lots of notes from my controller keyboard.

          ? do I need to "uninstall" portMIDI ?

          - if so, how do I do this

          Finally, for now, as you know, the soundin opcode is still not working correctly,
          - maybe it will not work on the Bela?
          - maybe this is by design and is related to memory issues and buffering issues?

          BUT WOW - this is a really wonderful update. THANKS.
          - I will be making you some model instruments (for testing and sharing)

            csounder now, in some MIDI instruments, there do still seem to be an ever-increasing number of mode switching in the audio thread happening, especially when I am using real-time MIDI in, and even more when I have Multiple MIDI in set (-Ma), or without -Ma, but when I am playing lots of notes from my controller keyboard

            Please send me the very code that shows this issue.

            To uninstall portmidi try

            dpkg -r libportmidi0

              giuliomoro

              doing some sound design with this MIDI instrument with reverb - quite a lot of mode switching still - and some crickets too. Try it out. You might need to change your CC numbers. I am using the Novation LaunchKey mini and it is set up for controllers 21 - 28 by default

              324559 mode switches detected on the audio thread.
              327326 mode switches detected on the audio thread.
              330092 mode switches detected on the audio thread.
              Underrun detected: 1 blocks dropped
              332858 mode switches detected on the audio thread.
              335625 mode switches detected on the audio thread.

              ======

              ; Adam Boulanger
              ; MIDI added to Hans Mikelson's 'River' instrument from The Csound Catalog
              <CsoundSynthesizer>
              <CsOptions>
              -Mhw:1,0,0 --daemon -dm0
              </CsOptions>
              <CsInstruments>
              
              sr     = 44100
              ksmps  = 16
              nchnls = 2
              0dbfs  = 1
              
              maxalloc 1, 6
              
              	ctrlinit 1, 21, 110, 22,110, 23,120, 24,1, 25,0, 26,64
              
              garvb		init	0	
              
              			instr 	1
              			
              iamp		ampmidi .75
              kcps		cpsmidib 1
              icps        cpsmidi
              
              kvol        midic7  21, 0,1
              kcut1		midic7	22, 50,800						;Added:Tune reson filters
              kcut2		midic7	23, 50,800
              kcut3		midic7	24, 440,880
              kmod		midic7	25, .6, 1.4					
              krvbsend	midic7	26, 0,.5
              
              klfo		lfo		kmod, .02+rnd(.09)
              aplk		pluck 	iamp, kcps+klfo, icps, 0, 1
              asig        dcblock2 aplk
              af1			reson	asig, kcut1+rnd(440), 80
              af2			reson	asig, kcut2+rnd(222), 80
              af3			reson	asig, kcut3+rnd(880), 80
              abalnc		balance af1+af2+af3, asig
              afinal		linenr	abalnc, .01, .4, .5
              adry		=		afinal*kvol
              			outs 	adry,adry
              			vincr	garvb, adry*krvbsend
              			
              			endin
              			
                      	instr  	Reverb
              irevtm    	=       2.6
              ihidif    	=       0.2
                      	denorm garvb
              aout      	reverb2	garvb, irevtm, ihidif     	; DELAY FOR TIME
                        	out		aout            	 		; OUTPUT THE CHANNEL
              			clear	garvb
                        	endin
                        	
              </CsInstruments>
              <CsScore>
              f0  z
              f1	0	16384	10	1							; sine wave
              i "Reverb" 0	-1 	    
              </CsScore>
              </CsoundSynthesizer>

              giuliomoro for comparison, you might be interested in the fact that this instrument, that uses more CPU but does not have any reverb running, does not report and mode switching or dropped blocks

              
              <CsoundSynthesizer>
              <CsOptions>
              -Mhw:1,0,0 -+rtmidi=NULL --daemon -dm0
              </CsOptions>
              <CsInstruments>
              
              sr     = 44100
              ksmps  = 16
              nchnls = 2
              0dbfs  = 1
              
              maxalloc 1,6
              
              ; Initialize the global variables.
              ; Table #1 - initial position
              git1 ftgen 1, 0, 128, 7, 0, 64, 1, 64, 0
              ; Table #2 - masses
              git2 ftgen 2, 0, 128, -7, 1, 128, 1
              ; Table #3 - stiffness
              git3 ftgen 3, 0, 128, -7, 0, 64, 100, 64, 0
              ; Table #4 - damping
              git4 ftgen 4, 0, 128, -7, 1, 128, 1
              ; Table #5 - initial velocity
              git5 ftgen 5, 0, 128, -7, 0, 128, 0
              
              instr 1
                iamp ampmidi .75
                ipch cpsmidi 
                kenv	madsr .1,.12,.68,.3
                ipos = 1
                imass = 2
                istiff = git3
                idamp = 4
                ivel = 5
                a1 scantable iamp, ipch, ipos, imass, git3, idamp, ivel
                a2 dcblock a1
                outs a2*kenv,a2*kenv
              endin
              </CsInstruments>
              
              <CsScore>
              f0 z
              </CsScore>
              </CsoundSynthesizer>

              giuliomoro I have not yet tested the Trill Craft, but this .csd is running the other 4 Trill Sensors in a Trill Hub and sensing Vertical from each and using it to control the pitches of 4 oscillators. You might want to try it out.
              - more to come, and more musical too!

              You need to enclose the code you paste with ``` (triple backticks)

              OK. I will try that now. Sorry for the clutter and confusion:

              <CsoundSynthesizer>
              <CsOptions>
              --daemon -dm0
              </CsOptions>
              <CsInstruments>
              
              sr       = 44100
              ksmps    = 8
              nchnls   = 2
              0dbfs    = 1
              
                instr 1
                
                  iNumTouches = 1
              ;	iNumTouches = 5
                     
                  iTrillID0 = 0
                  kactiveTouches0 init 0
                  ktouchSizes0[] init iNumTouches
                  ktouchVert0[] init iNumTouches
                  ktouchHori0[] init iNumTouches
              
                  iTrillID1 = 1
                  kactiveTouches1 init 0    
                  ktouchSizes1[] init iNumTouches
                  ktouchVert1[] init iNumTouches
                  ktouchHori1[] init iNumTouches
               
                  iTrillID2 = 2
                  kactiveTouches2 init 0   
                  ktouchSizes2[] init iNumTouches
                  ktouchVert2[] init iNumTouches
                  ktouchHori2[] init iNumTouches
                  
                  iTrillID3 = 3
                  kactiveTouches3 init 0   
                  ktouchSizes3[] init iNumTouches
                  ktouchVert3[] init iNumTouches
                  ktouchHori3[] init iNumTouches
              
                  kactiveTouches0, ktouchSizes0, ktouchVert0, ktouchHori0 trill iNumTouches, iTrillID0
                  kactiveTouches1, ktouchSizes1, ktouchVert1, ktouchHori1 trill iNumTouches, iTrillID1
                  kactiveTouches2, ktouchSizes2, ktouchVert2, ktouchHori2 trill iNumTouches, iTrillID2
                  kactiveTouches3, ktouchSizes3, ktouchVert3, ktouchHori3 trill iNumTouches, iTrillID3
                      
               ;   printk2 kactiveTouches0
               ;   printk2 kactiveTouches1
               ;   printk2 kactiveTouches2
               ;   printk2 kactiveTouches3
                                     
              ;    ktrig_v0 changed2 ktouchVert0
              ;    ktrig_h0 changed2 ktouchHori0
              ;    ktrig0 = ktrig_v0 + ktrig_h0
              
              ;    ktrig_v1 changed2 ktouchVert1
              ;    ktrig_h1 changed2 ktouchHori1
              ;    ktrig1 = ktrig_v1 + ktrig_h1 
              
              ;    ktrig_v2 changed2 ktouchVert2
              ;    ktrig_h2 changed2 ktouchHori2
              ;    ktrig2 = ktrig_v2 + ktrig_h2 
              
              ;    ktrig_v3 changed2 ktouchVert3
              ;    ktrig_h3 changed2 ktouchHori3
              ;    ktrig3 = ktrig_v3 + ktrig_h3 
                  
               ;   printarray ktouchVert0, ktrig0, "", "Vertical0:"
               ;   printarray ktouchHori0, ktrig0, "", "Horizontal0:"
               ;   printarray ktouchVert1, ktrig1, "", "Vertical1:"
               ;   printarray ktouchHori1, ktrig1, "", "Horizontal1:"
               ;   printarray ktouchVert2, ktrig2, "", "Vertical2:"
               ;   printarray ktouchHori2, ktrig2, "", "Horizontal2:"
               ;   printarray ktouchVert3, ktrig3, "", "Vertical3:"
               ;   printarray ktouchHori3, ktrig3, "", "Horizontal3:"
                  
              kval0	=	ktouchVert0[0]
              kval1	=	ktouchVert1[0]
              kval2	=	ktouchVert2[0]
              kval3	=	ktouchVert3[0]
                  
               asig1	oscil .5, 200 * (kval0 * 7)
               asig2	oscil .6, 300 * (kval1 * 6)
               asig3	oscil .5, 500 * (kval2 * 5)
               asig4	oscil .6, 800 * (kval3 * 4)
               
               outs asig1+asig3, asig2+asig4
                endin 
                
              </CsInstruments>
              <CsScore>
              i1 0 -1
              </CsScore>
              </CsoundSynthesizer>

              Worked great! You can edit your previous posts to fix it there too. I did edit some of the earlier ones already

                giuliomoro Yes - I will clean up some of the previous posts as well - and provide you (and others) with working examples that they can cut and paste.