[Csnd] patch doesn't work with midi

Dear community,
this (simplified) patch runs without problem with standard numerical score.
But unfortunately there’s no sound when I want to try it with midi instead.
I get the error message

Invalid ftable no. 1.000000

I don’t know why.

It’s an additive synthesizer wich uses event_i.
It would be great, if someone of You could give me a hint.
Thanks,
Stefan

-Ma -odac -m0d ; ==============================================

sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
giratios ftgen 0,0,16,-2,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
massign 0,1
; OPCODE, simple additive synthesis
opcode StefansAdsyn, iiiii,iiiiiiii ; 5 xouts, 8 xins
insnum,inumparts,imaxdur,iratios,icps,iglobamp,iatt,irelease xin ;8 xins
ittnr = 1
irandNum random 1, 20000
isubinstr = insnum+icps/(sr+irandNum)
inyquist = sr/2
loop:
;; FREQS
ipartfreq table ittnr-1, iratios
ipartfreq = icpsipartfreq
if (ipartfreq >= inyquist) then
ittnr = inumparts ; ends loop
endif
;; DURS
ipartdur = imaxdur/ittnr
ipartdur = ipartdur
imaxdur
; AMPS
ipartamp = iglobamp/ittnr
; attack !!
ipartatt = iatt/ittnr
; Release
ipartrel = irelease/ittnr
; send all to subinstr
event_i “i”, isubinstr, 0, ipartdur,ipartfreq,ipartamp,iatt,ipartrel
; define end of the loop:
loop_le ittnr, 1, inumparts, loop
krelease release
if krelease == 1 then ; note off event
turnoff2 isubinstr, 4, 1
endif
xout ipartdur,ipartfreq,ipartamp,iatt,ipartrel
endop
instr Addsyn
insnum = 101
inumparts = 16
imaxdur = 10
icps cpsmidi
iglobamp ampmidi 0,1
iatt = 0.03
irelease = 0.1
ipartdur,ipartfreq,ipartamp,iatt,ipartrel StefansAdsyn insnum,inumparts,imaxdur,giratios,icps,iglobamp,iatt,irelease
endin
instr 101
idur = p3
icps = p4
iamp = p5
iatt = p6
irelease = p7
aenv expsegr 0.001,iatt,1,idur,0.0001,irelease,0.0001
apart poscil aenv*iamp,icps
outs apart,apart
endin

; ==============================================

i"Addsyn" 0 60

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

I haven't tried to actually make it work, as I'm not quite sure what changes
you made for MIDI, but the immediate cause of the error is the line:

iglobamp ampmidi 0,1

which is an incorrect format. 'ampmidi' only has one argument unless you
actually want a translation table. You probably wanted 'iglobamp ampmidi 1'
(returns range 0..1 -- haven't checked what actually might be appropriate).

I also found that ~line 55 (the call to StefansAdsyn) probably got folded -- the next line
is the argument list for the opcode. Had to rejoin the two lines to avoid a compile
error.

  -- Pete --

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here