Open Sound Control library for Guile
 
 
 
 
 
 
Go to file
Jurij Podgoršek 3fefaf4b24 WIP GNU build 2025-03-14 01:01:36 +01:00
build-aux WIP GNU build 2025-03-14 01:01:36 +01:00
examples Rename Eos demo file to the filename referenced in README.md 2024-04-11 20:23:06 +02:00
extensions WIP GNU build 2025-03-14 01:01:36 +01:00
m4 WIP GNU build 2025-03-14 01:01:36 +01:00
open-sound-control Add add-osc-wildcard 2024-03-17 18:12:09 +01:00
.gitignore WIP GNU build 2025-03-14 01:01:36 +01:00
LICENSE Create LICENSE 2023-04-16 21:36:07 +02:00
Makefile.am WIP GNU build 2025-03-14 01:01:36 +01:00
README.md Add Eos example 2024-04-11 20:20:09 +02:00
autogen.sh WIP GNU build 2025-03-14 01:01:36 +01:00
bootstrap WIP GNU build 2025-03-14 01:01:36 +01:00
configure.ac WIP GNU build 2025-03-14 01:01:36 +01:00
env.in WIP GNU build 2025-03-14 01:01:36 +01:00
meson.build Rearrange namespace 2023-04-16 15:51:41 +02:00
pre-inst-env.in WIP GNU build 2025-03-14 01:01:36 +01:00

README.md

Guile-OSC: Open Sound Control for Guile Scheme

Guile-OSC is a Guile wrapper for liblo, enabling Open Sound Control clients and servers to be implemented from Scheme.

Getting started

You will need the development files for Guile and liblo installed, as well as Meson. Then:

$ git clone https://github.com/taw10/guile-osc.git guile-osc
$ cd guile-osc
$ meson setup build
$ ninja -C build
$ sudo ninja -C build install

Then, to receive OSC messages from within a Guile program:

(use-modules (open-sound-control server-thread))

(define osc-server (make-osc-server-thread "osc.udp://:7770"))

(add-osc-method osc-server
                "/my/osc/method"   ;; Method name
                "fi"               ;; Argument types (see liblo manual)
                (lambda (float-arg int-arg)
                   (do-something ...)))

(add-osc-method osc-server
                "/my/other/method"   ;; Method name
                ""                   ;; No arguments
                (lambda ()
                   (do-stuff ...)))

To define a wildcard method, which matches everything, use add-osc-wildcard instead of add-osc-method, leave the method name out but keep everything else.

If the separate server thread doesn't work in your application, there's also a blocking server option:

(use-modules (open-sound-control server))

(define s (make-osc-server "osc.udp://:7770"))

(add-osc-method s ....)

(osc-recv s)  ;; Blocks for 1 second, or until a message is received

You can even have multiple blocking servers at once: (osc-recv server1 server2).

To send messages (with parameters):

(use-modules (open-sound-control client))

(define osc-send-addr (make-osc-address "osc.udp://localhost:7771"))

(osc-send osc-send-addr "/their/osc/method" 1 2 4)
(osc-send osc-send-addr "/their/other/method" "string-arg")
(osc-send osc-send-addr "/yet/another/method" 0.3 "hello")

To send messages "from" a particular server, e.g. to communicate bidirectionally via a TCP connection, use osc-send-from. For example:

(define srv (make-osc-server "osc.tcp://:8000"))
(define dst (make-osc-address "osc.tcp://192.168.178.35:8000"))
(osc-send-from dst srv "/method/name" 1 2 3)

Examples

See examples/eos-x1k2.scm for an example. This is the script I use, in conjunction with x1k2-midi-osc-alsa, to connect a USB MIDI control surface to Eos.

Licence

LGPL 2.1, the same as liblo itself.