5 import Codec.Audio.WavPack.Block
6 import Codec.Audio.WavPack.Metadata
7 import qualified Data.ByteString.Lazy as L
10 import System.Environment
14 main = do [wvFile] ← getArgs
15 wvData ← L.readFile wvFile
16 hSetBuffering stdout NoBuffering
17 mapM_ printBlock $ readBlocks wvData
18 putStrLn "* End of WavPack blocks"
20 printBlock ∷ Block → IO ()
22 = do putStrLn "* WavPack Block"
23 putStrLn "- Block header:"
25 putStrLn "- Block metadata sub-blocks:"
26 mapM_ printSub $ blockMetadata b
28 printSub ∷ SubBlock → IO ()
30 | isJust (fromSubBlock sub ∷ Maybe WVBitstream)
31 = putStrLn ( "(WV Bitstream omitted: " ⧺
41 When compiled with -O0:
42 % time ./dist/build/hs-wvinfo/hs-wvinfo 01.wv > /dev/null
43 1.49s user 2.12s system 98% cpu 3.664 total
45 When compiled with -O2:
46 % time ./dist/build/hs-wvinfo/hs-wvinfo 01.wv > /dev/null
47 1.35s user 2.09s system 97% cpu 3.520 total
49 Hmm... quite disappointing... The stringification is the
50 bottleneck? If so, I can live with that.