Hi!

I dont have the Bela hardware yet but was wondering if it would be possible to use Bela to analyze audio say in PD but send that analysis data to a pc?

We are using Touchdesigner to create realtime visuals and the latency in audio interfaces is usually a lot. I know Bela handles audio real quick, but if i want to send that data to a pc say via ethernet or usb or just umm analog pins -> arduino, whatever, would it be possible to get that data to use in a pc with the same low latency?

Thanks! Marko

Hi,
not sure what you want to send across? Is it a full audio stream or just the result of the analysis?
If this is the case, the latency is surely going to be high (I used to be able to do it with about 300samples latency, using this JUCE-based vst plugin I wrote (NOTE: it is probably mostly working, but I am not planning to provide support for it just now)). If the audio stream is going to be longer than a few minutes, you may need additional buffering or some sort of clock drift correction.

If you only want to send some sort of metadata that result from the analysis, then consider using OSC messages, which could go through the ethernet-over-USB connection to your computer.
Alternatively, you may be able to use ipmidi (I have an experimental kernel build where qmidinet works and can be accessed through Bela's Midi API), but you are probably better off with OSC.
When transmitting anything overs MIDI or USB or Ethernet or WiFi, you lose Bela's guarantee of real-time and low-latency. I expect typical performance to be in the range of 2ms if you do not have a huge amount of data to send across, but worst case is not guaranteed.

I'd like to send only the analysis data. A single value for the amplitude, and if possible amplitude for as many frequency bands as possible (32?) aka spectrum analysis for use in audio visualisation, triggering events etc.

Out of the options you gave me OSC through ethernet seems like the way to go. I wonder how long it takes for the whole thing? Audio gets throught the converters in Bela with ultra low latency so it's the PD patch + the trip through USB to pc. Hmm...

Thanks for the info! Bela's such a cool project!

I guess it probably takes 1ms (on average) to send it over to the host, but I cannot tell what the latency in your application is going to be!

It takes 16ms to render a frame now in Touchdesigner because i'm running it on 60 frames per second. Data moves quicker though, so i'd guess when Bela/PD -data hits my program, it'll 'move things' in the next frame. I read somewhere that projectors can have a buffer too which would be something i cant really do much about.

I'm just thinking out loud, trying to find a better solution. Thanks for your help

    mmake What you're trying to do sounds similar to what Bela's built-in scope does - i.e send a stream of audio data over a socket (the scope uses websockets, but OSC over UDP would probably be faster) to an application on the client where it is rendered visually.

    The scope can be pretty CPU-hungry, but if you get the settings correct the latency is not a problem at all for real-time visualisation.