hsc3-sf-0.8: Help/stat.help.hs
-- Trivial sound file statistics.
import qualified Sound.File.NeXT as F
import System.Environment
stat ::FilePath -> IO ()
stat fn = do
(hdr, d) <- F.read fn
let nf = F.frameCount hdr
sr = F.sampleRate hdr
nc = F.channelCount hdr
mapM_ print [("nframes", [fromIntegral nf])
,("srate", [fromIntegral sr])
,("nchan", [fromIntegral nc])
,("minimum", map minimum d)
,("maximum", map maximum d)]
main :: IO ()
main = do
a <- getArgs
case a of
[fn] -> stat fn
_ -> putStrLn "stat file-name"
{-
stat "/home/rohan/audio/text.snd"
-}