-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client Demo code #16
Comments
I second Skandix request. I think that using Python as a client has more sense than using it as a server. As a client, Python can be used to generate midi events and control different hardware or software synthethisers, allowing algorithmically created/generative music. I'm specially interested in using Python in iPad (either with Pythonista or Pyto) to control other iPad synths. Neither Pythonista nor Pyto provide any kind of access to CoreMidi API, nor virtual ports, so it occured to me that a possible way could be to use RTP-MIDI. Indeed, pymidi can be used from Pythonista/Pyto, and I successfully ran the server example in Pyto, and connected it to rtpmidi (the server shows the peer joining). But since I don't have a hardware midi keyboard attached to the computer, I was unable to send any midi event to pymidi server. I hoped than connecting a virtual keyboard in the iPad to the same network midi session would work, but no. When keys were pressed in the virtual keyboard in the iPad, those keys were sent via wifi to the computer, but the computer did not broadcast them among the session participants as I hoped. I guess I lack a proprer understanding of how midi network sessions work. Do you think that my goal would be possible? I mean, to run in the iPad one or more synths, all of them conected to a network midi session, and control them from python also running in the ipad. Preferibly also without needing a computer in the same wifi. |
Right - any examples or code on how to send MIDI back to a connected peer would be very useful. |
@mik3y Maybe take a look at the issues once in a while? |
@skandix I've seen the issue. Unfortunately having time to address it is a different matter. |
I'll have a go at answering this one as it's quite easy to do. Two parts, configuring the Windows end of rtpMIDI and then the pymidi end om whatever device you're running it, in my case a Raspberry Pi, which I've named on the network as "rpi-midi". rtpMIDI on Windows
pymidi setup
Now you should see connection message appear in pymidi output, and on Windows under rtpMIDI, you should hopefully now see some value under latency. To test, I just opened MIDI-OX, selected the MIDI port from the local name in the first step of the Windows setup, set MIDI-OX to use the keyboard for MIDI keys and hitting keys, you should see messages reported from pymidi. |
@lepetitjardin thank you! I really appreciate you chipping in and adding some knowledge/examples here. I copied your example over to the wiki here: https://github.com/mik3y/pymidi/wiki/Example-with-rtpMIDI However... I think what people are after are how to use pymidi in the other direction, as a client. Maybe something like:
Unfortunately, I originally/only wrote pymidi to be a server, so this doesn't exist yet. I took a look over the weekend and have merged a work-in-progress. When it works, I'll cut a new release. In the meantime, anyone adventurous can had around from source. 8a017c6 |
And thank you for your code too. I can send over some screenshots if you want to add those to the Wiki.
Yes, that would be awesome. However, I think we need to be careful about the use of client and server here as the RTP MIDI protocol can be bi-directional between client and server anyway, at least from my limited reading of the specification and the diagram on the Wikipedia page about it.
So I think pymidi acting as a server could still possibly transmit or send RTP MIDI messages.
Will have a look, thanks. |
You know, I'm not sure how I overlooked that for so long but you're definitely right. In completing this work, refactoring the "Server" interface to be bi-directional, and consistent with the rest of the MIDI, would probably make a lot of sense. Great suggestion thanks. |
Hello, any update on this topic? It would be very useful not just to get and send midi messages in server mode. Thanks for your work. |
In my case, having Pymidi act as a client makes a lot more sense. My setup is to have a softsynth running on Windows, with the rtpmidi driver on Windows acting as a server listening for data. I want a RasPi to send MIDI data to the Windows box, which will be played through the synth. Since the RasPi is the transient device here, definitely want it to be able to do the outbound connection to another RTP-MIDI device. The version of pymidi that gets installed from pip is apparently quite different than the one here, even though the version numbers match (0.5.0). As-is, the pip version is not compatible with the exampe code:
I haven't yet tried pulling the Git version, I'll do that in a bit here, but I'm going to play around with the code to see if I can improve on the client side code. I was planning to implement my own version, but if I can improve on this one hopefully it will be more useful on a broad scale. |
Sorry about that - I typically tag releases but continue marching forward in master after doing so. You'll see v0.5.0 in history - that should match pip.
I will happily support as best I can! (review PRs, share what I know, etc). |
Has there been any update on this? The version on pip is different, but I updated it with the code on here and still can't get messages going out using the examples. |
This seems to work for me, however, I can't find any information on how to disconnect from a server. https://github.com/mik3y/pymidi/blob/main/examples/example_client.py I tried looking but not sure what should be sent |
@guysoft I guess that |
@jldiaz Nope, does not work. Here is how it looks: If I look at the server side there is some kind of disconnect message. But I need to capture traffic so I can pinpoint it |
Is it possible that you could make an example of how one could use this to communicate with for example Tobias Erichsen rtpMidi (https://www.tobias-erichsen.de/software/rtpmidi.html)
The text was updated successfully, but these errors were encountered: