[Csnd] MIDI input question: "note off" messages
Date | 2019-11-08 01:35 |
From | Dave Seidel |
Subject | [Csnd] MIDI input question: "note off" messages |
I have been learning to use midiin (along with "massign 0,0") for a more direct handling of MIDI input. I've noticed that I only get "note on" messages (status 144) and never "note off" (status 128). Instead of "note off", I see another "note on" but with velocity of 0.
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've got logic to handle this fine, but I'd like to understand what's going on. I can verify (using aseqdump on Linux and MIDI-Ox on Win) that my input consists of note on and off messages, but Csound apparently translates the "note off" messages. Is this by design? Thanks, Dave |
Date | 2019-11-08 01:52 |
From | Joseph Hughes |
Subject | Re: [Csnd] MIDI input question: "note off" messages |
I ran into this recently and learned about it. The following is a thorough and clear description I found on an audio forum. I think this is likely what's going on: "There's a thing in MIDI called "running status". Normally a MIDI message consists of a status byte (which always begins with the high order bit set to one: 1xxxxxxx), followed by 2 data bytes (which always have the high order bit set to zero: 0xxxxxxx). The status byte is used to describe the type of message, there's one code for note-on, another for note-off, another for control change, etc... Then the first data byte describes WHICH control or note has been changed. i.e. the CC# or the note #. Because we never use the high-bit, we get a range of 0 - 127. And the second data byte describes the position of the control or the velocity of the note. Again we have a range of 0 - 127 (however for note velocities, zero is reserved to mean note off because...) If a whole bunch of messages come through, all for the same status, MIDI has the ability to save a some bandwidth by leaving out the status byte. This is called "running status". And obvious use for it is when performing a control change, you can save 1/3 of the traffic on the MIDI cable by only sending the status byte at the beginning of the stream (note that this works only as long as the stream isn't interrupted by any other type of message status. As soon as another type of message comes through, the running status is broken). And to take advantage of this for note data, a stream of note-ons and note-offs can be differentiated by the velocity value in the 2nd data byte, without needing to send a new status byte every time your performance switches from note-on to note-off. So by the MIDI spec, you are required to treat a note-on with zero velocity exactly the same as you would a note-off." Credit: AdmiralQuality on the kvraudio.com forums On Thu, Nov 7, 2019 at 8:37 PM Dave Seidel <dave.seidel@gmail.com> wrote:
|
Date | 2019-11-08 01:55 |
From | Dave Seidel |
Subject | Re: [Csnd] MIDI input question: "note off" messages |
Very interesting! Makes sense, but it doesn't explain why I see note-offs when I monitor MIDI using aseqdump or MIDI-Ox, but the same input looks different in Csound. Also in my case, I'm sending notes very slowly, sometimes seconds apart, and not sending any control or programs changes at all -- very sparse. On Thu, Nov 7, 2019 at 8:53 PM Joseph Hughes <joehughesmail@gmail.com> wrote:
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
|
Date | 2019-11-08 02:50 |
From | Pete Goodeve |
Subject | Re: [Csnd] MIDI input question: "note off" messages |
Attachments | None |
Date | 2019-11-08 03:20 |
From | Pete Goodeve |
Subject | Re: [Csnd] MIDI input question: "note off" messages |
Attachments | None |
Date | 2019-11-08 03:45 |
From | Pete Goodeve |
Subject | Re: [Csnd] MIDI input question: "note off" messages |
Attachments | None None OnOff.mid |
Date | 2019-11-08 03:58 |
From | Dave Seidel |
Subject | Re: [Csnd] MIDI input question: "note off" messages |
Thanks, Pete, this is helpful. I will test my results again in this light tomorrow night. On Thu, Nov 7, 2019 at 10:45 PM Pete Goodeve <pete.goodeve@computer.org> wrote: Hah! MAybe I see the problem! Are you *sure* your source
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
|
Date | 2019-11-08 22:42 |
From | Jacques |
Subject | Re: [Csnd] MIDI input question: "note off" messages |
Hello Dave, I ran accross missing note off when dealing with General MIDI files generated by a sequencer. In General MIDI Channel 10 is reserved for percussive instruments, some software puts in note off, some does not. It’s a few years ago, I remember having the same problems when loading the midi files. I then found out that omitting note off in channel 10 is tolerated in General MIDI. All the best, Jacques
|
Date | 2019-11-09 21:21 |
From | Pete Goodeve |
Subject | Re: [Csnd] MIDI input question: "note off" messages |
Attachments | None |
Date | 2019-11-09 21:33 |
From | Dave Seidel |
Subject | Re: [Csnd] MIDI input question: "note off" messages |
Great tip, did not consider using "od"! Yes, I guess it's just the reality that most (or at least many) devices don't send note-offs. But that's fine -- my code is already dealing with this properly. Thanks for everyone's comments, I learned a few things. By the way, the code I'm referring to is v3 of the Implication Organ, which I just updated today: https://github.com/DaveSeidel/music-src/tree/master/implication-organ - Dave On Sat, Nov 9, 2019 at 4:22 PM Pete Goodeve <pete.goodeve@computer.org> wrote: Hi,
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
|
Date | 2019-11-10 23:36 |
From | Dave Seidel |
Subject | Re: [Csnd] MIDI input question: "note off" messages |
Thanks again for the od tip, got it working using the appropriate device on my system, which is /dev/snd/midiC1D0. And as predicted, it is not sending note-offs at all, just note-ons with 127 or 0 velocity. Specifically, the first byte is either 144 (i.e.: 144+0 for the first channel) and 145 (i.e, 144+1 for the second channel). I am happy to be assured that Csound is correctly representing the input it sees! :-) Also great to have a method to see the uninterpreted data. On Sat, Nov 9, 2019 at 4:22 PM Pete Goodeve <pete.goodeve@computer.org> wrote: Hi,
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
|