Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Windowing functions.
Synopsis
- type Window x = x -> x
- type Table x = [x]
- data TableFormat
- window_table :: (Integral n, Fractional a, Enum a) => TableFormat -> n -> Window a -> Table a
- window_table_closed :: (Integral n, Fractional a, Enum a) => n -> Window a -> Table a
- square :: Num a => a -> a
- gaussian :: Floating a => a -> Window a
- hann :: Floating a => Window a
- hamming :: Floating a => Window a
- rectangular :: Window a
- sine :: Floating a => Window a
- triangular :: Fractional a => Window a
- gaussian_table :: (Integral n, Floating b, Enum b) => n -> b -> [b]
- hamming_table :: Int -> [Double]
- hann_table :: Int -> [Double]
- sine_table :: (Integral n, Floating b, Enum b) => n -> [b]
- triangular_table :: (Integral n, Fractional b, Enum b) => n -> [b]
Type and conversion
data TableFormat Source #
Format for table. Closed indicates the end point should be equal to the start point. Open indicates it should be one place short. Guarded indicates that an extra place should be added that closes the table, ie. the table has one place more than requested. When using a table with an oscillator we want an Open or Guarded table, since the point following the end point is the start point.
Instances
Show TableFormat Source # | |
Defined in Sound.Sc3.Common.Math.Window showsPrec :: Int -> TableFormat -> ShowS # show :: TableFormat -> String # showList :: [TableFormat] -> ShowS # | |
Eq TableFormat Source # | |
Defined in Sound.Sc3.Common.Math.Window (==) :: TableFormat -> TableFormat -> Bool # (/=) :: TableFormat -> TableFormat -> Bool # |
window_table :: (Integral n, Fractional a, Enum a) => TableFormat -> n -> Window a -> Table a Source #
Generate an n element table from a (0, 1) normalised window function f. The cycle argument decides if the end point should be equal to the start point, or one place short. When using a table with an oscillator we want the latter, since the point following the end point is the start point.
window_table_closed :: (Integral n, Fractional a, Enum a) => n -> Window a -> Table a Source #
window_table of TableClosed.
Math
Window functions
rectangular :: Window a Source #
Unit (id
) window, also known as a Dirichlet window.
triangular :: Fractional a => Window a Source #
Triangular window, ie. Bartlett window with zero end-points.
let n = 2 ^ 7 Sound.Sc3.Plot.plot_p1_ln (map (\fmt -> window_table fmt n triangular) [TableClosed, TableOpen]) Sound.Sc3.Plot.plot_p1_ln (map (\fmt -> window_table fmt n triangular) [TableClosed, TableGuarded])
Tables
gaussian_table :: (Integral n, Floating b, Enum b) => n -> b -> [b] Source #
window_table_closed
. gaussian
.
Sound.Sc3.Plot.plot_p1_ln [gaussian_table 1024 0.25, gaussian_table 1024 0.5]
hamming_table :: Int -> [Double] Source #
window_table_closed
. hamming
.
Sound.Sc3.Plot.plot_p1_ln [hann_table 128, hamming_table 128]
hann_table :: Int -> [Double] Source #
Sound.Sc3.Plot.plot_p1_ln [hann_table (2 ^ 7)]
sine_table :: (Integral n, Floating b, Enum b) => n -> [b] Source #
Sound.Sc3.Plot.plot_p1_ln [sine_table (2 ^ 7)]
triangular_table :: (Integral n, Fractional b, Enum b) => n -> [b] Source #
window_table_closed
. triangular
.
Sound.Sc3.Plot.plot_p1_ln [triangular_table (2 ^ 8)]