[OSC_dev] No dumpOSC output in pipe in non-interactive terminal

Torsten Anders torsten.anders at plymouth.ac.uk
Sat Sep 8 17:55:39 PDT 2007


Dear Stephen,

thanks for your reply.

On Sep 8, 2007, at 4:14 PM, Stephen Sinclair wrote:
> However, if you do want to call an external program and capture its
> output, I suggest looking up the "popen" function.

An equivalent to this is exactly what I tried to use in the first  
place, and where I ran into the problems reported in my first email  
here :-P

> I do suggest you link to an OSC static library

What I need is primarily the encoding and decoding of OSC packets  
(including timestamps) from plain C values into a binary stream  
according to the OSC specification and back. I don't actually need  
the library to provide the networking, as I already have a nicely  
working socket interface in my language. It would be great, if the  
library is platform independent (i.e., runs on UNIX and Windows).  
Finally, I would prefer C over C++, as I only need few encoding/ 
decoding functions: interfacing classes to my language would make  
things more complex (and I know C++ even less than C).

I looked at the various libraries available. liblo is a platform  
independent C library, but it does not yet support timestamped  
bundles fully (cf. its TODO file but also http://sourceforge.net/ 
mailarchive/forum.php?thread_name=1157972566.614.75.camel% 
40chop.state51.co.uk&forum_name=liblo-devel).

The OpenSound Control Kit is a C library, but people seem to  
discourage using it (cf. http://opensoundcontrol.org/node/83). Also,  
it appears to be UNIX only.

WOscLib and oscpack are both multi-platform, but are C++  
implementations. Finally, libosc++ provides only a partial  
implementation of the OSC protocol.

Recommendations for my specific requirements are highly appreciated.

Best
Torsten

On Sep 8, 2007, at 4:14 PM, Stephen Sinclair wrote:
> Hello,
>
> Torsten, I do suggest you link to an OSC static library instead of
> depending on an external executable, because it's quite a round-about
> solution to read a binary stream, convert it to ASCII, pass it through
> a socket, and then convert it back to binary.  Not only is this very
> inefficient, but you are losing precision in your floating point
> values.
>
> However, if you do want to call an external program and capture its
> output, I suggest looking up the "popen" function.  It executes a
> program and returns a pipe for you to read and write which are
> connected to the standard input and standard output of the program.
> This is what you want to use in a Unix environment.
>
> If you need to do something similar on Windows, it isn't as easy, but
> it is certainly possible..
> Here's an example of how to do it on Windows:
> http://svn.abisource.com/abiword-plugins/trunk/wp/scripts/shell/win/ 
> fakepopen.cpp
>
>
> Steve
>
>
> On 9/8/07, Torsten Anders <torsten.anders at plymouth.ac.uk> wrote:
>> Dear all,
>>
>> just to inform: I found some hackerish way around it: I am calling
>> dumpOSC in an interactive terminal and use netcat to send its output
>> to my application via a socket. So, all OSC traffic goes though the
>> network twice, once encoded and then as plain text (see below). Not
>> necessarily the most efficient way, but most easy to implement ;-)
>>
>>    ./dumpOSC -quiet 1234 | nc localhost 50001
>>
>> Thanks again for your comments -- and would still be happy to learn
>> why dumpOSC doesn't output in a non-interactive 'terminal'.
>>
>> Best
>> Torsten

--
Torsten Anders
Interdisciplinary Centre for Computer Music Research
University of Plymouth
http://strasheela.sourceforge.net
http://www.torsten-anders.de




More information about the OSC_dev mailing list