81 lines
No EOL
2.4 KiB
Racket
81 lines
No EOL
2.4 KiB
Racket
#lang scribble/doc
|
|
|
|
@(require scribble/manual
|
|
scribble/bnf)
|
|
|
|
@title{@bold{rsc3}: SuperCollider client library}
|
|
|
|
@author[(author+email "Mustafa Khafateh" "mushk45@gmail.com")]
|
|
|
|
@(require (for-label "main.rkt"))
|
|
|
|
@defmodule[rsc3]{This collection provides means to work with the SuperCollider
|
|
synthesis server
|
|
|
|
|
|
@defproc[(audition [ugen ugen?]) ()]{
|
|
|
|
Plays sound generated by the ugen. This creates a synthdef,
|
|
sends it to the server using the name "anonymous" and group 1, and creates a new synth.
|
|
|
|
Example:
|
|
@racketblock[
|
|
;; play sin wave
|
|
(audition (out 0 (mul (sin-osc ar 440 0) 0.1)))
|
|
]
|
|
}
|
|
|
|
}
|
|
|
|
@section{Communicating with the SuperCollider server (scsynth)}
|
|
|
|
Most functions that send messages to the server do so by accepting a socket type as the first argument.
|
|
This function is passed to with-udp-sc3 or with-tcp-sc3, which call the function on a socket of a specific type.
|
|
Assumes the scsynth is running using udp at port 57110.
|
|
|
|
@defproc[(with-udp-sc3 [func procedure?]) any/c]{
|
|
func should be a function that takes a socket (reset is an example of such a function).
|
|
with-udp-sc3 opens a udp socket, calls func on that socket, closes the socket, and returns the return value of func.
|
|
|
|
Example:
|
|
@racketblock[
|
|
(with-udp-sc3 reset)
|
|
]
|
|
|
|
}
|
|
|
|
@defproc[(with-tcp-sc3 [func procedure?]) any/c]{
|
|
Same as with-udp-sc3 but uses the tcp protocol.
|
|
}
|
|
|
|
@defproc[(play [fd (or udp:socket? tcp:socket?)] [ugen ugen?]) any/c]{
|
|
|
|
The same as audition but without the socket creation step. (audition uses play)
|
|
|
|
Using the given socket, plays sound generated by the ugen. This creates a synthdef,
|
|
sends it to the server using the name "anonymous" and group 1, and creates a new synth.
|
|
|
|
This example, play-ugen, is equivalent to the function audition.
|
|
|
|
@racketblock[
|
|
(define (play-ugen ugen)
|
|
(with-udp-sc3 (lambda (fd)
|
|
(play fd ugen))))
|
|
|
|
]
|
|
|
|
}
|
|
|
|
@defproc[(send [fd (or udp:socket? tcp:socket?)] [message message?]) ()]{
|
|
Sends an OSC message to the server using the socket fd.
|
|
}
|
|
|
|
@defproc[(async [fd (or udp:socket? tcp:socket?)] [message message?]) ()]{
|
|
Sends an OSC message to the server using the socket fd and waits (blocks)
|
|
for a /done message from the server.
|
|
}
|
|
|
|
|
|
@section{Reporting Bugs}
|
|
|
|
For Heaven's sake, report lots of bugs! |