Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: Teensy 3.2 + OSC + Reaper

  1. #1
    Junior Member
    Join Date
    Jan 2018
    Posts
    12

    Teensy 3.2 + OSC + Reaper

    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!

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Location
    Boston, MA, USA
    Posts
    1,102
    In the Arduino environment, Files > Examples > OSC will get you all the examples

  3. #3
    Junior Member
    Join Date
    Jan 2018
    Posts
    12
    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!

  4. #4
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,522
    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.

  5. #5
    Junior Member
    Join Date
    Jan 2018
    Posts
    12
    Quote Originally Posted by Theremingenieur View Post
    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!

  6. #6
    Junior Member
    Join Date
    Jan 2018
    Posts
    12
    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:
    Click image for larger version. 

Name:	SerialMonitor.jpg 
Views:	19 
Size:	44.8 KB 
ID:	12968

    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.
    Click image for larger version. 

Name:	Reaper.jpg 
Views:	16 
Size:	97.6 KB 
ID:	12969


    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

  7. #7
    Junior Member
    Join Date
    Jan 2018
    Posts
    12
    Still stucked. Any help?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •