-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Play, write, read, convert audio signals using Sox -- -- This is a wrapper to Sox the Sound Exchanger -- http://sox.sourceforge.net/ which lets you play, write, read -- and convert audio signals in various formats, resolutions, and numbers -- of channels. -- -- The functions call sox commands via the shell, that is, the sox -- and play executables must be installed and in the path to the -- executables must be set. -- -- In the past this was part of the synthesizer package. @package sox @version 0.2.3 -- | We just re-export the type from sample-frame:Sound.Frame.Stereo. module Sound.Sox.Frame.Stereo data T a :: * -> * left :: () => T a -> a right :: () => T a -> a cons :: () => a -> a -> T a -- | This module calls the soxi command which is available since -- sox version 14. -- -- We have to call soxi for every option. However we hide this -- in our interface, such that we could do more efficiently, if -- soxi supports multiple outputs in future. module Sound.Sox.Information newtype T a Cons :: (ReaderT FilePath IO a) -> T a simple :: Read a => (String -> Maybe a) -> String -> T a format :: T String sampleRate :: T Int numberOfChannels :: T Int length :: T Int bitsPerSample :: T Int get :: T a -> FilePath -> IO a exampleMulti :: IO (String, Int, Int) exampleSingle :: IO Int instance GHC.Base.Functor Sound.Sox.Information.T instance GHC.Base.Applicative Sound.Sox.Information.T module Sound.Sox.Format custom :: String -> T aiff :: T wave :: T ogg :: T mp3 :: T iff8svx :: T muLaw :: T signedByte :: T unsignedByte :: T signedWord :: T unsignedWord :: T signedLong :: T unsignedLong :: T ieeeSinglePrecision :: T ieeeDoublePrecision :: T data T module Sound.Sox.Frame class C y => C y format :: C y => y -> T withSignal :: () => (y -> a) -> sig y -> a -- | The argument is not touched and can be undefined numberOfChannels :: C y => y -> Int instance Sound.Sox.Frame.C GHC.Word.Word8 instance Sound.Sox.Frame.C GHC.Int.Int8 instance Sound.Sox.Frame.C GHC.Word.Word16 instance Sound.Sox.Frame.C GHC.Int.Int16 instance Sound.Sox.Frame.C GHC.Word.Word32 instance Sound.Sox.Frame.C GHC.Int.Int32 instance Sound.Sox.Frame.C GHC.Types.Float instance Sound.Sox.Frame.C GHC.Types.Double instance Sound.Sox.Frame.C Sound.Frame.MuLaw.T instance Sound.Sox.Frame.C a => Sound.Sox.Frame.C (Sound.Frame.Stereo.T a) module Sound.Sox.Option.Format none :: T numberOfChannels :: Int -> T numberOfChannelsAuto :: Int -> T sampleRate :: Int -> T bitsPerSample :: Int -> T format :: T -> T -- | You can combine options using the Monoid functions -- mappend and mconcat. When the same option is given -- multiple times, only the first occurence is respected. data T single :: String -> [String] -> T module Sound.Sox.Convert -- |
--   :load Sound.Sox.Convert
--   
--   simple Option.none "test.aiff" Option.none "test.wav"
--   
simple :: T -> FilePath -> T -> FilePath -> IO ExitCode module Sound.Sox.Read data Handle signal -- | Unfortunately we cannot retrieve the sample rate using sox. -- However there is soxi for this purpose, which we may support -- in future. -- --
--   :load Sound.Sox.Read Sound.Sox.Signal.List
--   :module + Control.Exception
--   bracket (open Option.none "test.aiff") close $ \h -> withHandle2 Sound.Sox.Signal.List.getContents h >>= \x -> print (Control.Monad.Exception.Asynchronous.result x :: [Data.Int.Int16])
--   
open :: (C y) => T -> FilePath -> IO (Handle (sig y)) close :: Handle signal -> IO ExitCode withHandle1 :: (Handle -> m signal) -> (Handle signal -> m signal) withHandle2 :: (Handle -> m (f signal)) -> (Handle signal -> m (f signal)) -- | Functions for reading and writing data using the endianess of the -- machine. This is the way Sox handles raw data. This module is more or -- less provided for completeness, since it is based on lists, which -- means that it is too slow to process real world data. For serious -- applications use Data.StorableVector.Lazy. module Sound.Sox.Signal.List writeFile :: Storable a => FilePath -> [a] -> IO () put :: Storable a => Handle -> [a] -> IO () withReadFile :: Storable a => FilePath -> (Exceptional IOReadException [a] -> IO b) -> IO b getContents :: Storable a => Handle -> IO (Exceptional IOReadException [a]) data ReadException type IOReadException = Either ReadException SomeException instance GHC.Enum.Enum Sound.Sox.Signal.List.ReadException instance GHC.Classes.Eq Sound.Sox.Signal.List.ReadException instance GHC.Show.Show Sound.Sox.Signal.List.ReadException module Sound.Sox.Play -- |
--   :load Sound.Sox.Play Sound.Sox.Signal.List
--   
--   simple Sound.Sox.Signal.List.put Option.none 11025 (iterate (1000+) (0::Data.Int.Int16))
--   
simple :: (C y) => (Handle -> sig y -> IO ()) -> T -> Int -> sig y -> IO ExitCode extended :: (C y) => (Handle -> sig y -> IO ()) -> T -> T -> Int -> sig y -> IO ExitCode module Sound.Sox.Write -- | Sox determines the output format from the filename extension or from -- format. Make sure that you provide one of them. -- --
--   :load Sound.Sox.Write Sound.Sox.Signal.List
--   
--   simple Sound.Sox.Signal.List.put Option.none "test.aiff" 11025 (take 100 $ iterate (1000+) (0::Data.Int.Int16))
--   
simple :: (C y) => (Handle -> sig y -> IO ()) -> T -> FilePath -> Int -> sig y -> IO ExitCode extended :: (C y) => (Handle -> sig y -> IO ()) -> T -> T -> FilePath -> Int -> sig y -> IO ExitCode -- | The traversable functor f might be Maybe or '[]'. It -- allows you to write to many files simultaneously and returns the exit -- codes of all writing processes. manyExtended :: (C y, Traversable f) => (f Handle -> sig y -> IO ()) -> T -> T -> f FilePath -> Int -> sig y -> IO (f ExitCode)