I'm using a raspberry pi 4 running Patchbox OS and Pisound. I've found that using [notein] adds up to 40 ms latency when using the hardware midi inputs of Pisound. However, using [midiin] instead I can get it as low as 5 ms latency! Not sure why notein adds so much delay... Anyway now I need a way to sort the midi data coming in from [midiin] into note values and velocity, But the stream of numbers enter sequentially and not as a list, so I don't have a way of sorting the numbers. Any ideas how to way easily route the incoming note value and velocity down different paths? Thanks!
-
[midiin] to note values?
-
"Easy," not really -- because the meaning of byte 'n' depends on what was byte 'n-1'. The current received byte has to set the routing for the next byte, which is a bit outside of normal straight-shot patching.
However I tested this with some simulated messages (including running status bytes) and it does seem to parse them out correctly. You could extend it for other message types too, but I don't have time to go further than this.
23-0916-midiin-state-machine.pd
hjh
-
Wow that proved to be more complicated than I first thought! Thanks a ton for that patch, It works great! I don't really need more than note values for this project anyway.
-
@bamsehopp said:
Thanks a ton for that patch, It works great!
Oh, glad to hear that, I did only the barest minimal testing so I wasn't sure if there were any bugs. I had done state machines in SuperCollider but not so much in Pd up to this point.
hjh
-
I didn't notice any bugs, and was actually able to play a whole gig last night using your code in my custom built pd sampler! So i think its safe to say its an efficient method!
-
(edit: updated patch in following message)
Hello, I have been fiddling around wondering about how to make a vanilla midiparser that can handle MPE messages like release velocity - your patch was really helpful, thanks!
I've completed it with all the types of 'midi status bytes' that I know of, and changed the routing system a little bit. It seems to be working well for me.
Thanks for the info about latency and the native notein object.
Hope someone finds this useful,
Sam. -
This is an updated patch, I hadn't quite got the hang of 'running status'. The patch now also has all the midi real time messages. The most helpful tutorial I have found for understanding how to handle midi is this one: https://learn.sparkfun.com/tutorials/midi-tutorial/all
-