Browse Source

Renamed to wave-info

master
Maxim Likhachev 6 years ago
parent
commit
b1756b3f3f
  1. 6
      README.md
  2. 19
      wave-info.hs

6
README.md

@ -1,7 +1,7 @@
**audioread** - информация о wav-файлах **wave-info** - информация о wav-файлах
##Лицензия ##Лицензия
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 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 it under the terms of the GNU General Public License as published by
@ -21,7 +21,7 @@
значения отсчётов, уровень сигнала в формате dB и LUFS, значение фазы значения отсчётов, уровень сигнала в формате dB и LUFS, значение фазы
##Использование ##Использование
audioread [OPTIONS] wave-info [OPTIONS]
Common flags: Common flags:
-i --info=samples,phase,db,lufs Type of information -i --info=samples,phase,db,lufs Type of information

19
audioread.hs → wave-info.hs

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