hmeap 0.11 → 0.12
raw patch · 3 files changed
+23/−21 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Sound/Analysis/Meapsoft/Data.hs +10/−9
- Sound/Analysis/Meapsoft/Header.hs +7/−6
- hmeap.cabal +6/−6
Sound/Analysis/Meapsoft/Data.hs view
@@ -2,20 +2,21 @@ module Sound.Analysis.Meapsoft.Data ( read_data ) where import Data.Array.Unboxed-import qualified Data.ByteString as B-import Data.ByteString.Char8 (unpack)+import qualified Data.ByteString as B {- bytestring -}+import qualified Data.ByteString.Char8 as C import qualified Data.ByteString.Lazy as L-import qualified Data.ByteString.Lex.Double as B-import qualified Text.Delimited as D+import qualified Data.ByteString.Lex.Double as P {- bytestring-lexing -}+import qualified Text.Delimited as D {- delimited-text -} read_inf :: String -> Double-read_inf s = case s of- "Infinity" -> 1/0- "-Infinity" -> -1/0- _ -> error ("Could not read " ++ show s)+read_inf s =+ case s of+ "Infinity" -> 1/0+ "-Infinity" -> -1/0+ _ -> error ("read_inf: could not read " ++ show s) to_f :: B.ByteString -> Double-to_f s = maybe (read_inf (unpack s)) fst (B.readDouble s)+to_f s = maybe (read_inf (C.unpack s)) fst (P.readDouble s) -- | Given the number of columns, reads an entire MEAPsoft data set -- into an 'UArray' and returns the data paired with the number of
Sound/Analysis/Meapsoft/Header.hs view
@@ -8,8 +8,9 @@ import Control.Monad import Data.List+import Data.Maybe import System.IO-import Text.ParserCombinators.Parsec+import Text.ParserCombinators.Parsec {- parsec -} -- | Data type representing a MEAPsoft analysis feature. The -- 'feature_column' is the integer column index for the feature in@@ -38,11 +39,11 @@ -- is not located. All analysis files have the features onset_time -- and chunk_length. required_feature :: String -> [Feature] -> Feature-required_feature n fs = maybe (error n) id (find_feature n fs)+required_feature n fs = fromMaybe (error n) (find_feature n fs) -- | True iff the analysis data contains the named feature. has_feature :: String -> [Feature] -> Bool-has_feature n fs = maybe False (const True) (find_feature n fs)+has_feature n = isJust . find_feature n -- Parsec parser for header string. @@ -68,7 +69,7 @@ feature = do { f <- word ; n <- optionMaybe (try (in_paren int))- ; return (f, maybe 1 id n) }+ ; return (f, fromMaybe 1 n) } type Header = [(String, Int)] @@ -85,7 +86,7 @@ read_header_string fn = withFile fn ReadMode hGetLine parse_header :: String -> String -> Either ParseError Header-parse_header fn s = parse header fn s+parse_header = parse header -- Delete 'filename', which is a string. normalize_header :: Header -> Header@@ -94,5 +95,5 @@ mk_features :: Header -> [Feature] mk_features h =- let acc i (f, n) = (i+n, (Feature f i n))+ let acc i (f, n) = (i+n,Feature f i n) in snd (mapAccumL acc 0 h)
hmeap.cabal view
@@ -1,16 +1,16 @@ Name: hmeap-Version: 0.11+Version: 0.12 Synopsis: Haskell Meapsoft Parser-Description: Parser for the anaylsis files produced by the+Description: Parser for the analysis files produced by the Meapsoft feature extractor. License: GPL Category: Sound-Copyright: Rohan Drape and others, 2007-2011+Copyright: Rohan Drape and others, 2007-2012 Author: Rohan Drape Maintainer: rd@slavepianos.org Stability: Experimental-Homepage: http://slavepianos.org/rd/?t=hmeap-Tested-With: GHC == 7.2.2+Homepage: http://rd.slavepianos.org/?t=hmeap+Tested-With: GHC == 7.6.1 Build-Type: Simple Cabal-Version: >= 1.8 @@ -29,7 +29,7 @@ Source-Repository head Type: darcs- Location: http://slavepianos.org/rd/sw/hmeap+ Location: http://rd.slavepianos.org/sw/hmeap -- Local Variables: -- truncate-lines:t