Cabbage Logo
Back to Cabbage Site

Implementing USB Midi Controller to Control Sliders In Cabbage?

Hi there. I am very new to cabbage and I’m trying to work out how to assign “sliders” to encoders on my midi controller in cabbage. I don’t see it written in the manual that this is possible.

I have no issue controlling when I export my instrument as a VST and midi map she using it in my DAW, but I just want to be able to externally control these pots/sliders as I’m tweaking instruments in the building process. Maybe it’s not possible?

Thanks!:slight_smile:

Sure, you can use the ctrl7 opcodes in Csound if you know the MIDI channel and controller number. For example, the following code will grab the value from MIDI controller 1 on channel 1 and map it to the on-screen slider. I’ve also added a way to override the incoming MIDI stream if you wish to use the on-screen controls instead.

test.csd (566 Bytes)

You will still need to know the number and channel of the MIDI slider. But if you need to get these details it can also be done using Csound. Let me know and I can show you how.

Thanks so much, Rory. I’ll employ this method and see if it works:)

Yeah I’m up and running with midi now. Thanks! I just got Cabbage running on my phone too.

This has got me thinking… would it be possible to get the cabbage phone app and the cabbage computer program to work together on a common task?

For example: I’d like to use the phone app as a simple cabbage X/Y effect controller that would effect a cabbage synth I’ve set up on the mac. The phone would send midi via usb connection (or even bluetooth?). The android X/Y controller would form a component of the synth also, though it would be controlled remotely (sort of like a Korg Kaoss pad). One could then play the synth using a simple midi keyboard connected via usb to the computer.

Could the phone app and osx version of cabbage communicate in this way? I guess not as they’d both be running separate programs.

That’s a nice idea. It would have to be done with some kind of wireless OSC messages, which should be possible but I’m not sure how much work it would involve. In fact, there are already opcodes available for sending data over a network. Might be worth trying to them and seeing if they work?

So you should probably look at the OSC opcodes themselves, along with socksend and scokrec opcodes. Both of those options might work fine.

Cheers! Yeah I see that midi messages are not possible for this, only OSC… or I’ll also look into the new codes you’ve mentioned just now.

I’m about to have a go on my partner’s phone as mine is too old to run Csound. I’ll just try to pair my mac and that phone over wifi and send from the cabbage on the phone using “socksend” and receive on macbook using “sockrecv”. I’ll report back.

Really appreciate the continual tips Rory!

I’d try osc first as those opcodes are better developed than the socket ones. Let me know how it goes.

Cheers. I had no luck with the socksend/sockrecv last night. Will try OSC properly tonight. Maybe I should focus on trying it with Csound first and then see if I can implement it with Cabbage.

What you can try is the two OSC examples that ship with Cabbage. They can be found in the Instructional examples menu. Run one on your phone and the other on your desktop. make sure both device are on the same network. I am pretty sure this works fine over a normal wired network, but I’ve no idea if it will work over a wireless one. I would try myself but I’m up to my eyes right now with other stuff.

I appreciate this Rory. I actually don’t want you to try on my behalf as I’m doing this for a project so need to learn it myself;)

I didn’t see those OSC examples until now. Great! Thanks

I just tried it there and had no luck. I’ll ask on the main Csound list and see what people think. It would be nice to be able to do this!

[edit] sorry, I only just saw your last message about not trying!! I’ll leave it with you to investigate then. You should probably do some digging around on the possibility of sending OSC messages over WIFI networks. Let me know what you dig up.

Great thanks!

I just succeeded in getting the send/rec sliders to communicate between two MacBooks. Well one slider only goes up a tiny amount and the other jumps up on the “OSCrec” one, but I’ll fiddle with the settings and see if I can get it to be fluid.

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