hsc3-0.20: Haskell SuperCollider
Safe HaskellSafe-Inferred
LanguageHaskell2010

Sound.Sc3.Common.SoundFile

Description

Sound file functions.

Synopsis

Documentation

findFileFromDirectory :: String -> String -> IO (Maybe String) Source #

Find the file fn (case-sensitively) starting from dir. Runs the system command "find" (so UNIX only). Note that fn must be a file name not a relative path name.

findFileFromDirectory "/home/rohan/data/audio" "metal.wav"

findFileAtOrFromDirectory :: String -> String -> IO (Maybe String) Source #

Find the file fn starting from dir. If dir/fn names a file return that file, else call findFileFromDirectory. Note this will not find dirpqr given qr, the query must be either pqr or r.

findFileAtOrFromDirectory "/home/rohan/data/audio" "instr/bosendorfer/072/C5.aif"

findFileAtOrFromPath :: [FilePath] -> FilePath -> IO (Maybe FilePath) Source #

Run findFileAtOrFromDirectory for each entry in path until the file is found, or not.

findFileAtOrFromPath ["/home/rohan/rd/data/"] "20.2-LW+RD.flac"

sfDir :: IO FilePath Source #

SFDIR environment variable.

sfPath :: IO FilePath Source #

SFPATH environment variable.

sfFindFile :: FilePath -> IO (Maybe FilePath) Source #

Find file fn at sfDir directly or along sfPath. If fn is either absolute or names a relative file and if that file exists it is returned. If sdDir/fn exists it is returned. Else each directory at sfPath is searched (recursively) in turn. Despite the name this will find any file type along the SFDIR and SFPATH, i.e. .sfz files &etc.

mapM sfFindFile ["/home/rohan/data/audio/metal.wav", "pf-c5.aif", "20.2-LW+RD.flac"]

sfResolveFile :: FilePath -> IO FilePath Source #

sfFindFile or error.

sfResolve :: FilePath -> FilePath Source #

Unsafe sfResolveFile. For resolving sound file names at read only sound file archives this is quite safe.

sfNumChannels :: FilePath -> IO Int Source #

Return the number of channels at fn. Runs the system command "soxi" (so UNIX only).

sfResolveFile "metal.wav" >>= sfNumChannels >>= print

sfSampleRate :: FilePath -> IO Int Source #

Return the sample rate of fn. Runs the system command "soxi" (so UNIX only).

sfResolveFile "metal.wav" >>= sfSampleRate >>= print

sfFrameCount :: FilePath -> IO Int Source #

Return the number of frames at fn. Runs the system command "soxi" (so UNIX only).

sfResolveFile "metal.wav" >>= sfFrameCount >>= print

sfMetadata :: FilePath -> IO (Int, Int, Int) Source #

Return the number of channels, sample-rate and number of frames at fn. Runs the system command "soxi" (so UNIX only).

sfResolveFile "metal.wav" >>= sfMetadata >>= print

sfInfo :: FilePath -> (Int, Int, Int) Source #

Unsafe sfMetadata. For fetching sound file information from read only sound file archives this is quite safe.

sfInfo (sfResolve "metal.wav") == (1,44100,1029664)
sfInfo (sfResolve "pf-c5.aif") == (2,44100,576377)