Sending Audio over OSC

Keith's icon

Hi I would like to send audio to another application(Touch Designer) with OSC. I'm wondering if anybody has any ideas how to go about doing this. If I were to use the snapshot~ object I'll lose samples so I'm hoping that someone might have a better way.

thanks
Keith

EMV's icon

I am not entirely sure, but I don't think this will work. OSC is designed for control rate data, audio is much faster.
I highly doubt any OSC-capable program or device will be happy with throughput of 44.1 kHz or higher.

Georg Hajdu's icon

It's possible but tricky. If course, you wouldn't want to send every single sample individually, but instead a vector consisting of a large number of samples (512 is a good number) which the receiver would write to a buffer (from which the audio signal would be read). There are some considerations regarding the protocols to be used: udp is faster, but imposes some limits what the packet size is concerned; and packets may get lost on the network. Tcp is safer, and accommodated larger packets, but it's also slower since a confirmation is sent back to the sender that the packet was received. Another aspect is that if you were to send a vector via OSC, you'd probably try to avoid converting the signal vector into a Max control message. Jit.net.send in conjunction with jit.poke~ will allow you to send vectors via the network without the vector ever hitting the control world. Maybe this could be the answer to your problem?

Keith's icon

Thanks for the replies guys. I also thought using Jitter might work to sample audio, but I've tried sending actual video over Jit.net.send to Touch before with no luck so I'm not sure how to recieve it. I was on the touch forum and one of the developers gave me a tip on how to send audio over OSC between to different Touch Designer apps but I'm not sure how to implement it Max. Maybe someone here might have an idea. Here is the tip below;

You should be able to send audio streams from other applications to TouchDesigner using OSC and its bundles format.

This is cut/pasted from another forum post from one of our developers, and we can expand on it further if you are interested in audio streans into/out of TouchDesiger:

"You should find you can send 16 @ 16khz channels between two Touch's on the network easily.
We also tried 6 channels @ 48khz.

One thing to keep in mind, is that we now have an option to send multiple samples per message at once. (Format: Timeslice)

example:

bundle 1: timestamp (/_samplerate ,f 16000) (/x ,ffff 1 2 3 4) (/y ,ffff 1 2 3 4)
bundle 2: timestamp (/_samplerate ,f 16000) (/x ,ffff 5 6 7 8) (/y ,ffff 5 6 7 8)

The CHOP actually sends up to 90 samples per channel, not the 4 shown above.
This cuts down dramatically on the data pushed through compared to one sample at a time.
"

If anyone can help I would totally appreciate it.

Thanks
Keith

hodok's icon

It would be really handy if you could send audio through OSC in standardized ways(to any application with OSC support). If anybody from OSC(I don't know if it's exclusively CNMAT or also somebody else) developers reading this, I would humbly ask you to think about implementation of it.
MIDI standart, which the OSC should be replacement of, is capable to send audio at least in non-realtime, so why OSC shouldn't have any audio features?

Roman Thilenius's icon

that "nonrealtime" is what makes the little difference.

vichug's icon

sending audio through midi ???!! where did you see that ?? i'm really curious !
Sending audio through osc for now seems like a hack... osc not beeing designed for audio etc. Maybe a better route to look at would be NetJack, thouh i'm not sure it's fully functionnal yet... Though native, standard audio through osc would indeed be rad ! though i guess would need a lot of work to redefine it...

mzed's icon

Are you sending audio between two applications on one computer? I'm assuming Windows, since you mentioned TouchDesigner.

Jack is probably your best bet:
http://jackaudio.org/download

---

On OSX, I'd look at Soundflower:
https://code.google.com/p/soundflower/

Wetterberg's icon

>sending audio through midi ???!! where did you see that ?? i’m really curious !

sysex file transfers, like in old-timey samplers, I'm guessing. Shit, I would NOT want to revisit those "glory days". Nuh-uh.

Roman Thilenius's icon

most old samplers did that, akai, ensoniq, roland, peavy ...

took some time, but was a nice free alternative to using SCSI connections or built-in harddrives.

vichug's icon

oh... i might have underestimated the "non realtime" here :D especially since, in those days and ages, you could do AMAZING things with a 2 second audio sample at a weird sample rate like 11 kHz and weird bit depth like 8 bits...

Roman Thilenius's icon

absolutely.

it is a shame what i am able to do with gigasampler, maxmsp and nuendo today compared to what i was doing with my first 12 bit sampler with some 30 seconds of total sampling time.

vichug's icon

Maybe tells a bit more about ourselves and how we behave in regard to technology than we would like, eh ?

Wetterberg's icon

What do you mean, Vichug?

I've done midi sample transfers, first on an AKAI s950, then s1000, IIRC, then a yamaha a5000. Each time a very unpleasant experience - and not in the "enhances my creativity" kind of way, in a "oh my GOD I'm about to stab a fool, why's this taking so long?!? " kinda way.

Copying over on floppies was much more pleasant.

vichug's icon

(that i don't get used to better technology as much/fast as i would, and it doesn't automatically imply the progresses i wish it would. i say "we" but...)

Roman Thilenius's icon

@wetterberg: if you send the files via midi to an editor, you could edit the sample on your atari or mac, then send it back to your akai.

Pedro Santos's icon

The feature is called "MIDI Sample Dump" and was developed in 1985 as an addition to the Detailed MIDI Specification 1.0. It was transmitted using System Exclusive messages and yes, it took forever because of MIDI's astonishing 31250 bps baud rate! The funny thing is that there was an addendum to this standard to update the sample limit from 2 MB to 32 GB... I can't imagine the time it would take...

But I agree that we really get spoiled nowadays! With so much more technological resources and knowledge at our disposal, we sometimes are able to accomplish less than in the past...