hello,

im fairly new to csound, and im building a simple analog synthesizer 
which should be midi controllable.

this midi instrument should cooperate with other softsynths on the same 
midi port.
therefore i want to use the massign operator to tell csound which midi 
channel the instrument should listen to.

this behaves very strangely, because the instrument is randomly assigned 
to any incomming midi channel.

output from csound is below.
i want the instrument to respond to channel 15, and to be quiet on all 
other channels.
i made a dummy quiet intrument(2) and assigned all other channels to this.
in the beginning of the trace you can see that all these assignments 
appear to work.

later on, when actual midi data arrives, the assignments are remade, for 
no apparent reason, so
that it for instance listens to channel 10, the drum channel.

csound doesnt allways do this random reassignment, and i dont know why.

i attach the instrument as well, wich is rather messy at the moment. it 
is mainly an adaption of various recipies i have found
in the csound manual and from the csound book.

[joakim@motoko mycsound]$  csound -b 100 -B 5000 -dm6 --sched 
--outcard=0 -M /dev/snd/midiC2D0 moog_2.csd
Using /usr/local/lib/csound/4.11.0.0a/csound.txt
Unofficial Linux Csound Version  v4.11.0.0a (Apr 21 2001)(floats are floats)
BEWARE: this is not the canonical version! (caveat emptor)
Please report bugs of this version to 
http://www.ilogic.com.au/cgi-bin/csound-bugs
UnifiedCSD:  moog_2.csd
STARTING FILE
Creating options
Creating orchestra
Creating /tmp/fileWbq6SZ.orc (0x8051e48)
Creating score
orchname:  /tmp/fileWbq6SZ.orc
scorename: /tmp/file2xVzER.sco
sorting score ...
   ... done
orch compiler:
201 lines read
   instr    1   
   instr    2   
Unofficial Linux Csound Version  v4.11.0.0a (Apr 21 2001)(floats are floats)
midi channel 1 using instr 1
displays suppressed
chnl 15 using instr 1
massign: chnl 15 exists, ctrls now defaults
chnl 1 using instr 2
chnl 2 using instr 2
chnl 3 using instr 2
chnl 4 using instr 2
chnl 5 using instr 2
chnl 6 using instr 2
chnl 7 using instr 2
chnl 8 using instr 2
chnl 9 using instr 2
chnl 10 using instr 2
chnl 11 using instr 2
chnl 12 using instr 2
chnl 13 using instr 2
chnl 14 using instr 2
chnl 16 using instr 2
orch now loaded
audio buffered in 100 sample-frame blocks
hardware buffers set to 16384 bytes
Scheduler set to Round Robin with priority 99...
writing 400-byte blks of shorts to dac
SECTION 1:
ftable 1:
midi channel 1 now using instr 1
midi channel 10 now using instr 1
midi channel 1 now using instr 1
new alloc for instr 1:
opening /dev/midi00 as MIDI out

-- 
Joakim Verona

www.verona.se
[EMAIL PROTECTED]


<CsoundSynthesizer>
;moog_2 instrument adapteb from csoundbook example by jave
;   velocity sensitivity: added a ampmidi operator
;   pitchbend: made a new kcps variable, which i used whenever possible, expseg 
requres an ivalue however

; TODO 
;pan; perhaps kval midictrl 10 (10 is coarse pan controller)
;reverb
;chorus
;delay

<CsOptions>     

</CsOptions>    

<CsInstruments> 

massign 15, 1 ;bind instr 1 to midi channel 15
 ;bind instr 2 to midi channel 1, just to shut up csound there
massign 1, 2
massign 2, 2 
massign 3, 2 
massign 4, 2 
massign 5, 2 
massign 6, 2 
massign 7, 2 
massign 8, 2 
massign 9, 2 
massign 10, 2 
massign 11, 2 
massign 12, 2 
massign 13, 2 
massign 14, 2 

massign 16, 2 


sr             =         44100
kr             =         441
ksmps          =         100
nchnls         =         2

instr          1

inum           notnum
kcps           cpsmidib 8
icps           cpsmidib 8
iveloc         ampmidi  1
kpan           midictrl 10

krez           midic7    1, .1, 1
kfco           midic7    2, 100, 4000

iamp           =         20000
iamp2          = 400
kl1            midic7    3, 0, 4
kl2            midic7    4, 0, 6
kdetune        midic7    5, .99, 1.01

     klfo      oscil     kl1, kl2, 1
     klfo      =         klfo + kl1
     apulse1   buzz      1, kcps+klfo * .5, sr*.5/kcps*.5, 1
     apulse2   buzz      1, kcps*kdetune, sr*.5/(kcps*kdetune), 1

     apulse1   =         (apulse1+apulse2)*.5

     asaw      integ     apulse1
     ax        =         asaw-.5
     k1        expseg    icps * 16, 4, icps * 4
          
     ayn       moogvcf   ax, k1, krez
     kmgate    = 1;linsegr   0, .1, 1, 1, .5, .25, 0 ;makes the note length follow the 
midi note length(?), but what about delay?




;stuff for handling release(i thought kmgate handled this?)
 xtratim 1 ;extra-time, i.e. release dur
  krel init 0
  krel release ;outputs release-stage flag (0 or 1 values)
  if krel == 1 kgoto rel ;if in release-stage goto release section
 ;
 ;************ attack and sustain section ***********

  kmp1 linseg 0, .03, 1, .05, 1, .07, 0, .08, .5, 4, 1, 50, 1
  kmp = kmp1*iamp2
  kmp3=1
   kgoto done
 ;
 ;--------- release section --------
   rel:
  kmp2 linseg 1, .3, .2, .7, 0
  kmp = kmp1*kmp2*iamp
  kmp3=0
  done:
 ;------
;  a1 oscili kmp, icps, 1
;  out a1


     aout     =         iveloc*ayn * iamp * kmp3

;the delayline
     adly      delayr   0.3
               delayw   aout + 0.5*adly



               outs      aout+adly,aout+adly
;       outs apulse1*20000,ayn

endin

instr 2
endin

</CsInstruments>

<CsScore>
f1   0    8192 10   1 ;used by buzz

f0      10000
e
</CsScore>

</CsoundSynthesizer>

Reply via email to