WARNING: MIDI note overlaps with key 58 on same channel

I'm sorry to bother you with this, but I am creating a project with aif files of prepared piano sounds, mostly using the loscil opcode with different permutations (lpf, ring modulation, delays and the like).

I have been having two issues.
#1: WARNING: MIDI note overlaps with key 58 on same channel
I have been getting stuck notes when using real-time MIDI

#2: if the MIDI events happen too quickly, the audio output for the specific instrument starts deteriorating rapidly, disappearing for a few seconds.

Any suggestions on either of these issues? I have been using CSound on-and-off for a few years and consider myself a noob.

Thanks,
Kilafu

Hardware?

With regard to your problem #1, I wonder if your input chain is actually flakey somewhere. You should only get that warning if a second note-on for that note on that channel arrives before the note-off for the preceding event. And as you're getting stuck notes as well, it seems quite likely that the MIDI input itself is erratic. Exactly what is your hardware?

(I wondered if extending a midi note with a long decay, so the instrument is still active when another note arrives, could cause the problem, but Csound seems to take care of that properly.)

I can't quite visualize (or audiolize? :-)) what you're describing in #2, but it could be related.

Cheers,

-- Pete --

hardware not sure.

Pete:

thanks for your input. I think there may be a few issues going on. I believe you are right in your first suggestion, at least that there is a long decay. I have put my coding for my .csd file below. I am afraid that my coding is a bit awkward, and there may be easier means of producing results (but this is what happens sometimes when one is self-taught). I was hoping that "midinoteoff" might help, but it doesn't. I am simply using an M-Audio 49e USB keyboard running into a G5 with Digital Performer sending MIDI to the CSound app.

Regarding my second problem, the audio output starts crumbling and disappears once MacCSound indicates CPU usage around .90 to 1.00. In order for the CPU usage to get to this point, I just input a series of 32nd notes at a pretty fast clip and the the dac just can't seem to handle the output. I am thinking a few possibilities:

A. I might not have CSound preferences set correctly
B. My coding is sloppy and there is a more efficient means of getting the results I desire
C. This is standard with MIDI realtime input and I might need to exlore the cpuprc opcode
D. something else that can't seem to grasp quite yet.

Here is the .csd file:

; WARNING: MIDI note overlaps with key 58 on same channel
sr = 44100
kr = 4410
ksmps = 10
nchnls = 2

garvbsig init 0 ; global "a" variable initialized to 0

massign 3, 3
massign 4, 4
massign 10, 10

;====================================================================
; Instrument #3 - LPF Delay INSTR (WOOD)
instr 3
icps cpsmidi
iamp ampmidi ampdb(100)

kkey init 0
kvelocity init 0
midinoteoff kkey, kvelocity

iBal midic7 7, .01, 1.0 ; Volume (CC#7) controls panning.
iQ midic7 1, 1, 50 ; Mod Wheel (CC#1) controls Q of LPF
ifn = 4
irise = 0
ibalance = iBal
irvbgain = .2
idur = .005
idec = .04
kQ = iQ
kfreq = 100
kband = 2

kenv madsr 0.01, idec, .1, .75
kamp = kenv * (iamp * 8)
asig1 loscil kamp, icps/4, ifn, 1, 0
asig2 loscil kamp, icps/5, ifn, 1, 0
asig3 loscil kamp, icps/6, ifn, 1, 0
kenv1 linseg 600, .07142, 400, .055556, 40
kenv2 linseg 500, .07142, 400, .055556, 40
kenv3 linseg 400, .07142, 300, .055556, 40
alowpass1 lowpass2 asig1 + asig2, kenv1 * 1.5, kQ
alowpass2 lowpass2 asig2 + asig3, kenv2 * 1.2, kQ
alowpass3 lowpass2 asig1 + asig3, kenv3 * 1.3, kQ
abutter butterbp alowpass1 + alowpass2 + alowpass3, kfreq, kband

outs (abutter * 130) * ibalance, (abutter * 130) * (1 - ibalance)
garvbsig = garvbsig + abutter * (irvbgain * .09)
printk2 kkey
endin

;====================================================================
; Instrument #4: RING MODULATOR Prepaired Piano & SINE WAVE modulator w/o looping
instr 4

icps cpsmidi
iamp ampmidi 20000

kkey init 0
kvelocity init 0
midinoteoff kkey, kvelocity

iscale = iamp * .333
ifunc = 1
ibalance = .5
ienv1 = 400
ienv2 = 1500
irvbgain = .2

kenv linseg ienv1, icps, icps, 2, ienv2
aoscil oscil kenv * 2, icps *(kenv * -.12), 14 ;
kenv2 linen iscale * .09, 0, 2, 1
ar1 loscil kenv2, icps, ifunc, 60, 0; 0 denotes no looping.
aringmod = (aoscil/3) * (ar1/3)
outs aringmod * ibalance, aringmod * (1 - ibalance)

garvbsig = garvbsig + aringmod * (irvbgain * .09)

endin

;====================================================================
; Instrument 10 - instrument with an MADSR envelope. - PLUCK
instr 10
icps cpsmidi
iamp ampmidi ampdb(85)

kkey init 0
kvelocity init 0
midinoteoff kkey, kvelocity

iatt = 0.05
idec = 0
islev = 1
irel = 1.5
ifn = 2

; Create an amplitude envelope.
kenv madsr iatt, idec, islev, irel
kamp = kenv * iamp
asig1 loscil kamp, icps, 2, 50, 2

outs asig 1, asig 1
endin

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

;REVERB
instr 99

irvbtime = p4
asig reverb garvbsig, irvbtime ; put global sig into reverb
outs asig, asig
garvbsig = 0 ; then clear it

endin

; display our overall output and time
instr globalStuff
aoutl, aoutr monitor
krmsl rms aoutl
krmsr rms aoutr
outvalue "leftrms", 20*krmsl/0dbfs
outvalue "rightrms", 20*krmsr/0dbfs
ktime times
outvalue "scoretime", ktime

endin

f1 0 262144 1 "PrePiano1.aif" 0 4 0
f2 0 524288 1 "PrePiano5.aif" 0 4 0
f3 0 524288 1 "PrePiano8.aif" 0 4 0
f4 0 1048576 1 "PrePiano9.aif" 0 4 0
f8 0 1048576 1 "PrePiano10.aif" 0 4 0
f6 0 524288 1 "PrePiano12.aif" 0 4 0
f7 0 131072 1 "PrePiano15.aif" 0 4 0
f8 0 262144 1 "PrePiano1Rev.aif" 0 4 0
f9 0 524288 1 "PrePiano5Rev.aif" 0 4 0
f10 0 262144 1 "PrePiano8Rev.aif" 0 4 0
f11 0 524288 1 "PrePiano9Rev.aif" 0 4 0
f12 0 524288 1 "PrePiano10Rev.aif" 0 4 0
f13 0 262144 1 "PrePiano12Rev.aif" 0 4 0
f14 0 1024 10 1 ;Table#37,asinewave.

t 0 60
i "globalStuff" 0 100
i99 0 999 3

e

more subtle?

Yeah, I was thinking further after I posted...
I doubt this is the first time you've used live MIDI input -- and judging by the code you posted, almost certainly not! (:-)) So hardware problems would surely have shown up before.

My second guess would be overloading the computation. From what you say, you're certainly just about hitting the limits of your CPU, and I'm not sure what the effects would be. On my old Linux machine I've certainly run into such limits (it's kind of hopeless to try granular synthesis real-time, for instance). On a couple of live MIDI configurations I've hit the same sort of limits, too, and I can get sound breakup, but I've never noticed stuck notes or the like.

I know that MIDI input is read at k-rate, though, so I imagine it's possible -- if the computer can't keep up with that rate -- to miss events in the buffer. And I guess there might be different effects in different OSs.

Dunno... I'll keep thinking (:-)) Have you tried reducing the load by leaving out reverb or something?

viagra uk generic viagra viagra online avanafil z-pak generic cialis zpack staxyn kamagra uk buy zithromax z pack z-pack Canadian pharmacy viagra buy viagra uk Canadian pharmacy cheap generic viagra zpak cialis uk ed pills ed drugs cialis online z pak pharmacy uk