hsc3-sf-hsndfile-0.12: Help/stat.help.hs
-- Trivial sound file statistics.
import qualified Sound.File.HSndFile 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
print (("nframes",nf)
,("srate",sr)
,("nchan",nc)
,("minima",map minimum d)
,("maxima",map maximum d))
main :: IO ()
main = do
a <- getArgs
case a of
[fn] -> stat fn
_ -> putStrLn "stat file-name"
{-
stat "/home/rohan/data/audio/pf-c5.aif"
-}