packages feed

hmeap 0.14 → 0.15

raw patch · 4 files changed

+32/−12 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Sound.Analysis.Meapsoft: from_onsets :: Meap_Data t => [(t, t)] -> MEAP t

Files

Sound/Analysis/Meapsoft.hs view
@@ -11,10 +11,12 @@     , position     , segments_l     , feature_names+    , from_onsets     , module Sound.Analysis.Meapsoft.Data     , module Sound.Analysis.Meapsoft.Header ) where -import Data.Array.Unboxed+import Data.Array.Unboxed {- array -}+ import Sound.Analysis.Meapsoft.Data import Sound.Analysis.Meapsoft.Header @@ -32,7 +34,8 @@ -- | Load a MEAPsoft analysis file, either a segmentation file or a --   feature file. ----- > Right m <- read_meap "/home/rohan/data/audio/jonchaies.wav.seg"+-- > let fn = "/home/rohan/data/audio/xenakis/jonchaies.wav.seg"+-- > Right m <- read_meap fn :: IO (Either String (MEAP Double)) -- > map feature_name (features m) == ["onset_time","chunk_length"] read_meap :: Meap_Data t => FilePath -> IO (Either String (MEAP t)) read_meap fn = do@@ -112,3 +115,15 @@     ,"Entropy"     ,"RMSAmplitude"     ,"SpectralStability"]++-- * Interop++-- | Given a list of @(onset-time,duration)@ pairs generate a @MEAP@.+from_onsets :: Meap_Data t => [(t,t)] -> MEAP t+from_onsets t =+    let f = [Feature "onset_time" 0 1+            ,Feature "chunk_length" 1 1]+        n = length t+        t' = concatMap (\(p,q) -> [p,q]) t+        d = meap_data_uarray 2 n t'+    in MEAP f n d
Sound/Analysis/Meapsoft/Data.hs view
@@ -8,6 +8,7 @@ import qualified Data.ByteString.Lex.Double as P {- bytestring-lexing -} import qualified Text.Delimited as D {- delimited-text -} +-- | Read positive and negative @Infinity@, error if string is malformed. read_inf :: Fractional n => String -> n read_inf s =     case s of@@ -15,6 +16,7 @@       "-Infinity" -> -1/0       _ -> error ("read_inf: could not read " ++ show s) +-- | 'ByteString' to 'Fractional' via 'realToFrac' and 'read_inf'. to_f :: Fractional n => B.ByteString -> n to_f s = maybe (read_inf (C.unpack s)) (realToFrac . fst) (P.readDouble s) @@ -29,6 +31,7 @@       ds = map to_f (concat xs')   return (nr,ds) +-- | Class to form 'UArray' given interleaved input data. class Floating a => Meap_Data a where     meap_data_uarray :: Int -> Int -> [a] -> UArray (Int,Int) a     meap_data_index :: UArray (Int,Int) a -> (Int,Int) -> a
Sound/Analysis/Meapsoft/Header.hs view
@@ -6,10 +6,10 @@                                       , has_feature                                       ) where -import Control.Monad-import Data.List-import Data.Maybe-import System.IO+import Control.Monad {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}+import System.IO {- base -} import Text.ParserCombinators.Parsec {- parsec -}  -- | Data type representing a MEAPsoft analysis feature.  The@@ -90,8 +90,10 @@  -- Delete 'filename', which is a string. normalize_header :: Header -> Header-normalize_header (("filename",1):xs) = xs-normalize_header xs = xs+normalize_header h =+    case h of+      ("filename",1):h' -> h'+      _ -> h  mk_features :: Header -> [Feature] mk_features h =
hmeap.cabal view
@@ -1,16 +1,16 @@ Name:              hmeap-Version:           0.14+Version:           0.15 Synopsis:          Haskell Meapsoft Parser Description:       Parser for the analysis files produced by the                    Meapsoft feature extractor. License:           GPL Category:          Sound-Copyright:         Rohan Drape and others, 2007-2013+Copyright:         Rohan Drape and others, 2007-2014 Author:            Rohan Drape Maintainer:        rd@slavepianos.org Stability:         Experimental-Homepage:          http://rd.slavepianos.org/?t=hmeap-Tested-With:       GHC == 7.6.1+Homepage:          http://rd.slavepianos.org/t/hmeap+Tested-With:       GHC == 7.8.2 Build-Type:        Simple Cabal-Version:     >= 1.8