From c014ba3b94c53ed5b076048ca16064875a1aa524 Mon Sep 17 00:00:00 2001 From: Maxim Lihachev Date: Mon, 24 Oct 2016 14:55:01 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=B8=D0=BF=D1=8B=20=D1=84=D1=83=D0=BD?= =?UTF-8?q?=D0=BA=D1=86=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- audioread.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/audioread.hs b/audioread.hs index 9a4b34d..002ce4a 100644 --- a/audioread.hs +++ b/audioread.hs @@ -1,7 +1,7 @@ {-# LANGUAGE DeriveDataTypeable, RecordWildCards #-} -- Создан: Ср 28 сен 2016 10:18:53 --- Изменен: Чт 20 окт 2016 10:14:42 +-- Изменен: Пн 24 окт 2016 14:53:30 -- Copyright (C) 2011-2013, Maxim Lihachev, @@ -66,19 +66,19 @@ notZero x = (not $ isNaN x) && (x /= 0) -- ============================================================================= -- Чтение данных аудиофайла --- audioread :: WAVE -> [[Double]] +audioread :: WAVE -> [[Double]] audioread = map samplesToDouble . waveSamples where samplesToDouble (l:r:[]) = [sampleToDouble l, sampleToDouble r] --Выбор канала из пары --- getChannel :: [Char] -> [[Double]] -> [Double] +getChannel :: [Char] -> [[Double]] -> [Double] getChannel ch = map selectChannel where selectChannel (l:r:[]) | ch == "R" = r | ch == "L" = l | otherwise = l -- k десятичных логарифмов --- float2db :: (RealFloat a, Integral b) => b -> a -> a +float2db :: (RealFloat a, Integral b) => b -> a -> a float2db k x | notZero x = fromIntegral k * (logBase 10 x) | otherwise = 0