4 changed files with 167 additions and 195 deletions
@ -1,31 +0,0 @@ |
|||||||
-- Создан: Ср 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]" |
|
||||||
|
|
Loading…
Reference in new issue