Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Monad variant of interaction with the scsynth server.
Synopsis
- async :: DuplexOsc m => Message -> m Message
- async_ :: DuplexOsc m => Message -> m ()
- maybe_async :: DuplexOsc m => Message -> m ()
- maybe_async_at :: DuplexOsc m => Time -> Message -> m ()
- type Sc3_Address = (String, Int)
- sc3_default_udp :: Sc3_Address
- sc3_udp_limit :: Num n => n
- withSc3At :: Sc3_Address -> Connection Udp a -> IO a
- withSc3 :: Connection Udp a -> IO a
- withSc3_ :: Connection Udp a -> IO ()
- withSc3_tm :: Double -> Connection Udp a -> IO (Maybe a)
- withSc3AtSeq :: Sc3_Address -> Int -> Connection Udp a -> IO [a]
- withSc3AtSeq_ :: Sc3_Address -> Int -> Connection Udp a -> IO ()
- stop :: SendOsc m => m ()
- reset :: SendOsc m => m ()
- type Play_Opt = (Node_Id, AddAction, Group_Id, [(String, Double)])
- play_graphdef_msg :: Play_Opt -> Graphdef -> Message
- recv_or_load_graphdef :: Transport m => Graphdef -> m Message
- playGraphdef :: Transport m => Play_Opt -> Graphdef -> m ()
- playSynthdef :: Transport m => Play_Opt -> Synthdef -> m ()
- playUgen :: Transport m => Play_Opt -> Ugen -> m ()
- run_bundle :: Transport m => Time -> Bundle -> m ()
- nrt_play :: Transport m => Nrt -> m ()
- nrt_play_reorder :: Transport m => Nrt -> m ()
- nrt_audition :: Nrt -> IO ()
- class Audible e where
- auditionAt :: Audible e => Sc3_Address -> Play_Opt -> e -> IO ()
- auditionAtSeq :: Audible e => Sc3_Address -> Play_Opt -> Int -> e -> IO ()
- def_play_opt :: Play_Opt
- audition :: Audible e => e -> IO ()
- auditionSeq :: Audible e => Int -> e -> IO ()
- withNotifications :: DuplexOsc m => m a -> m a
- b_getn1_data :: DuplexOsc m => Int -> (Int, Int) -> m [Double]
- b_getn1_data_segment :: DuplexOsc m => Int -> Int -> (Int, Int) -> m [Double]
- b_fetch :: DuplexOsc m => Int -> Int -> m [[Double]]
- b_fetch1 :: DuplexOsc m => Int -> Int -> m [Double]
- b_fetch_hdr :: Transport m => Int -> Int -> m ((Int, Int, Int, Double), [[Double]])
- b_query1_unpack_generic :: (DuplexOsc m, Num n, Fractional r) => Int -> m (n, n, n, r)
- b_query1_unpack :: DuplexOsc m => Buffer_Id -> m (Int, Int, Int, Double)
- c_getn1_data :: (DuplexOsc m, Floating t) => (Int, Int) -> m [t]
- n_query1_unpack_f :: DuplexOsc m => (Message -> t) -> Node_Id -> m t
- n_query1_unpack :: DuplexOsc m => Node_Id -> m (Maybe (Int, Int, Int, Int, Int, Maybe (Int, Int)))
- n_query1_unpack_plain :: DuplexOsc m => Node_Id -> m [Int]
- g_queryTree1_unpack :: DuplexOsc m => Group_Id -> m Query_Node
- serverStatus :: DuplexOsc m => m [String]
- server_status_concise :: DuplexOsc m => m String
- serverSampleRateNominal :: DuplexOsc m => m Double
- serverSampleRateActual :: DuplexOsc m => m Double
- serverStatusData :: DuplexOsc m => m [Datum]
- serverTree :: DuplexOsc m => m [String]
hosc variants
maybe_async :: DuplexOsc m => Message -> m () Source #
If isAsync
then async_
else sendMessage
.
maybe_async_at :: DuplexOsc m => Time -> Message -> m () Source #
Variant that timestamps synchronous messages.
type Sc3_Address = (String, Int) Source #
Hostname and port number.
sc3_default_udp :: Sc3_Address Source #
Local host (ie. 127.0.0.1
) at port sc3_port_def
sc3_udp_limit :: Num n => n Source #
Maximum packet size, in bytes, that can be sent over Udp. However, see also https://tools.ietf.org/html/rfc2675
withSc3At :: Sc3_Address -> Connection Udp a -> IO a Source #
Bracket Sc3
communication at indicated host and port.
withSc3 :: Connection Udp a -> IO a Source #
Bracket Sc3
communication, ie. withSc3At
sc3_default_udp
.
import Sound.Sc3.Server.Command
withSc3 (sendMessage status >> waitReply "/status.reply")
withSc3_tm :: Double -> Connection Udp a -> IO (Maybe a) Source #
timeout_r
of withSc3
withSc3AtSeq :: Sc3_Address -> Int -> Connection Udp a -> IO [a] Source #
Run f at k scsynth servers with sequential port numbers starting at sc3_port_def
.
withSc3AtSeq sc3_default_udp 2 (sendMessage status >> waitReply "/status.reply")
withSc3AtSeq_ :: Sc3_Address -> Int -> Connection Udp a -> IO () Source #
void
of withSc3AtSeq
.
Server control
Composite
type Play_Opt = (Node_Id, AddAction, Group_Id, [(String, Double)]) Source #
(node-id,add-action,group-id,parameters)
recv_or_load_graphdef :: Transport m => Graphdef -> m Message Source #
If the graph size is less than sc3_udp_limit
encode and send
using d_recv_bytes
, else write to temporary directory and read
using d_load
.
playGraphdef :: Transport m => Play_Opt -> Graphdef -> m () Source #
Send d_recv
and s_new
messages to scsynth.
playSynthdef :: Transport m => Play_Opt -> Synthdef -> m () Source #
Send d_recv
and s_new
messages to scsynth.
playUgen :: Transport m => Play_Opt -> Ugen -> m () Source #
Send an anonymous instrument definition using playSynthdef
.
Nrt
run_bundle :: Transport m => Time -> Bundle -> m () Source #
Wait (pauseThreadUntil
) until bundle is due to be sent relative
to the initial Time
, then send each message, asynchronously if
required.
nrt_play :: Transport m => Nrt -> m () Source #
Play an Nrt
score (as would be rendered by writeNrt
).
let sc = Nrt [bundle 1 [s_new0 "default" (-1) AddToHead 1] ,bundle 2 [n_set1 (-1) "gate" 0]] in withSc3 (nrt_play sc)
nrt_play_reorder :: Transport m => Nrt -> m () Source #
Variant where asynchronous commands at time 0
are separated out and run before
the initial time-stamp is taken. This re-orders synchronous
commands in relation to asynchronous at time 0
.
Audible
class Audible e where Source #
Class for values that can be encoded and send to scsynth
for audition.
playAt :: Transport m => Play_Opt -> e -> m () Source #
play :: Transport m => e -> m () Source #
Variant where id is -1
.
auditionAt :: Audible e => Sc3_Address -> Play_Opt -> e -> IO () Source #
auditionAtSeq :: Audible e => Sc3_Address -> Play_Opt -> Int -> e -> IO () Source #
withSc3AtSeq
of playAt
.
def_play_opt :: Play_Opt Source #
Default Play_Opt
, ie. (-1,addToHead,1,[])
Notifications
withNotifications :: DuplexOsc m => m a -> m a Source #
Turn on notifications, run f, turn off notifications, return result.
Buffer & control & node variants.
b_getn1_data :: DuplexOsc m => Int -> (Int, Int) -> m [Double] Source #
Variant of b_getn1
that waits for return message and unpacks it.
withSc3_tm 1.0 (b_getn1_data 0 (0,5))
b_getn1_data_segment :: DuplexOsc m => Int -> Int -> (Int, Int) -> m [Double] Source #
Variant of b_getn1_data
that segments individual b_getn
messages to n elements.
withSc3_tm 1.0 (b_getn1_data_segment 1 0 (0,5))
b_fetch :: DuplexOsc m => Int -> Int -> m [[Double]] Source #
Variant of b_getn1_data_segment
that gets the entire buffer.
b_fetch1 :: DuplexOsc m => Int -> Int -> m [Double] Source #
First channel of b_fetch
, errors if there is no data.
withSc3 (b_fetch1 512 123456789)
b_fetch_hdr :: Transport m => Int -> Int -> m ((Int, Int, Int, Double), [[Double]]) Source #
Combination of b_query1_unpack
and b_fetch
.
b_query1_unpack_generic :: (DuplexOsc m, Num n, Fractional r) => Int -> m (n, n, n, r) Source #
b_info_unpack_err
of b_query1
.
b_query1_unpack :: DuplexOsc m => Buffer_Id -> m (Int, Int, Int, Double) Source #
Type specialised b_query1_unpack_generic
.
withSc3 (b_query1_unpack 0)
c_getn1_data :: (DuplexOsc m, Floating t) => (Int, Int) -> m [t] Source #
Variant of c_getn1
that waits for the reply and unpacks the data.
n_query1_unpack_f :: DuplexOsc m => (Message -> t) -> Node_Id -> m t Source #
Apply f to result of n_query
.
n_query1_unpack :: DuplexOsc m => Node_Id -> m (Maybe (Int, Int, Int, Int, Int, Maybe (Int, Int))) Source #
Variant of n_query
that waits for and unpacks the reply.
n_query1_unpack_plain :: DuplexOsc m => Node_Id -> m [Int] Source #
Variant of n_query1_unpack
that returns plain (un-lifted) result.
g_queryTree1_unpack :: DuplexOsc m => Group_Id -> m Query_Node Source #
Variant of g_queryTree
that waits for and unpacks the reply.
Status
serverStatus :: DuplexOsc m => m [String] Source #
Collect server status information.
withSc3 serverStatus >>= mapM putStrLn
server_status_concise :: DuplexOsc m => m String Source #
Collect server status information.
withSc3 server_status_concise >>= putStrLn
serverSampleRateNominal :: DuplexOsc m => m Double Source #
Read nominal sample rate of server.
withSc3 serverSampleRateNominal
serverSampleRateActual :: DuplexOsc m => m Double Source #
Read actual sample rate of server.
withSc3 serverSampleRateActual
serverStatusData :: DuplexOsc m => m [Datum] Source #
Retrieve status data from server.
Tree
serverTree :: DuplexOsc m => m [String] Source #
Collect server node tree information.
withSc3 serverTree >>= mapM_ putStrLn