hsc3-sf 0.11 → 0.12
raw patch · 6 files changed
+54/−42 lines, 6 filesdep ~hoscPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: hosc
API changes (from Hackage documentation)
Files
- Help/rescale.help.hs +1/−2
- Help/stat.help.hs +6/−7
- README +15/−9
- Sound/File/Decode.hs +10/−6
- Sound/File/NeXT.hs +16/−12
- hsc3-sf.cabal +6/−6
Help/rescale.help.hs view
@@ -1,5 +1,4 @@ -- Change the gain of an audio file.- import qualified Sound.File.NeXT as F import System.Environment @@ -18,5 +17,5 @@ _ -> putStrLn "rescale gain-multiplier file-name" {--rescale 0.25 "/home/rohan/audio/text.snd"+rescale 0.25 "/home/rohan/data/audio/pf-c5.snd" -}
Help/stat.help.hs view
@@ -1,5 +1,4 @@ -- Trivial sound file statistics.- import qualified Sound.File.NeXT as F import System.Environment @@ -9,11 +8,11 @@ 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)]+ print (("nframes",nf)+ ,("srate",sr)+ ,("nchan",nc)+ ,("minima",map minimum d)+ ,("maxima",map maximum d)) main :: IO () main = do@@ -23,5 +22,5 @@ _ -> putStrLn "stat file-name" {--stat "/home/rohan/audio/text.snd"+stat "/home/rohan/data/audio/pf-c5.snd" -}
README view
@@ -1,12 +1,18 @@-hsc3-sf - simple sound file input/output+hsc3-sf+------- -hsc3-sf provides Sound.File.NeXT, a Haskell module that -provides simple minded sound file input/output for -NeXT/Sun format sound files. For more comprehensive-sound file support in haskell see hsndfile.+simple sound file input/output - http://slavepianos.org/rd- http://code.haskell.org/hsndfile+[hsc3-sf][hsc3-sf] provides `Sound.File.NeXT`, a [Haskell][hs] module+that provides simple minded sound file input/output for NeXT/Sun+format sound files. For more comprehensive sound file support in+haskell see [hsndfile][hsf]. -(c) rohan drape, 2006-2011- gpl, http://gnu.org/copyleft/+[hs]: http://haskell.org/+[hsc3-sf]: http://rd.slavepianos.org/?t=hsc3-sf+[hsf]: http://code.haskell.org/hsndfile++© [rohan drape][rd], 2006-2012, [gpl]++[rd]: http://rd.slavepianos.org/+[gpl]: http://gnu.org/copyleft/
Sound/File/Decode.hs view
@@ -7,11 +7,13 @@ import Sound.OpenSoundControl.Coding.Byte import Sound.File.Encoding +-- > setsOf 2 [0..5] == [[0,1],[2,3],[4,5]] setsOf :: Int -> [a] -> [[a]]-setsOf _ [] = [] setsOf n l =- let (x, y) = splitAt n l- in x : setsOf n y+ case l of+ [] -> []+ _ -> let (x, y) = splitAt n l+ in x : setsOf n y channel :: [[a]] -> Int -> [a] channel l n = map (!!n) l@@ -24,9 +26,11 @@ bSetsOf :: Int64 -> B.ByteString -> [B.ByteString] bSetsOf _ b | B.null b = []-bSetsOf n b | otherwise =- let (x, y) = B.splitAt n b- in x : bSetsOf n y+bSetsOf n b =+ if B.null b+ then []+ else let (x, y) = B.splitAt n b+ in x : bSetsOf n y decodef32 :: Int -> B.ByteString -> [[Double]] decodef32 n = deinterleave n . map decode_f32 . bSetsOf 4
Sound/File/NeXT.hs view
@@ -33,19 +33,23 @@ deriving (Eq, Show) toEncoding :: Int -> Encoding-toEncoding 2 = Linear8-toEncoding 3 = Linear16-toEncoding 5 = Linear32-toEncoding 6 = Float-toEncoding 7 = Double-toEncoding _ = undefined+toEncoding n =+ case n of+ 2 -> Linear8+ 3 -> Linear16+ 5 -> Linear32+ 6 -> Float+ 7 -> Double+ _ -> undefined fromEncoding :: Encoding -> Int-fromEncoding Linear8 = 2-fromEncoding Linear16 = 3-fromEncoding Linear32 = 5-fromEncoding Float = 6-fromEncoding Double = 7+fromEncoding c =+ case c of+ Linear8 -> 2+ Linear16 -> 3+ Linear32 -> 5+ Float -> 6+ Double -> 7 -- | The NeXT header magic number. magic :: Int@@ -55,7 +59,7 @@ encodeHeader :: Header -> B.ByteString encodeHeader (Header nf enc sr nc) = let nb = nf * nc * sizeOf enc- h = [magic, 28, nb, (fromEncoding enc), sr, nc, 0]+ h = [magic, 28, nb, fromEncoding enc, sr, nc, 0] in B.concat (map encode_i32 h) -- | Byte-decode a NeXT header.
hsc3-sf.cabal view
@@ -1,5 +1,5 @@ Name: hsc3-sf-Version: 0.11+Version: 0.12 Synopsis: Haskell SuperCollider SoundFile Description: Trivial @NeXT@ sound file input and output. The main module is "Sound.File.NeXT".@@ -8,12 +8,12 @@ <http://hackage.haskell.org/package/hsndfile>. License: GPL Category: Sound-Copyright: (c) Rohan Drape, 2006-2011+Copyright: (c) Rohan Drape, 2006-2012 Author: Rohan Drape Maintainer: rd@slavepianos.org Stability: Experimental-Homepage: http://slavepianos.org/rd/?t=hsc3-sf-Tested-With: GHC == 7.2.2+Homepage: http://rd.slavepianos.org/?t=hsc3-sf+Tested-With: GHC == 7.6.1 Build-Type: Simple Cabal-Version: >= 1.8 @@ -24,7 +24,7 @@ Library Build-Depends: base == 4.*, bytestring,- hosc == 0.11.*+ hosc == 0.12.* GHC-Options: -Wall -fwarn-tabs Exposed-modules: Sound.File.NeXT Sound.File.Decode@@ -33,4 +33,4 @@ Source-Repository head Type: darcs- Location: http://slavepianos.org/rd/sw/hsc3-sf/+ Location: http://rd.slavepianos.org/sw/hsc3-sf/