Browse Source

Типы функций

master
Maxim Lihachev 9 years ago
parent
commit
c014ba3b94
  1. 8
      audioread.hs

8
audioread.hs

@ -1,7 +1,7 @@ @@ -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, <envrm@yandex.ru>
@ -66,19 +66,19 @@ notZero x = (not $ isNaN x) && (x /= 0) @@ -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

Loading…
Cancel
Save