Skip to content

Repository files navigation

ocaml-osc

Build status

Pure OCaml implementation of the Open Sound Control protocol.

Dependencies:

Usage

If you just need to parse and serialise OSC packets, use the Osc.Codec module:

# require "osc";;
#openOsc.Types;;
#let data =Osc.Codec.of_packet (Message {address ="/hello/world"; arguments = [Int32123l; String"foo"]});;
valdata : bytes="/hello/world\000\000\000\000,is\000\000\000\000{foo\000"#let packet =Osc.Codec.to_packet data;;
valpacket : (packet, [ `Missing_typetag_string | `Unsupported_typetagofchar ]) Rresult.result=Rresult.Ok (Message {address ="/hello/world"; arguments = [Int32123l; String"foo"]})

To simplify sending and receiving OSC packets over the network, the modules Osc_lwt and Osc_unix are available:

# require "osc.lwt";;
# require "lwt.syntax";;
#openOsc.Types;;
# lwt client =Osc_lwt.Udp.Client.create ();;
valclient : Osc_lwt.Udp.Client.t=<abstr>#let addr =Unix.ADDR_INET (Unix.inet_addr_of_string "127.0.0.1", 57120);;
valaddr : Lwt_unix.sockaddr=Unix.ADDR_INET (<abstr>, 57120)
# lwt ()=Osc_lwt.Udp.Client.send client addr (Message {address ="/hello/world"; arguments = [Int32123l; String"foo"]});;

About

Pure OCaml implementation of the Open Sound Control protocol

Resources

Stars

27 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages