Teensy 3.2 + OSC + Reaper

Status
Not open for further replies.

Kaitain

Member
Hello all

I'm bulding a MIDI controller for an EQ plugin using Teensy 3.2 (I use Reaper as host, but could be any other). The hardware and MIDI parts work fine. Now I'm tring to add OSC functionality and I need a llitle help here.

I've looked into all this:

https://github.com/CNMAT/OSC
https://www.reaper.fm/sdk/osc/osc.php
https://forum.pjrc.com/threads/18849-Open-Sound-Control

and the OSC examples, but after diggin in all this info I don't know how to start programming the Teensy to start sending and receiving OSC messages using the Teensy's USB. Can anyone point me in the right way?
What should I do first? Is there any example code to do this?

Thank you!
 
Yes, I've looked into that examples. My problem is that I don't know which example is the most sitable for my needs.

Is there any place where explains what example is for?

Thanks!
 
These examples are proofs of concept and short demos. They normally have nothing to do with specific needs of someone. Before you start coding whatever, you will have to define your needs and an algorithm to satisfy these needs. Then, you transform your algorithm into a flow diagram. After that, you translate each diagram block into c or c++ code. That’s the moment where you may take inspiration from examples or from existing libraries on how to realize a specific functionality.
Developing software is not dumb copying and pasting other people’s code snippets together, it’s an analytic and scientific procedure.
 
These examples are proofs of concept and short demos. They normally have nothing to do with specific needs of someone. Before you start coding whatever, you will have to define your needs and an algorithm to satisfy these needs. Then, you transform your algorithm into a flow diagram. After that, you translate each diagram block into c or c++ code. That’s the moment where you may take inspiration from examples or from existing libraries on how to realize a specific functionality.
Developing software is not dumb copying and pasting other people’s code snippets together, it’s an analytic and scientific procedure.

Thank you for your answer. Maybe I have not explained myself well.

I know what is an example code. I also know what is software developing. I've made a MIDI controller using Teensy and I've programmed it already. It works. What I'm trying to do now is expanding this MIDI capabilit of my controller to OSC.

In order to do that I've made a research, I've been playing with TouchOSC to made the first tests and to figure out how this OSC thing works. I've also digged into the code of the examples incuded with Arduino/Teensiduino IDE.

My problem, and that's why I'm asking for help, is that I find this examples a little obscure. I guess there's a lot of OSC stuff for me to learn, because I can't find what is every example for, or at least I don't undertand it.

Maybe someone has tried to do the same thing? In that case, could someone -ideally- tell me what instructions do I have to use to, starting from a potentiometer reading, build up a OSC message and send it over USB, so a VST plugin can understand it?

If we were talking about MIDI, that would be something like:

// Read pot value
value = analogRead(pinNumber);

// Convert it to 1-127 scale
midiVal = value >> 3;

// Send it over USB as a CCH message
usbMIDI.sendControlChange(midiVal, midiChannel);

Is there some similar code with OSC? If, as I suppose, OSC is more complex than that, could some tell me which one of the included examples is closer? Maybe "SerialSendMessage"?

I hope I've explained right now.

Thanks again everyone!
 
Hello again

I thing I've managed to send some OSC messages throug the USB. Just attaching a pot to analog(0) and:

Code:
#include <OSCMessage.h>
 
float curVal;
float prevVal=0;


void setup() {
  Serial.begin(9600);   
}


void loop(){

  OSCMessage msg("n/track/1/volume");
  curVal=analogRead(0);
  
  if (curVal != prevVal) {
      msg.add(curVal);
      msg.send(Serial); 

      prevVal=curVal;    
  }
  delay(20);
}

I have two questions though. The results on the Teensy Monitor are weird:
SerialMonitor.jpg

ASCII characters appear insteaad of the float type values expected. Any ideas?

Besides, the next step should be to somehow communicate this to Reaper. However Reaper OSC configuration window expects an IP/Port.
Reaper.jpg


As long as I'm using the USB to transmit the OSC messages with no Wifi/Ethernet involved, what Teensy's IP/port should I use?

Thank you in advance
 
Hi again.

I've managed to send OSC messages using SLIP serial library. The problem now is that these messages are coming into the computer through the USB port, and my sequencer (Reaper), when congigured to OSC, is waiting for packets from the network card, with their corresponding IP address and port.

So, it seems that now I need an intermediate program that takes the SLIP messages from the USB and "tricks" the SO, making it to think that these messages comes in fact from the network card.

So far haven't found anything like that. What I've found is a lot of apps useful to share your USB devices over an network, but what I need this hapenning inside my own computer. Any ideas?

Cheers

Alvaro
 
Status
Not open for further replies.
Back
Top