[Csnd] Basic MIDI controller issue

Hi all,

I am not able to get MIDI controllers to work. I’m on Win11 and I have three devices connected (a keyboard and two controllers). All three are working properly according to MIDI-OX. Both controllers are configured with a knob set to use CC 11, verified in MIDI-OX.

Here’s a simple test program based on examples in the manual. When I run it, the instrument runs when I press a key, and I’m getting note and velocity data. But kamp never changes. What am I missing? Result it the same whether or not I explicitly set -+rtmidi. See console output below the code.

-d -m7 -odac1 -+rtmidi=portmidi -Ma ; -d -m7 -odac1 -Ma sr=48000 ksmps=1 nchnls=2 0dbfs=1

instr 1
imax = 1
imin = 0
ictlno = 11

; ipch pchmidi
icps cpsmidi
ivel veloc
prints(“icps=%f ivel=%f\n”, icps, ivel)

kamp midic7 ictlno, imin, imax
; ktrig changed2 kamp
; printks(“ktrig=%f kamp=%f\n”, 1, ktrig, kamp)
printk2 kamp

asig oscili kamp, icps, 1
outs asig, asig
endin

f 0 36000 f 1 0 4096 10 1 ;sine wave e

Excerpts from the console:

0: Focusrite USB MIDI (portmidi)

1: SHIK N32B V3 (portmidi)
2: TouchOSC Bridge (portmidi)
3: Launch Control (portmidi)
4: K-Board (portmidi)
PortMIDI: Activated input device 0: ‘Focusrite USB MIDI’ (MMSystem)
PortMIDI: Activated input device 1: ‘SHIK N32B V3’ (MMSystem)
PortMIDI: Activated input device 2: ‘TouchOSC Bridge’ (MMSystem)
PortMIDI: Activated input device 3: ‘Launch Control’ (MMSystem)
PortMIDI: Activated input device 4: ‘K-Board’ (MMSystem)

SECTION 1:
ftable 1:
rtevent: T 0.085 TT 0.085 M: 0.00000 0.00000
new MIDI alloc for instr 1:
icps=293.656485 ivel=40.000000
i1 1.00000
rtevent: T 12.885 TT 12.885 M: 1.00000 1.00000

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

Hi Dave,
to me works well, of course I must held the note. Normally I use ctrl7, in order to control better the Midi channel.
greetings
Giovanni

Thanks, Giovanni. I have tried ctrl7 with the same result.

I added a call to midin to see what the raw MIDI input looks like. Very interesting – I am getting data from the controllers, but the status byte is always 0 rather than 176 (B0 control change). This explains why I’m not getting the CC changes, but it raises the question – why is Csound getting status=0 for all these messages? In MIDI-OX, I can see status byte B0 whenever I move a controller.

Did you try selecting a single device at a time?
Maybe -Ma is the problem.

What version is this?

Prof. Victor Lazzarini
Maynooth University
Ireland

Aha, that is the issue, thanks Victor. This is with Csound 6. Although this is a workaround, it’s not a good solution because my keyboard has no knobs/sliders. My LaunchControl has both buttons and knobs, and I was able to use it, but I want the features of my K-Board – buttons are not as good as a real keyboard.

It would be nice if one could select multiple specific devices, e.g. “–midi-device=3,4” but that would be a feature request.

  • Dave

Should I enter a ticket for the -Ma issue?

Probably a good idea.

Prof. Victor Lazzarini
Maynooth University
Ireland

The odd thing is that it affects control change but not note on/off. The portmidi module code does make any distinction between the two.

Prof. Victor Lazzarini
Maynooth University
Ireland

I just tested it on the Mac with two separate devices and -Ma and I can’t reproduce the problem. I can receive channel messages alright.

Well, it may only be on Windows. I’ll try to test it tomorrow on a Raspberry Pi, which is the only *ix system I have currently.

OK, I have narrowed it down to the keyboard I was using, a McMillen K-Board. If I switch to a Korg nanoKey2, then I am able to use both the keyboard and an additional controller. So it’s something about this keyboard, which I hope I can fix through configuration.

Interesting, but midi-ox does not have a problem with it, so?

Prof. Victor Lazzarini
Maynooth University
Ireland

Right, so it is apparently a problem with the keyboard itself.

In other words, not a Csound issue per se.

It doesn’t make sense to me yet, but the problem doesn’t recur with the McMillen QuNexus or the nanoKey.

Just a gut feeling: maybe an issue with "running status" omitting resending the status byte if command and midi channel are identical to the previous one? Some devices do use running status, others don't...

Best, Jana

Dave Seidel <dave.seidel@gmail.com> hat am 10.09.2024 19:22 CEST geschrieben:

It doesn't make sense to me yet, but the problem doesn't recur with the McMillen QuNexus or the nanoKey.

> In other words, not a Csound issue per se.
>
>
> > Right, so it is apparently a problem with the keyboard itself.
> >
> >
> > > Interesting, but midi-ox does not have a problem with it, so?
> > >
> > > Prof. Victor Lazzarini
> > > Maynooth University
> > > Ireland
> > >
> > >
> > > >
> > > > OK, I have narrowed it down to the keyboard I was using, a McMillen K-Board. If I switch to a Korg nanoKey2, then I am able to use both the keyboard and an additional controller. So it's something about this keyboard, which I hope I can fix through configuration.
> > > >
> > > >
> > > > > Well, it may only be on Windows. I'll try to test it tomorrow on a Raspberry Pi, which is the only *ix system I have currently.
> > > > >
> > > > >
> > > > > > I just tested it on the Mac with two separate devices and -Ma and I can’t reproduce the problem. I can receive channel messages alright.
> > > > > > ========================
> > > > > > Prof. Victor Lazzarini
> > > > > > Maynooth University
> > > > > > Ireland
> > > > > >
> > > > > > >
> > > > > > > The odd thing is that it affects control change but not note on/off. The portmidi module code does make any distinction between the two.
> > > > > > >
> > > > > > > Prof. Victor Lazzarini
> > > > > > > Maynooth University
> > > > > > > Ireland
> > > > > > >
> > > > > > >>
> > > > > > >> *Warning*
> > > > > > >> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> > > > > > >> Aha, that is the issue, thanks Victor. This is with Csound 6. Although this is a workaround, it's not a good solution because my keyboard has no knobs/sliders. My LaunchControl has both buttons and knobs, and I was able to use it, but I want the features of my K-Board -- buttons are not as good as a real keyboard.
> > > > > > >>
> > > > > > >> It would be nice if one could select multiple specific devices, e.g. "--midi-device=3,4" but that would be a feature request.
> > > > > > >>
> > > > > > >> - Dave
> > > > > > >>
> > > > > > >> Did you try selecting a single device at a time?
> > > > > > >> Maybe -Ma is the problem.
> > > > > > >>
> > > > > > >> What version is this?
> > > > > > >>
> > > > > > >> Prof. Victor Lazzarini
> > > > > > >> Maynooth University
> > > > > > >> Ireland
> > > > > > >>
> > > > > > >>>
> > > > > > >>> *Warning*
> > > > > > >>> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> > > > > > >>> Thanks, Giovanni. I have tried ctrl7 with the same result.
> > > > > > >>>
> > > > > > >>> I added a call to midin to see what the raw MIDI input looks like. Very interesting -- I am getting data from the controllers, but the status byte is always 0 rather than 176 B0 control change. This explains why I'm not getting the CC changes, but it raises the question -- why is Csound getting status=0 for all these messages? In MIDI-OX, I can see status byte B0 whenever I move a controller.
> > > > > > >>>
> > > > > > >>> Hi Dave,
> > > > > > >>> to me works well, of course I must held the note. Normally I use ctrl7, in order to control better the Midi channel.
> > > > > > >>> greetings
> > > > > > >>> Giovanni
> > > > > > >>>
> > > > > > >>>>
> > > > > > >>>> Hi all,
> > > > > > >>>>
> > > > > > >>>> I am not able to get MIDI controllers to work. I'm on Win11 and I have three devices connected a keyboard and two controllers. All three are working properly according to MIDI-OX. Both controllers are configured with a knob set to use CC 11, verified in MIDI-OX.
> > > > > > >>>>
> > > > > > >>>> Here's a simple test program based on examples in the manual. When I run it, the instrument runs when I press a key, and I'm getting note and velocity data. But kamp never changes. What am I missing? Result it the same whether or not I explicitly set -+rtmidi. See console output below the code.
> > > > > > >>>>
> > > > > > >>>> <CsoundSynthesizer>
> > > > > > >>>> <CsOptions>
> > > > > > >>>> -d -m7 -odac1 -+rtmidi=portmidi -Ma
> > > > > > >>>> ; -d -m7 -odac1 -Ma
> > > > > > >>>> </CsOptions>
> > > > > > >>>> <CsInstruments>
> > > > > > >>>> sr=48000
> > > > > > >>>> ksmps=1
> > > > > > >>>> nchnls=2
> > > > > > >>>> 0dbfs=1
> > > > > > >>>>
> > > > > > >>>> instr 1
> > > > > > >>>> imax = 1
> > > > > > >>>> imin = 0
> > > > > > >>>> ictlno = 11
> > > > > > >>>>
> > > > > > >>>> ; ipch pchmidi
> > > > > > >>>> icps cpsmidi
> > > > > > >>>> ivel veloc
> > > > > > >>>> prints&quot;icps=%f ivel=%f\\n&quot;, icps, ivel
> > > > > > >>>>
> > > > > > >>>> kamp midic7 ictlno, imin, imax
> > > > > > >>>> ; ktrig changed2 kamp
> > > > > > >>>> ; printks&quot;ktrig=%f kamp=%f\\n&quot;, 1, ktrig, kamp
> > > > > > >>>> printk2 kamp
> > > > > > >>>>
> > > > > > >>>> asig oscili kamp, icps, 1
> > > > > > >>>> outs asig, asig
> > > > > > >>>> endin
> > > > > > >>>>
> > > > > > >>>> </CsInstruments>
> > > > > > >>>> <CsScore>
> > > > > > >>>> f 0 36000
> > > > > > >>>> f 1 0 4096 10 1 ;sine wave
> > > > > > >>>> e
> > > > > > >>>> </CsScore>
> > > > > > >>>> </CsoundSynthesizer>
> > > > > > >>>>
> > > > > > >>>> Excerpts from the console:
> > > > > > >>>>
> > > > > > >>>> 0: Focusrite USB MIDI portmidi
> > > > > > >>>> 1: SHIK N32B V3 portmidi
> > > > > > >>>> 2: TouchOSC Bridge portmidi
> > > > > > >>>> 3: Launch Control portmidi
> > > > > > >>>> 4: K-Board portmidi
> > > > > > >>>> PortMIDI: Activated input device 0: 'Focusrite USB MIDI' MMSystem
> > > > > > >>>> PortMIDI: Activated input device 1: 'SHIK N32B V3' MMSystem
> > > > > > >>>> PortMIDI: Activated input device 2: 'TouchOSC Bridge' MMSystem
> > > > > > >>>> PortMIDI: Activated input device 3: 'Launch Control' MMSystem
> > > > > > >>>> PortMIDI: Activated input device 4: 'K-Board' MMSystem
> > > > > > >>>>
> > > > > > >>>> SECTION 1:
> > > > > > >>>> ftable 1:
> > > > > > >>>> rtevent: T 0.085 TT 0.085 M: 0.00000 0.00000
> > > > > > >>>> new MIDI alloc for instr 1:
> > > > > > >>>> icps=293.656485 ivel=40.000000
> > > > > > >>>> i1 1.00000
> > > > > > >>>> rtevent: T 12.885 TT 12.885 M: 1.00000 1.00000
> > > > > > >>>> Csound mailing list Csound@listserv.heanet.ie LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE Send bugs reports to Issues · csound/csound · GitHub Discussions of bugs and features can be posted here
> > > > > > >>>
> > > > > > >>> Csound mailing list Csound@listserv.heanet.ie LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE Send bugs reports to Issues · csound/csound · GitHub Discussions of bugs and features can be posted here Csound mailing list Csound@listserv.heanet.ie LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE Send bugs reports to Issues · csound/csound · GitHub Discussions of bugs and features can be posted here
> > > > > > >> Csound mailing list Csound@listserv.heanet.ie LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE Send bugs reports to Issues · csound/csound · GitHub Discussions of bugs and features can be posted here Csound mailing list Csound@listserv.heanet.ie LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE Send bugs reports to Issues · csound/csound · GitHub Discussions of bugs and features can be posted here
> > > > > > > Csound mailing list Csound@listserv.heanet.ie LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE Send bugs reports to Issues · csound/csound · GitHub Discussions of bugs and features can be posted here
> > > > > >
> > > > > >
> > > > > >
> > > > > > Csound mailing list
> > > > > > Csound@listserv.heanet.ie
> > > > > > LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE
> > > > > > Send bugs reports to
> > > > > > Issues · csound/csound · GitHub
> > > > > > Discussions of bugs and features can be posted here
> > > > > >
> > > > Csound mailing list Csound@listserv.heanet.ie LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE Send bugs reports to Issues · csound/csound · GitHub Discussions of bugs and features can be posted here
> > > Csound mailing list Csound@listserv.heanet.ie LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE Send bugs reports to Issues · csound/csound · GitHub Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE Send bugs reports to Issues · csound/csound · GitHub Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie

Send bugs reports to
        Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here