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.