An utiliy for displaying information about wav-files.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
-- Создан: Ср 28 сен 2016 10:18:53
|
|
|
|
-- Изменен: Чт 29 сен 2016 11:18:07
|
|
|
|
|
|
|
|
import System.Environment
|
|
|
|
import Data.WAVE
|
|
|
|
-- import Data.List
|
|
|
|
|
|
|
|
--Выбор канала из пары
|
|
|
|
chL :: [a] -> a
|
|
|
|
chL pair = pair!!0
|
|
|
|
|
|
|
|
chR :: [a] -> a
|
|
|
|
chR pair = pair!!1
|
|
|
|
|
|
|
|
audioread :: String -> String -> [Char] -> IO ()
|
|
|
|
audioread samples file ch = do
|
|
|
|
w <- getWAVEFile file
|
|
|
|
mapM_ print (map (sampleToDouble . channel) (take (read samples::Int) $ waveSamples w)) where
|
|
|
|
channel (xs)
|
|
|
|
| ch == ['R'] = chR xs
|
|
|
|
| ch == ['L'] = chL xs
|
|
|
|
| otherwise = chL xs
|
|
|
|
|
|
|
|
main :: IO ()
|
|
|
|
main = do
|
|
|
|
cmd <- getArgs
|
|
|
|
case cmd of
|
|
|
|
[samples, file, ch] -> audioread samples file ch
|
|
|
|
[samples, file] -> audioread samples file ['L']
|
|
|
|
_ -> putStrLn "Usage: audioread [samples] [file.wav] [L/R]"
|
|
|
|
|