|
|
|
@ -1,9 +1,6 @@
@@ -1,9 +1,6 @@
|
|
|
|
|
{-# LANGUAGE DeriveDataTypeable, RecordWildCards #-} |
|
|
|
|
|
|
|
|
|
-- Создан: Ср 28 сен 2016 10:18:53 |
|
|
|
|
-- Изменен: Чт 10 ноя 2016 18:00:29 |
|
|
|
|
|
|
|
|
|
-- Copyright (C) 2011-2013, Maxim Lihachev, <envrm@yandex.ru> |
|
|
|
|
-- Copyright (C) 2011-2019, Maxim Lihachev, <envrm@yandex.ru> |
|
|
|
|
|
|
|
|
|
-- This program is free software: you can redistribute it and/or modify |
|
|
|
|
-- it under the terms of the GNU General Public License as published by |
|
|
|
@ -62,8 +59,8 @@ notZero x = not (isNaN x || x == 0)
@@ -62,8 +59,8 @@ notZero x = not (isNaN x || x == 0)
|
|
|
|
|
-- ============================================================================= |
|
|
|
|
|
|
|
|
|
-- Чтение данных аудиофайла |
|
|
|
|
audioread :: WAVE -> [[Double]] |
|
|
|
|
audioread = map samplesToDouble . waveSamples |
|
|
|
|
waveinfo :: WAVE -> [[Double]] |
|
|
|
|
waveinfo = map samplesToDouble . waveSamples |
|
|
|
|
where samplesToDouble (l:r:[]) = [sampleToDouble l, sampleToDouble r] |
|
|
|
|
|
|
|
|
|
--Выбор канала из пары |
|
|
|
@ -126,7 +123,7 @@ calcPhase samples
@@ -126,7 +123,7 @@ calcPhase samples
|
|
|
|
|
-- ============================================================================= |
|
|
|
|
|
|
|
|
|
-- Параметры |
|
|
|
|
data Audioread = Audioread { |
|
|
|
|
data WaveInfo = WaveInfo { |
|
|
|
|
info :: String, |
|
|
|
|
samples :: Int, |
|
|
|
|
channel :: String, |
|
|
|
@ -136,15 +133,15 @@ data Audioread = Audioread {
@@ -136,15 +133,15 @@ data Audioread = Audioread {
|
|
|
|
|
} deriving (Show, Data,Typeable) |
|
|
|
|
|
|
|
|
|
-- Стандартные значения и описания параметров |
|
|
|
|
defaultOptions :: IO Audioread |
|
|
|
|
defaultOptions = cmdArgs $ Audioread { |
|
|
|
|
defaultOptions :: IO WaveInfo |
|
|
|
|
defaultOptions = cmdArgs $ WaveInfo { |
|
|
|
|
file = "none" &= typ "FILE.WAV" &= help "File for analysis", |
|
|
|
|
info = "none" &= typ "samples,phase,db,lufs" &= help "Type of information", |
|
|
|
|
samples = 1200 &= typ "12000" &= help "Number of samples for analysis", |
|
|
|
|
channel = "L" &= typ "L/R" &= help "Channel from stereo stream", |
|
|
|
|
title = 0 &= typ "1/0" &= help "File for analysis", |
|
|
|
|
vu = "db" &= typ "db/lufs" &= help "Type of vu scale" |
|
|
|
|
} &= summary "audioread v0.3: information about audiofiles" |
|
|
|
|
} &= summary "wave-info v0.3: information about audiofiles" |
|
|
|
|
|
|
|
|
|
-- Вывод строки с префиксом и суффиксом |
|
|
|
|
describe :: (Show s) => Int -> String -> s -> String -> IO () |
|
|
|
@ -163,7 +160,7 @@ main = do
@@ -163,7 +160,7 @@ main = do
|
|
|
|
|
exitFailure |
|
|
|
|
|
|
|
|
|
d <- getWAVEFile $ file cmd |
|
|
|
|
let w = samples cmd ## audioread d |
|
|
|
|
let w = samples cmd ## waveinfo d |
|
|
|
|
|
|
|
|
|
let exec fx = do |
|
|
|
|
describe (title cmd) ("\n---[ " ++ fx) "" (" ]:") |