Cabbage Logo
Back to Cabbage Site

Implementing USB Midi Controller to Control Sliders In Cabbage?

Yeah, the sliders just had different settings and now one moves the other fluidly:)

Cool. So the two MacBooks are on the same Wifi network? Or is a wired network? If it’s a wireless network then it should work on a phone too, unless Android is somehow stopping it. Perhaps you should try with your phone. Maybe I screwed up my test somehow!

They’re on the same wireless/wifi network. I only typed the IP address (of the receiving macbook) into the code of the OSCsend macbook and that has done the trick.

No, it should work with a phone too. I’ll report once I thieve my partners phone once more;)

I noticed that when using the XY slider on both communicating computers that the sending computer transmits the XY pad information to the receiver fine (verified via “printk2”), but the receiving computer’s XY pad does not move in sync. It seems that if you supplement the XY pad on receiver for two sliders, only then do they work perfectly in sync. i.e. the sender’s xy movements are detected on receiver by slider1 for X and slider2 for Y.

I just transferred some codes with a variety of slider and XY configurations (that worked fine mac to mac) to the android phone. The phone is not transmitting any information to the mac over the same wifi network. This is confirmed by “printk2” also. I did not alter the code for android so perhaps there’s a missing piece in the puzzle. I’l keep experimenting.

The XY implementation uses a timer to update it’s values. It’s pretty crude. It works fine when sending data, but for receiving data it’s not so responsive graphically. There might be something on Android preventing the OSC messages from being sent over the network.

I’ve added support for OSC on Android, but I’ve still not being able to get it to speak with my PC. Perhaps you’ll have better luck. Here’s the latest .apk, and I’ve attached the two (updated) example files I was testing with. They should work, you may need to use the same address you used before to communicate between your two PCs.

https://copy.com/DBLAoS14ZBn8Uieg
CabbageOSCSend.csd (655 Bytes)
CabbageOSCRec.csd (637 Bytes)

1 Like

I’ll give it a go in the morning, android to mac, and I’ll report back. Thanks Rory!

Happy to inform you that it works!

I have tested both the pairs of sliders in your example and also an X/Y on android sending information to a pair of sliders on mac and it all seems to work perfectly.

Thanks so much for adding that functionally to the android app, Rory:)

What did you use for the IP address? I tried passing the IP of my PC to the Android instrument, but nothing was being picked up on my PC? I’ve never used OSC across devices before.

Okay. You don’t need to type any IP address into the code of ‘CabbageOSCRec.csd’ on your PC/mac. Leave it the exact same as the one above.

If your IP address is like mine and in the form of ‘XXX.XXX.X.X’, then in the ‘CabbageOSCsend’ you type that into line 23… so it will look something like this:

OSCsend kData1+kData2, “XXX.XXX.X.X”, 7770, “/foo/bar”, “ii”, kData1, kData2

Also, it’s best if you change the “max value” of all 4 sliders to be the same value. Something like 100 for each worked for me.

This is exactly what I tried yesterday before reporting that I couldn’t get it to work :frowning: Looks like it might just be something odd with my home network. Anyhow, it’s not something I need, but I’m glad to hear it’s working for you. How is the latency?

Visually, there’s minimal latency. They sliders on my mac react pretty quickly to movement on the phone touchscreen.

I’m adding the OSC functionality into my project as soon as I have the phone again and I’ll see if it reacts just as quickly with audio. I’ll let you know.

I use Android manage tool to control device on PV, works well and it can transfer data that USB can’t.

I have been experimenting with OSC. Mac to mac there is no issue. However, from android to mac I’m only able to get it to function on one android device out of all the devices that I’ve tried (all running compatible android OS’s).

I’ve even tried another identical model of phone as the working device with the same settings and OSC does not transmit from that either.

Strange that this one device seems to magically work. I’m using ‘wireshark’ to diagnose and I can see that no osc messages are transmitted from anything else I’ve tried.

Would you have any idea what would be blocking OSC from an android phone/tablet, Rory? I think I’ve exhausted all settings at this stage.

I think you’ve got further with OSC and Cabbage on Android than anyone, so I’m not really sure what the problem might be. Here are some things I would try out (many of which you may already have done)…

  • Install a free OSC application on your Android phone such as GoOSC, and then install an application like OSCDataMonitor on your PC. See if that works Ok with your various devices. If that works, then we know the problem is not with the network or firewall settings, etc. If that doesn’t work, then you may look for a generic solution. Im not sure, but I guess you’re probably not the first person to experience this issue. I’m hoping your problem is present at this stage, because it will be an easier fix.
  • If the above works, then try Cabbage on your phones along with OSCDataMonitor. If the OSC monitor sees nothing then we know it’s an issue somehow with Csound. If that’s the case I can try building you a simple Csound-Android OSC sender app. We could try that in order to rule out it being any issue with Cabbage.
  • If the above works then I can’t see why it would not work with Cabbage/Csound. You could at this stage try GoOSC with Csound/Cabbage. If Cabbage on a PC can pick up messages from GoOSC, then we can assume it is indeed an issue with the Cabbage Android player.
  • Finally, whenever I hit an issue like this, I often turn to native Csound to see if the problem persists there. It helps me rule out Cabbage as a source of the problem.

Let me know how you get on. There is a new release of Csound on its way shortly. Updating the Csound that ships with Cabbage on Android might help resolve some issues, but I can’t say for sure because I don’t know how much work has been done with OSC in the latest release.

I’ll try out some of those tips and get back to you. I have not used native Csound on android before so this might be a good opportunity to check it out also.

Many thanks!

I began with option one, above. Neither android devices I have here transmit any OSC from GoOSC to OSCDataMonitor. I don’t have the known working device to hand but tomorrow I can check if that one transmits.

Ok. So we can rule out there being an issue with Cabbage. Something is preventing the OSC messages from being deliver on those phones. Next step would be to check out the forums of the more mature OSC platforms on Android. For example, you might look at the TouchOSC forum. Perhaps someone has had the same problems there. You could also check out the Lemur forums.

It sounds like a firewall issue, but I can’t say what might be causing it.

Yes, thanks. I’ve already placed a few messages on some forums. One OSC mailing list advised me to use wireshark to troubleshoot. Your method above is a lot more clear… I wasn’t aware of a GoOSC not OSCDatMonitor before. They’re great!

I’ve never used GoOSC but it was written by Andres Cabrera who has done a lot of work on Csound over the years. He also wrote CsoundQT. He’s a good guy. If the problems persist I can ask him if he has any ideas.