Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Sound file functions.
Synopsis
- findFileFromDirectory :: String -> String -> IO (Maybe String)
- findFileAtOrFromDirectory :: String -> String -> IO (Maybe String)
- findFileAtOrFromPath :: [FilePath] -> FilePath -> IO (Maybe FilePath)
- sfDir :: IO FilePath
- sfPath :: IO FilePath
- sfFindFile :: FilePath -> IO (Maybe FilePath)
- sfResolveFile :: FilePath -> IO FilePath
- sfResolve :: FilePath -> FilePath
- sfNumChannels :: FilePath -> IO Int
- sfSampleRate :: FilePath -> IO Int
- sfFrameCount :: FilePath -> IO Int
- sfMetadata :: FilePath -> IO (Int, Int, Int)
- sfInfo :: FilePath -> (Int, Int, Int)
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"
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"]
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