MPE triggering / mapping

Hi everyone,

I bought a MPE controller (Osmose) and I am trying to map MPE data to Csound instruments (because I’ll later need to record the values so that I can play back MPE performances, so I don’t want to ‘plug and play’ and record low quality audio).

Right now, I am just trying to make note on and offs work, continuous controls will be the next step.

Using midiin, I managed to trigger notes and turn them off with the help of kchan and kdata1 (-> midi note for kstatus = 144 and kstatus = 128 (note on / off)) in order to differentiate every note.

It works BUT there is an issue I struggle to solve : midi notes 62 and 82 seem to trigger two notes at the same time (the note that was played before and themselves, I think).
What is also strange is that those two notes can be heard if I change “i 1 0 3600” to “f 0 3600” in the score, no other note can be heard but those two notes when I press them on the controller (which I can’t explain).

Does anyone have any idea what is going on ?
Thank you :wink:

Jacques

midiin_test_X2.csd (1.1 KB)

<CsoundSynthesizer>
<CsOptions>

-o dac -M0 -b 1024 -B 128

</CsOptions>
; ==============================================
<CsInstruments>

sr = 44100
ksmps =	1
nchnls = 1
0dbfs = 1

gicos ftgen 0, 0, 4096, 11, 1

instr 1

	kstatus, kchan, kdata1, kdata2 midiin            
	ktrigger changed kstatus, kchan, kdata1, kdata2 
 	if ktrigger = 1 && kstatus != 0 then
		if kstatus == 144 then
			schedulek 2 + (1 / (kdata1 + kchan)), 0, -1, cpsmidinn(kdata1)
			printk 0, kdata1
		elseif kstatus == 128 then
			turnoff2 2 + (1 / (kdata1 + kchan)), 4, 0
		endif
 	endif

endin			// okay, why do midi notes 62 et 82 bug ? 

instr 2

	out poscil3(0.0625, p4, gicos, 0)

endin

</CsInstruments>
; ==============================================
<CsScore>

i 1 0 3600
e

;f 0 3600 // wow, okay, interesting .... it shows which notes bug (62 and 82)

</CsScore>
</CsoundSynthesizer>

/*

status, data

note on : 144 -> midi note, velocity
note off : 128 -> midi note, velocity ?
channel aftertouch (1st press) : 208 -> pressure, 0
cc 74 (2nd press) : 176 -> 74, pressure
pitch bend : 224 -> pitch bend 1 (0 - 127), pitch bend 2 (0 - 127)

*/

Solved : as written in midiin, midinn acts weirdly with low numbered instruments. I changed the instrument number 1 for 1000 which solved the strange behavior.