packages feed

hsc3 0.5 → 0.6

raw patch · 11 files changed

+105/−376 lines, 11 filesdep ~hoscPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hosc

API changes (from Hackage documentation)

- Sound.SC3.Server.Process: EventHandler :: (String -> IO ()) -> (String -> IO ()) -> (t -> IO ()) -> EventHandler t
- Sound.SC3.Server.Process: ExtremelyVerbose :: Verbosity
- Sound.SC3.Server.Process: NRTOptions :: Maybe FilePath -> Maybe FilePath -> FilePath -> Int -> String -> String -> NRTOptions
- Sound.SC3.Server.Process: Normal :: Verbosity
- Sound.SC3.Server.Process: Quiet :: Verbosity
- Sound.SC3.Server.Process: RTOptions :: Int -> Int -> Bool -> Int -> Maybe String -> Maybe String -> Int -> Int -> Maybe Int -> Maybe Int -> RTOptions t
- Sound.SC3.Server.Process: ServerOptions :: FilePath -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Bool -> Verbosity -> ServerOptions
- Sound.SC3.Server.Process: Silent :: Verbosity
- Sound.SC3.Server.Process: Verbose :: Verbosity
- Sound.SC3.Server.Process: VeryVerbose :: Verbosity
- Sound.SC3.Server.Process: blockSize :: ServerOptions -> Int
- Sound.SC3.Server.Process: commandFilePath :: NRTOptions -> Maybe FilePath
- Sound.SC3.Server.Process: data EventHandler t
- Sound.SC3.Server.Process: data NRTOptions
- Sound.SC3.Server.Process: data RTOptions t
- Sound.SC3.Server.Process: data ServerOptions
- Sound.SC3.Server.Process: data Verbosity
- Sound.SC3.Server.Process: defaultEventHandler :: EventHandler t
- Sound.SC3.Server.Process: defaultNRTOptions :: NRTOptions
- Sound.SC3.Server.Process: defaultRTOptionsTCP :: RTOptions TCP
- Sound.SC3.Server.Process: defaultRTOptionsUDP :: RTOptions UDP
- Sound.SC3.Server.Process: defaultServerOptions :: ServerOptions
- Sound.SC3.Server.Process: hardwareBufferSize :: RTOptions t -> Int
- Sound.SC3.Server.Process: hardwareDeviceName :: RTOptions t -> Maybe String
- Sound.SC3.Server.Process: hardwareSampleRate :: RTOptions t -> Int
- Sound.SC3.Server.Process: inputFilePath :: NRTOptions -> Maybe FilePath
- Sound.SC3.Server.Process: inputStreamsEnabled :: RTOptions t -> Maybe Int
- Sound.SC3.Server.Process: instance CommandLine (RTOptions t)
- Sound.SC3.Server.Process: instance CommandLine NRTOptions
- Sound.SC3.Server.Process: instance CommandLine ServerOptions
- Sound.SC3.Server.Process: instance Enum Verbosity
- Sound.SC3.Server.Process: instance Eq (RTOptions t)
- Sound.SC3.Server.Process: instance Eq NRTOptions
- Sound.SC3.Server.Process: instance Eq ServerOptions
- Sound.SC3.Server.Process: instance Eq Verbosity
- Sound.SC3.Server.Process: instance OpenTransport TCP
- Sound.SC3.Server.Process: instance OpenTransport UDP
- Sound.SC3.Server.Process: instance Option Int
- Sound.SC3.Server.Process: instance Option String
- Sound.SC3.Server.Process: instance Show (RTOptions t)
- Sound.SC3.Server.Process: instance Show NRTOptions
- Sound.SC3.Server.Process: instance Show ServerOptions
- Sound.SC3.Server.Process: instance Show Verbosity
- Sound.SC3.Server.Process: loadSynthDefs :: ServerOptions -> Bool
- Sound.SC3.Server.Process: maxNumberOfLogins :: RTOptions t -> Int
- Sound.SC3.Server.Process: maxNumberOfNodes :: ServerOptions -> Int
- Sound.SC3.Server.Process: maxNumberOfSynthDefs :: ServerOptions -> Int
- Sound.SC3.Server.Process: numberOfAudioBusChannels :: ServerOptions -> Int
- Sound.SC3.Server.Process: numberOfControlBusChannels :: ServerOptions -> Int
- Sound.SC3.Server.Process: numberOfInputBusChannels :: ServerOptions -> Int
- Sound.SC3.Server.Process: numberOfOutputBusChannels :: ServerOptions -> Int
- Sound.SC3.Server.Process: numberOfRandomSeeds :: ServerOptions -> Int
- Sound.SC3.Server.Process: numberOfSampleBuffers :: ServerOptions -> Int
- Sound.SC3.Server.Process: numberOfWireBuffers :: ServerOptions -> Int
- Sound.SC3.Server.Process: onBoot :: EventHandler t -> t -> IO ()
- Sound.SC3.Server.Process: onPutError :: EventHandler t -> String -> IO ()
- Sound.SC3.Server.Process: onPutString :: EventHandler t -> String -> IO ()
- Sound.SC3.Server.Process: outputFilePath :: NRTOptions -> FilePath
- Sound.SC3.Server.Process: outputHeaderFormat :: NRTOptions -> String
- Sound.SC3.Server.Process: outputSampleFormat :: NRTOptions -> String
- Sound.SC3.Server.Process: outputSampleRate :: NRTOptions -> Int
- Sound.SC3.Server.Process: outputStreamsEnabled :: RTOptions t -> Maybe Int
- Sound.SC3.Server.Process: realTimeMemorySize :: ServerOptions -> Int
- Sound.SC3.Server.Process: serverProgram :: ServerOptions -> FilePath
- Sound.SC3.Server.Process: sessionPassword :: RTOptions t -> Maybe String
- Sound.SC3.Server.Process: tcpPortNumber :: RTOptions t -> Int
- Sound.SC3.Server.Process: udpPortNumber :: RTOptions t -> Int
- Sound.SC3.Server.Process: useZeroconf :: RTOptions t -> Bool
- Sound.SC3.Server.Process: verbosity :: ServerOptions -> Verbosity
- Sound.SC3.Server.Process: withNRT :: ServerOptions -> NRTOptions -> EventHandler Handle -> IO ExitCode
- Sound.SC3.Server.Process: withSynth :: (Transport t, OpenTransport t) => ServerOptions -> RTOptions t -> EventHandler t -> IO ExitCode
- Sound.SC3.UGen.Record.Pitch: Args :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> Args
- Sound.SC3.UGen.Record.Pitch: ampThreshold :: Args -> UGen
- Sound.SC3.UGen.Record.Pitch: data Args
- Sound.SC3.UGen.Record.Pitch: defaults :: Args
- Sound.SC3.UGen.Record.Pitch: downSample :: Args -> UGen
- Sound.SC3.UGen.Record.Pitch: execFreq :: Args -> UGen
- Sound.SC3.UGen.Record.Pitch: initFreq :: Args -> UGen
- Sound.SC3.UGen.Record.Pitch: maxBinsPerOctave :: Args -> UGen
- Sound.SC3.UGen.Record.Pitch: maxFreq :: Args -> UGen
- Sound.SC3.UGen.Record.Pitch: median :: Args -> UGen
- Sound.SC3.UGen.Record.Pitch: minFreq :: Args -> UGen
- Sound.SC3.UGen.Record.Pitch: peakThreshold :: Args -> UGen
- Sound.SC3.UGen.Record.Pitch: pitch :: Args -> UGen -> UGen
+ Sound.SC3.UGen.DiskIO: diskIn :: Int -> UGen -> Loop -> UGen
+ Sound.SC3.UGen.DiskIO: vDiskIn :: Int -> UGen -> UGen -> Loop -> UGen

Files

Help/UGen/Analysis/pitch.help.lhs view
@@ -17,6 +17,8 @@ maxFreq = 4000, execFreq = 100, maxBinsPerOctave = 16, median = 1, ampThreshold = 0.01, peakThreshold = 0.5, downSample = 1. +> import Sound.SC3+ > let { x = mouseX KR 220 660 Linear 0.1 >     ; y = mouseY KR 0.05 0.25 Linear 0.1 >     ; s = sinOsc AR x 0 * y
+ Help/UGen/DiskIO/diskIn.help.lhs view
@@ -0,0 +1,23 @@+diskIn nc b l++  nc - number of channels+   b - buffer number+   l - loop indicator++Continously play a soundfile from disk. This requires a buffer to+be preloaded with one buffer size of sound.  The buffer size must+be a multiple of twice the synth block size. The default block size+is 64.++> import Sound.SC3++> let { f = "/home/rohan/audio/metal.wav"+>     ; n = 1+>     ; g = out 0 (diskIn n 0 Loop) }+> in withSC3 (\fd -> do { async fd (b_alloc 0 8192 n)+>                       ; async fd (b_read 0 f 0 (-1) 0 1)+>                       ; play fd g })++> withSC3 (\fd -> do { reset fd+>                    ; async fd (b_close 0)+>                    ; async fd (b_free 0) })
+ Help/UGen/DiskIO/vDiskIn.help.lhs view
@@ -0,0 +1,24 @@+vDiskIn nc b r l++  nc - number of channels+   b - buffer number+   r - playback rate+   l - loop indicator++Continously play a soundfile from disk with variable playback+rate. This requires a buffer to be preloaded with one buffer size of+sound.  The buffer size must be a multiple of twice the synth block+size. The default block size is 64.++> import Sound.SC3++> let { f = "/home/rohan/audio/metal.wav"+>     ; n = 1+>     ; g = out 0 (vDiskIn n 0 (sinOsc KR 0.25 0 * 0.25 + 1) Loop) }+> in withSC3 (\fd -> do { async fd (b_alloc 0 8192 n)+>                       ; async fd (b_read 0 f 0 (-1) 0 1)+>                       ; play fd g })++> withSC3 (\fd -> do { reset fd+>                    ; async fd (b_close 0)+>                    ; async fd (b_free 0) })
Help/UGen/External/vosim.help.lhs view
@@ -13,6 +13,8 @@       decay - sets the decay factor. +> import Sound.SC3+ > do { p <- tRand 0 1 (impulse AR 6 0) >    ; let { t = impulse AR (9 * ( 1 + ( p >* 0.95))) 0 >          ; x = mouseX KR 0.25 2 Linear 0.2
Help/UGen/Trigger/stepper.help.lhs view
@@ -17,9 +17,13 @@ resetval - value to which the counter is reset when it receives a            reset trigger. If nil, then this is patched to min. +> import Sound.SC3+ > let { i = impulse KR 10 0 >     ; f = stepper i 0 4 16 (-3) 4 * 100 } > in audition (out 0 (sinOsc AR f 0 * 0.1))++> import System.Random  > let { compose = foldl (flip (.)) id >     ; noisec n l r = randomRs (l,r) (mkStdGen n)
− Sound/SC3/Server/Process.hs
@@ -1,324 +0,0 @@-{-# LANGUAGE TypeSynonymInstances #-}--- | This module includes utilities for spawning an external scsynth process,--- either for realtime or non-realtime execution.-module Sound.SC3.Server.Process (-    Verbosity(..),-    ServerOptions(..),-    defaultServerOptions,-    NRTOptions(..),-    defaultNRTOptions,-    RTOptions(..),-    defaultRTOptionsUDP,-    defaultRTOptionsTCP,-    EventHandler(..),-    defaultEventHandler,-    withSynth,-    withNRT-) where--import Sound.OpenSoundControl (Transport, TCP, UDP, openTCP, openUDP)-import Control.Concurrent (forkIO)-import Control.Monad (unless)-import Prelude hiding (catch)-import Data.List (isPrefixOf)-import Data.Maybe (fromMaybe)-import System.Exit (ExitCode)-import System.IO (Handle, hGetLine, hIsEOF, hPutStrLn, stderr, stdout)-import System.Process (runInteractiveProcess, waitForProcess)---- ====================================================================--- scsynth commandline options--class CommandLine a where-    argumentList :: a -> [String]---- | Convert a value to an option string.-class Show a => Option a where-    showOption :: a -> String-    showOption = show---- | String options need special handling (show introduces an additional level--- of quoting).-instance Option (String) where-    showOption = id---- | Option instance for Int with default method implementations.-instance Option (Int)--mkOpt :: (Eq b, Option b, Show b) => String -> (a -> b) -> a -> a -> [String]-mkOpt _ f d v | (f v) == (f d) = []-mkOpt o f _ v                  = [o, showOption (f v)]--mkMaybeOpt :: (Option a, Show a) => String -> Maybe a -> [String]-mkMaybeOpt o = maybe [] ((o:) . (:[]) . showOption)---- ====================================================================--- * Server options---- | Used with the 'verbosity' field in 'ServerOptions'.-data Verbosity =-    Silent-  | Quiet-  | Normal-  | Verbose-  | VeryVerbose-  | ExtremelyVerbose-  deriving (Eq, Show)---- 'Enum' instance for 'Verbosity' for conversion to a commandline option.-instance Enum (Verbosity) where-    fromEnum Silent             = -2-    fromEnum Quiet              = -1-    fromEnum Normal             =  0-    fromEnum Verbose            =  1-    fromEnum VeryVerbose        =  2-    fromEnum ExtremelyVerbose   =  4--    toEnum (-1)                 = Quiet-    toEnum 0                    = Normal-    toEnum 1                    = Verbose-    toEnum 2                    = VeryVerbose-    toEnum x | x >= 4           = ExtremelyVerbose-    toEnum _                    = Silent---- | Specify general server options used b oth in realtime and non-realtime--- mode.-data ServerOptions = ServerOptions {-    serverProgram               :: FilePath,    -- ^ Path to the @scsynth@ program-    numberOfControlBusChannels  :: Int,         -- ^ Number of allocated control bus channels-    numberOfAudioBusChannels    :: Int,         -- ^ Number of allocated audio bus channels-    numberOfInputBusChannels    :: Int,         -- ^ Number of physical input channels-    numberOfOutputBusChannels   :: Int,         -- ^ Number of physical output channels-    blockSize                   :: Int,         -- ^ Synthesis block size-    numberOfSampleBuffers       :: Int,         -- ^ Number of allocated sample buffers-    maxNumberOfNodes            :: Int,         -- ^ Maximum number of synthesis nodes-    maxNumberOfSynthDefs        :: Int,         -- ^ Maximum number of synth definitions-    realTimeMemorySize          :: Int,         -- ^ Realtime memory size in bytes-    numberOfWireBuffers         :: Int,         -- ^ Number of unit generator connection buffers-    numberOfRandomSeeds         :: Int,         -- ^ Number of random number generator seeds-    loadSynthDefs               :: Bool,        -- ^ If 'True', load synth definitions from /synthdefs/ directory on startup-    verbosity                   :: Verbosity    -- ^ 'Verbosity' level-} deriving (Eq, Show)---- | Default server options.-defaultServerOptions :: ServerOptions-defaultServerOptions = ServerOptions {-    serverProgram               = "scsynth",-    numberOfControlBusChannels  = 4096,-    numberOfAudioBusChannels    = 128,-    numberOfInputBusChannels    = 8,-    numberOfOutputBusChannels   = 8,-    blockSize                   = 64,-    numberOfSampleBuffers       = 1024,-    maxNumberOfNodes            = 1024,-    maxNumberOfSynthDefs        = 1024,-    realTimeMemorySize          = 8192,-    numberOfWireBuffers         = 64,-    numberOfRandomSeeds         = 64,-    loadSynthDefs               = True,-    verbosity                   = Normal-}--instance CommandLine (ServerOptions) where-    argumentList v = serverProgram v :-            concat [  mkOpt "-c" numberOfControlBusChannels d v-                    , mkOpt "-a" numberOfAudioBusChannels d v-                    , mkOpt "-i" numberOfInputBusChannels d v-                    , mkOpt "-o" numberOfOutputBusChannels d v-                    , mkOpt "-z" blockSize d v-                    , mkOpt "-b" numberOfSampleBuffers d v-                    , mkOpt "-n" maxNumberOfNodes d v-                    , mkOpt "-d" maxNumberOfSynthDefs d v-                    , mkOpt "-w" numberOfWireBuffers d v-                    , mkOpt "-r" numberOfRandomSeeds d v-                    , mkOpt "-D" (fromEnum . loadSynthDefs) d v-                    , mkOpt "-v" (fromEnum . verbosity) d v ]-        where d = defaultServerOptions---- ====================================================================--- * Realtime options---- | Helper class for polymorphic opening of network connections.-class OpenTransport t where-    openTransport :: RTOptions t -> String -> IO t--instance OpenTransport (UDP) where-    openTransport rtOptions server = openUDP server (udpPortNumber rtOptions)--instance OpenTransport (TCP) where-    openTransport rtOptions server = openTCP server (tcpPortNumber rtOptions)---- | Realtime server options, parameterized by the OpenSoundControl--- 'Transport' to be used.-data RTOptions t = RTOptions {-    -- Network control-    udpPortNumber           :: Int,             -- ^ UDP port number (one of 'udpPortNumber' and 'tcpPortNumber' must be non-zero)-    tcpPortNumber           :: Int,             -- ^ TCP port number (one of 'udpPortNumber' and 'tcpPortNumber' must be non-zero)-    useZeroconf             :: Bool,            -- ^ If 'True', publish scsynth service through Zeroconf-    maxNumberOfLogins       :: Int,             -- ^ Max number of supported logins if 'sessionPassword' is set-    sessionPassword         :: Maybe String,    -- ^ Session password-    -- Audio device control-    hardwareDeviceName      :: Maybe String,    -- ^ Hardware device name (JACK client:server name on Linux)-    hardwareBufferSize      :: Int,             -- ^ Hardware buffer size (no effect with JACK)-    hardwareSampleRate      :: Int,             -- ^ Hardware buffer size (no effect with JACK)-    inputStreamsEnabled     :: Maybe Int,       -- ^ Enabled input streams (CoreAudio only)-    outputStreamsEnabled    :: Maybe Int        -- ^ Enabled output streams (CoreAudio only)-} deriving (Eq, Show)---- | Default realtime server options.-defaultRTOptions :: RTOptions t-defaultRTOptions = RTOptions {-    -- Network control-    udpPortNumber           = 0,-    tcpPortNumber           = 0,-    useZeroconf             = False,-    maxNumberOfLogins       = 16,-    sessionPassword         = Nothing,-    -- Audio device control-    hardwareDeviceName      = Nothing,-    hardwareBufferSize      = 0,-    hardwareSampleRate      = 0,-    inputStreamsEnabled     = Nothing,-    outputStreamsEnabled    = Nothing-}---- | Default realtime server options (UDP transport).-defaultRTOptionsUDP :: RTOptions UDP-defaultRTOptionsUDP = defaultRTOptions { udpPortNumber = 57110 }---- | Default realtime server options (TCP transport).-defaultRTOptionsTCP :: RTOptions TCP-defaultRTOptionsTCP = defaultRTOptions { tcpPortNumber = 57110 }--instance CommandLine (RTOptions t) where-    argumentList v =-        concat [ mkOpt      "-u" udpPortNumber d v-               , mkOpt      "-t" tcpPortNumber d v-               , mkOpt      "-R" (fromEnum . useZeroconf) d v-               , mkMaybeOpt "-H" $ hardwareDeviceName v-               , mkOpt      "-Z" hardwareBufferSize d v-               , mkOpt      "-S" hardwareSampleRate d v-               , mkOpt      "-l" maxNumberOfLogins d v-               , mkMaybeOpt "-p" $ sessionPassword v-               , mkMaybeOpt "-I" $ inputStreamsEnabled v-               , mkMaybeOpt "-O" $ outputStreamsEnabled v ]-        where d = defaultRTOptions---- ====================================================================--- * Non-Realtime options---- | Non-realtime server options.-data NRTOptions = NRTOptions {-    commandFilePath     :: Maybe FilePath,  -- ^ Path to OSC command file ('Nothing' for stdin)-    inputFilePath       :: Maybe FilePath,  -- ^ Path to input sound file ('Nothing' for no audio input)-    outputFilePath      :: FilePath,        -- ^ Path to output sound file-    outputSampleRate    :: Int,             -- ^ Output sound file sample rate-    outputHeaderFormat  :: String,          -- ^ Output sound file header format-    outputSampleFormat  :: String           -- ^ Output sound file sample format-} deriving (Eq, Show)---- | Default non-realtime server options.-defaultNRTOptions :: NRTOptions-defaultNRTOptions = NRTOptions {-    commandFilePath         = Nothing,-    inputFilePath           = Nothing,-    outputFilePath          = "output.wav",-    outputSampleRate        = 44100,-    outputHeaderFormat      = "wav",-    outputSampleFormat      = "int16"-}--instance CommandLine (NRTOptions) where-    argumentList x =-        "-N" : map ($x) [ fromMaybe "_" . commandFilePath-                        , fromMaybe "_" . inputFilePath-                        , outputFilePath-                        , show . outputSampleRate-                        , outputHeaderFormat-                        , outputSampleFormat ]---- ====================================================================--- * Event handler---- | Event handler for handling I/O with external @scsynth@ processes,--- parameterized by the I/O handle used for sending OSC commands to the--- server.-data EventHandler t = EventHandler {-    onPutString :: String -> IO (),     -- ^ Handle one line of normal output-    onPutError  :: String -> IO (),     -- ^ Handle one line of error output-    onBoot      :: t -> IO ()           -- ^ Executed with the OSC handle after the server has booted-}---- | Default event handler, writing to stdout and stderr, respectively.-defaultEventHandler :: EventHandler t-defaultEventHandler = EventHandler {-    onPutString = hPutStrLn stdout,-    onPutError  = hPutStrLn stderr,-    onBoot      = const (return ())-}---- ====================================================================--- Process helpers--pipeOutput :: (String -> IO ()) -> Handle -> IO ()-pipeOutput f h = hIsEOF h >>= flip unless (hGetLine h >>= f >> pipeOutput f h)---- ====================================================================--- * Realtime scsynth execution---- | Execute a realtime instance of @scsynth@ with 'Transport' t and return--- 'ExitCode' when the process exists.-withSynth :: (Transport t, OpenTransport t) =>-    ServerOptions- -> RTOptions t- -> EventHandler t- -> IO ExitCode-withSynth serverOptions rtOptions handler = do-        (_, hOut, hErr, hProc) <- runInteractiveProcess exe args Nothing Nothing-        forkIO $ putStdout0 hOut-        forkIO $ putStderr  hErr-        waitForProcess hProc-    where-        (exe:args) = argumentList serverOptions-                     ++ argumentList rtOptions-        putStdout0 h = do-            eof <- hIsEOF h-            unless eof $ do-                l <- hGetLine h-                if isPrefixOf "SuperCollider 3 server ready.." l-                    then do-                        onPutString handler l-                        fd <- openTransport rtOptions "127.0.0.1"-                        forkIO $ onBoot handler fd-                        -- Spawn more efficient output handler-                        forkIO $ putStdout h-                        return ()-                    else do-                        onPutString handler l-                        putStdout0 h -- recurse-        putStdout = pipeOutput (onPutString handler)-        putStderr = pipeOutput (onPutError  handler)-    --- ====================================================================--- * Non-Realtime scsynth execution---- | Execute a non-realtime instance of @scsynth@ and return 'ExitCode' when--- the process exists.-withNRT ::-    ServerOptions- -> NRTOptions- -> EventHandler Handle- -> IO ExitCode-withNRT serverOptions nrtOptions handler = do-        (hIn, hOut, hErr, hProc) <- runInteractiveProcess exe args Nothing Nothing-        forkIO $ putStdout hOut-        forkIO $ putStderr hErr-        forkIO $ onBoot handler hIn-        waitForProcess hProc-    where-        (exe:args) = argumentList serverOptions-                     ++ argumentList nrtOptions { commandFilePath = Nothing }-        putStdout = pipeOutput (onPutString handler)-        putStderr = pipeOutput (onPutError  handler)---- EOF
Sound/SC3/UGen.hs view
@@ -6,6 +6,7 @@                        module Sound.SC3.UGen.Composite.Monadic,                        module Sound.SC3.UGen.Demand,                        module Sound.SC3.UGen.Demand.Monadic,+                       module Sound.SC3.UGen.DiskIO,                        module Sound.SC3.UGen.Envelope,                        module Sound.SC3.UGen.Envelope.Construct,                        module Sound.SC3.UGen.Enum,@@ -35,6 +36,7 @@ import Sound.SC3.UGen.Composite.Monadic import Sound.SC3.UGen.Demand import Sound.SC3.UGen.Demand.Monadic+import Sound.SC3.UGen.DiskIO import Sound.SC3.UGen.Envelope import Sound.SC3.UGen.Envelope.Construct import Sound.SC3.UGen.Enum
+ Sound/SC3/UGen/DiskIO.hs view
@@ -0,0 +1,32 @@+module Sound.SC3.UGen.DiskIO where++import Sound.SC3.UGen.Enum+import Sound.SC3.UGen.Rate+import Sound.SC3.UGen.UGen+import Sound.SC3.UGen.Utilities++-- | Stream soundfile from disk.+--+--  [@nc@] Number of channels in buffer/soundfile.+--+--  [@bufnum@] Buffer used for streaming (the file descriptor has to be left+--             open, see the @/b_read@ server command).+--+--  [@loop@] Whether to loop playback (0, 1)+--+diskIn :: Int -> UGen -> Loop -> UGen+diskIn nc bufnum loop = mkOsc AR "DiskIn" [bufnum, from_loop loop] nc++-- | Stream soundfile from disk with variable playback rate.+--+--  [@nc@] Number of channels in buffer/soundfile.+--+--  [@bufnum@] Buffer used for streaming (the file descriptor has to be left+--             open, see the @/b_read@ server command).+--+--  [@rate@] Playback rate+--+--  [@loop@] Whether to loop playback (0,1)+--+vDiskIn :: Int -> UGen -> UGen -> Loop -> UGen+vDiskIn nc bufnum rate loop = mkOsc AR "VDiskIn" [bufnum, rate, from_loop loop] nc
− Sound/SC3/UGen/Record/Pitch.hs
@@ -1,47 +0,0 @@--- | A record based interface to the pitch unit generator.-module Sound.SC3.UGen.Record.Pitch (-    Args(..),-    defaults,-    pitch-) where--import Sound.SC3 (UGen)-import qualified Sound.SC3 as SC3--data Args = Args {-    initFreq :: UGen,-    minFreq :: UGen,-    maxFreq :: UGen,-    execFreq :: UGen,-    maxBinsPerOctave :: UGen,-    median :: UGen,-    ampThreshold :: UGen,-    peakThreshold :: UGen,-    downSample :: UGen-}--defaults :: Args-defaults = Args {-    initFreq = 440,-    minFreq = 60,-    maxFreq = 4000,-    execFreq = 100,-    maxBinsPerOctave = 16,-    median = 1,-    ampThreshold = 0.01,-    peakThreshold = 0.5,-    downSample = 1.0-}--pitch :: Args -> UGen -> UGen-pitch args input = SC3.pitch-                    input-                    (initFreq args)-                    (minFreq args)-                    (maxFreq args)-                    (execFreq args)-                    (maxBinsPerOctave args)-                    (median args)-                    (ampThreshold args)-                    (peakThreshold args)-                    (downSample args)
emacs/hsc3.el view
@@ -112,9 +112,19 @@ 				      (thing-at-point 'symbol) 				      "\\.help\\.lhs")))) +(defun chunk-string (n s)+  "Split a string into chunks of 'n' characters."+  (let* ((l (length s))+         (m (min l n))+         (c (substring s 0 m)))+    (if (<= l n)+        (list c)+      (cons c (chunk-string n (substring s n))))))+ (defun hsc3-send-string (s)   (if (comint-check-proc hsc3-buffer)-      (comint-send-string hsc3-buffer (concat s "\n"))+      (let ((cs (chunk-string 64 (concat s "\n"))))+        (mapcar (lambda (c) (comint-send-string hsc3-buffer c)) cs))     (error "no hsc3 process running?")))  (defun hsc3-transform-and-store (f s)
hsc3.cabal view
@@ -1,5 +1,5 @@ Name:              hsc3-Version:           0.5+Version:           0.6 Synopsis:          Haskell SuperCollider Description:       hsc3 provides Sound.SC3, a haskell module that                     facilitates using haskell as a client to the @@ -237,6 +237,8 @@                    Help/UGen/Demand/dwhite.help.lhs                    Help/UGen/Demand/dxrand.help.lhs                    Help/UGen/Demand/tDuty.help.lhs+                   Help/UGen/DiskIO/diskIn.help.lhs+                   Help/UGen/DiskIO/vDiskIn.help.lhs                    Help/UGen/Envelope/detectSilence.help.lhs                    Help/UGen/Envelope/done.help.lhs                    Help/UGen/Envelope/envGen.help.lhs@@ -470,7 +472,7 @@                    Help/UGen/Trigger/trig.help.lhs  Library-  Build-Depends:   base, binary, bytestring, containers, hosc == 0.5,+  Build-Depends:   base, binary, bytestring, containers, hosc == 0.6,                    network, process, random   GHC-Options:     -Wall -fwarn-tabs   Exposed-modules: Sound.SC3@@ -478,7 +480,6 @@                    Sound.SC3.Server.Command                    Sound.SC3.Server.NRT                    Sound.SC3.Server.Play-                   Sound.SC3.Server.Process                    Sound.SC3.Server.Status                    Sound.SC3.Server.Synthdef                    Sound.SC3.UGen@@ -491,6 +492,7 @@                    Sound.SC3.UGen.Demand                    Sound.SC3.UGen.Demand.Base                    Sound.SC3.UGen.Demand.Monadic+                   Sound.SC3.UGen.DiskIO                    Sound.SC3.UGen.Enum                    Sound.SC3.UGen.Envelope                    Sound.SC3.UGen.Envelope.Construct@@ -513,7 +515,6 @@                    Sound.SC3.UGen.Oscillator                    Sound.SC3.UGen.Panner                    Sound.SC3.UGen.Rate-                   Sound.SC3.UGen.Record.Pitch                    Sound.SC3.UGen.UGen                    Sound.SC3.UGen.UGen.Lift                    Sound.SC3.UGen.UId