Cabbage Logo
Back to Cabbage Site

Problem with an if statement or the score section

That was my lack of research with the octaves. Apologies. I woldn’t want to waste someones time who’s trying to help.
I was in the middle of writing another long message/noob research then I solved it.
The outkpb needs to be outside of the if statement.

form size(500, 300), caption("Untitled") keyboard bounds(10, 27, 400, 100) channel("keyboard10000") -+rtmidi=NULL -M0 -Q0 ;;RT audio I/O with MIDI in

sr = 44100
ksmps = 10
nchnls = 1

massign 0, 130
pgmassign 0, 130

instr 130

kstatus, kchan, kdata1, kdata2 midiin

if ((kstatus == 144) && (kdata1%12==0) ) then
kpch=80

endif

if ((kstatus == 144) && (kdata1%12==1) ) then
kpch=50
endif
kpb = int(kpch) ;whole numbers only
outkpb 1, kpb, 0, 127 ;(= pitchbend)

endin

i130 0 3600

This sends the message everytime the kpch is changed.
Thanks for all your time and help.

You’re wasting no one’s time. We’re all on the same journey :slight_smile:
I’m glad you got it sorted. When I have more time I’ll try to look into what is going on with that if statement. It seems that the status byte might be an issue. If I figure it out I’ll let you know :+1:

Thanks, have a good one!