vivid- Sound synthesis with SuperCollider

Safe HaskellNone
  • ScopedTypeVariables
  • BangPatterns
  • OverloadedStrings
  • ExplicitForAll
  • LambdaCase



Library for interacting with the SuperCollider server.

You don't need to use much of this day-to-day

There's a toplevel scServerState that stores the current state of the SC server



call :: OSC -> IO () Source

Send an OSC message to the SuperCollider server

callBS :: ByteString -> IO () Source

Send a ByteString to the SuperCollider server. You usually want to use call instead. May be removed in future versions.

quit :: IO () Source

Stop the SuperCollider server

cmdPeriod :: IO () Source

Your "emergency" button. Run this and everything playing on the SC server will be freed -- silence!

Corresponds to the cmd-. / ctrl-. key command in the SuperCollider IDE

newtype NodeId Source




unNodeId :: Int32


newtype BufferId Source




unBufferId :: Int32


setMaxBufferIds :: Int32 -> IO () Source

If you've started the SC server with a non-default number of buffer ids, (e.g. with the "-b" argument), you can reflect that here

Note that the buffer ids start at 512, to not clash with any that sclang has allocated

makeBuffer :: Int32 -> IO BufferId Source

Make an empty buffer

The Int32 is the buffer length in samples. Multiply seconds by the default sample rate of the server (usually 48000) to get the number of samples

makeBufferFromFile :: FilePath -> IO BufferId Source

Make a buffer and fill it with sound data from a file

saveBuffer :: BufferId -> FilePath -> IO () Source

Write a buffer to a file

createSCServerConnection :: HostName -> ServiceName -> IO Socket Source

You usually don't need to call this function

Use this if to connect on a non-default port or to a server not at localhost

Otherwise the connection is created when it's needed. You can also use this to explicitly create the connection, so the computation is done upfront

The HostName is the ip address or "localhost". The ServiceName is the port

callAndWaitForDone :: OSC -> IO () Source

Async messages to the sc server get responded to with "/done" -- so this calls those functions and waits for the "/done" before continuing