CNMAT OSC Library with teensy speed improvement

Hi all,

I am currently working on a project where I have to transmit data from a Teensy 3.1 to a computer.

The basic idea is the following : collect data from a matrix of sensors (9x9) using Adafruit's ADS1015 ADC to the teensy using I2C interface. Then create OSC messages for each sample using CNMAT's OSC for arduino library and transmit it to a Processing sketch throught SLIPSerial.

Timing performance is a key there and I already managed to reduce the whole matrix scanning time by reducing delay time in the ADCs handling libraries and by enabling I2C highspeed mode. I am know at 90ms for the matrix to be scanned.

I know that I can't go faster than 30ms because of ADCs conversion time performances but I am sure I can improve Teensy to PC communication.

Basically, for each sample, what I am doing is :

  • create an OSCmessage with an address
  • get a read from the ADC using I2C interface
  • add the read value to the message
  • open SLIPStream
  • send the bytes to the SLIP stream
  • end OSC Packet

I would like to know how to improve that part, knowing that baudrate considerations apparently don't apply to Teensies as the USB Serial interface is always running at full speed.

Thanks a lot !