LicenseRef-GPL licensed and maintained by Tom Murphy

Module documentation for 0.5.0.0

This version can be pinned in stack with:vivid-osc-0.5.0.0@sha256:633e5c1c87633feaa26019442c3ae63946001c7afe2afa4d2cf22586bd4b182c,2786

Small, simple, and well-tested implementation of the Open Sound Control message format.

Example usage:

:set -XOverloadedStrings
msg = OSC "/foo" [OSC_S "bar", OSC_I 9, OSC_F 0.1, OSC_B "this-is-binary"]
:t msg
> msg :: OSC
:t encodeOSC msg
> encodeOSC msg :: ByteString
decodeOSC (encodeOSC msg) == Right msg
> True

Sending it over UDP (e.g. to TidalCycles), using the network package:

{-# LANGUAGE OverloadedStrings #-}
import Network.Socket
import Network.Socket.ByteString as SB

import Vivid.OSC

main = do
   -- Boring Network.Socket setup:
   (a:_) <- getAddrInfo Nothing (Just "127.0.0.1") (Just "57120")
   s <- socket (addrFamily a) Datagram defaultProtocol
   connect s (addrAddress a)

   -- The interesting part:
   SB.send s $ encodeOSC $
      OSC "/play2" [OSC_S "cps", OSC_F 1.2, OSC_S "s", OSC_S "bd"]
Used by 2 packages in nightly-2019-09-11(full list with versions):
comments powered byDisqus