UDP connections from Unity to Max
So I have created a middleware in Max/MSP, as my audio front-end, and I want it to be receiving basic integer data info from Unity, so it adapts audio based on Unity’s gameplay.
there’s a lot of code in the link you sent, it’s not completely clear, to which code you are referring to. However, in general, if data is not arriving, you should double-check if all network addresses are set up properly (and, if the sender and receiver software are on different machines, then also the firewall settings).
Unfortunately I don’t know Unity, but an important question would be, if data is being sent using some common format (like OSC) or not. If yes, then either
net.udp.recv (or even better:
udpreceive) should do the work. If not, you might give a try to my UDP-stream reader object called
sadam.udpReceiver. You should also make sure that Unity is sending the data through UDP and not through TCP, otherwise it won’t work. If you need TCP, you can use
net.tcp.recv for OSC and
sadam.tcpReceiver for non-OSC communication.
Glad you are still looking into this DeusNovus. A solution to using Max/Msp with a gaming platform would be greatly appreciated by many people.
Thanks so much for your answer Adam! From my research, people mostly use net.udp.recv for simple one-way data transfer, and I’ve been told that it’s a "plug ‘n’ play" process, sticking the communication code somewhere in Unity and then Max will automatically start reading data flow through port 32000, by default. I really don’t understand what’s going on.
And grizzle, it has been such a frustrating experience, I’ve losing my hair over this, especially for a non-programmer. Hopefully, I will be updating you guys soon. You can all collaboratively help if you guys are into it, look into UDP/TCP code, simple data transfer examples from Unity to Max etc.