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