vivid-osc: Open Sound Control encode/decode

[ audio, codec, library, music, sound ] [ Propose Tags ]

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.25, OSC_B "this-is-binary"]
>>> :t msg
> msg :: OSC
>>> :t encodeOSC msg
> encodeOSC msg :: ByteString
>>> decodeOSC (encodeOSC msg) == Right msg
> True

See the README.md file for examples of sending and receiving with UDP


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.3.0.0, 0.4.0.0, 0.5.0.0
Dependencies base (>3 && <5), binary, bytestring, cereal, time (>=1.2) [details]
License LicenseRef-GPL
Author Tom Murphy
Maintainer Tom Murphy
Category Audio, Codec, Music, Sound
Uploaded by TomMurphy at 2018-10-11T04:11:29Z
Distributions LTSHaskell:0.5.0.0, NixOS:0.5.0.0, Stackage:0.5.0.0
Reverse Dependencies 2 direct, 2 indirect [details]
Downloads 2624 total (26 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-10-11 [all 1 reports]

Readme for vivid-osc-0.4.0.0

[back to package description]

vivid-osc

Example usage:

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"]

Receiving via UDP:

{-# LANGUAGE OverloadedStrings #-}


import Control.Monad (forever)
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
   bind s (addrAddress a)

   forever $ do
      o <- decodeOSC <$> SB.recv s 4096
      case o of
         Right (OSC "/play2" [_, OSC_F vel, _, OSC_S "bd"]) ->
            putStrLn $ if vel < 1
               then "boom"
               else "BOOM!"
         _ -> putStrLn $ "Unexpected input: "++show o