window

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Blackman8 = []float64{
		-1.3877787807814457e-17, 0.09045342435412804, 0.45918295754596355, 0.9203636180999081, 0.9203636180999083,
		0.45918295754596383, 0.09045342435412812, -1.3877787807814457e-17,
	}

	Blackman16 = []float64{
		-1.3877787807814457e-17, 0.016757719687408218, 0.07707241975915854, 0.20077014326253045, 0.3940124235751222,
		0.6299999999999999, 0.8492298567374694, 0.9821574369783108, 0.9821574369783108, 0.8492298567374694,
		0.6300000000000002, 0.39401242357512267, 0.20077014326253056, 0.07707241975915853, 0.016757719687408218,
		-1.3877787807814457e-17,
	}

	Blackman32 = []float64{
		-1.3877787807814457e-17, 0.0037516543033711963, 0.015638447715939613, 0.03740269962394746, 0.07146460695505966,
		0.12028646271190799, 0.18564672376216657, 0.26795497073570773, 0.3657350385480047, 0.47537853683779363,
		0.5912285971750041, 0.7060007886931334, 0.8114932835467615, 0.899490428898448, 0.9627307034966064,
		0.995797056996147, 0.9957970569961472, 0.9627307034966064, 0.8994904288984481, 0.8114932835467618,
		0.7060007886931338, 0.5912285971750041, 0.47537853683779413, 0.36573503854800515, 0.26795497073570773,
		0.18564672376216657, 0.12028646271190804, 0.07146460695505974, 0.03740269962394744, 0.01563844771593964,
		0.003751654303371238, -1.3877787807814457e-17,
	}

	Blackman64 = []float64{
		-1.3877787807814457e-17, 0.0008984113451827869, 0.0036318530253606762, 0.008312699052209244, 0.015120839511682,
		0.024292914424146474, 0.03610789479131413, 0.050869632653865356, 0.06888713561791772, 0.09045342435412804,
		0.1158238998166713, 0.1451951775446353, 0.17868533807041637, 0.21631649539792497, 0.2580005015036621,
		0.30352848710877756, 0.35256479217152265, 0.4046456694254163, 0.45918295754596355, 0.5154727245480084,
		0.572708684557557, 0.6300000000000001, 0.68639290409726, 0.7408954224266308, 0.7925043434018272, 0.8402334910629017,
		0.8831422934043309, 0.9203636180999081, 0.9511298658424724, 0.9747963689841572, 0.9908612375754555,
		0.9989809226386932, 0.9989809226386933, 0.9908612375754556, 0.9747963689841573, 0.9511298658424724,
		0.9203636180999083, 0.883142293404331, 0.8402334910629018, 0.7925043434018273, 0.7408954224266311,
		0.6863929040972606, 0.6299999999999998, 0.5727086845575571, 0.5154727245480086, 0.45918295754596383,
		0.4046456694254167, 0.35256479217152276, 0.30352848710877756, 0.25800050150366227, 0.21631649539792497,
		0.17868533807041653, 0.14519517754463532, 0.11582389981667127, 0.09045342435412812, 0.0688871356179177,
		0.05086963265386541, 0.03610789479131424, 0.024292914424146515, 0.015120839511681992, 0.008312699052209244,
		0.0036318530253606762, 0.0008984113451828285, -1.3877787807814457e-17,
	}
	Blackman128 = []float64{}/* 128 elements not displayed */

	Blackman256 = []float64{}/* 256 elements not displayed */

	Blackman512 = []float64{}/* 512 elements not displayed */

	Blackman1024 = []float64{}/* 1024 elements not displayed */

	Blackman2048 = []float64{}/* 2048 elements not displayed */

	Blackman4096 = []float64{}/* 4096 elements not displayed */

	Blackman8192 = []float64{}/* 8192 elements not displayed */

)
View Source
var (
	Hamming8 = []float64{
		0.08000000000000002, 0.25319469114498255, 0.6423596296199047, 0.9544456792351128, 0.9544456792351128,
		0.6423596296199048, 0.25319469114498266, 0.08000000000000002,
	}

	Hamming16 = []float64{
		0.08000000000000002, 0.11976908948440362, 0.2321999210749252, 0.3978521825875242, 0.5880830931031206,
		0.7699999999999999, 0.9121478174124759, 0.9899478963375506, 0.9899478963375506, 0.9121478174124759,
		0.7700000000000002, 0.588083093103121, 0.3978521825875243, 0.23219992107492543, 0.11976908948440379,
		0.08000000000000002,
	}

	Hamming32 = []float64{
		0.08000000000000002, 0.08941622702385255, 0.11727940665469394, 0.16244881704465292, 0.2230752172251842,
		0.29667655524959724, 0.38023958369138267, 0.4703432223478947, 0.5632986176658078, 0.6553001648390114,
		0.7425813097165119, 0.8215687519719249, 0.8890287364386839, 0.9421994434265077, 0.9789040579440225,
		0.9976398887602718, 0.9976398887602718, 0.9789040579440225, 0.9421994434265079, 0.889028736438684,
		0.8215687519719249, 0.7425813097165117, 0.6553001648390114, 0.5632986176658079, 0.4703432223478948,
		0.38023958369138267, 0.29667655524959735, 0.22307521722518425, 0.16244881704465292, 0.117279406654694,
		0.08941622702385255, 0.08000000000000002,
	}

	Hamming64 = []float64{
		0.08000000000000002, 0.08228584333191535, 0.08912065558966986, 0.10043650933837528, 0.11612094253961253,
		0.13601807624969486, 0.15993016381464237, 0.18761955616527015, 0.21881106368040654, 0.25319469114498255,
		0.2904287186217507, 0.3301430976175451, 0.3719431287914583, 0.4154133846542177, 0.4601218382732121,
		0.5056241569502449, 0.5514681181995136, 0.5971981041378432, 0.6423596296199047, 0.6865038591157749,
		0.7291920674400814, 0.7700000000000001, 0.8085220892280034, 0.8443754852945554, 0.8772038610417202,
		0.9066809533225444, 0.9325138055507917, 0.9544456792351128, 0.972258605561518, 0.9857755516653759,
		0.9948621800635593, 0.9994281837607044, 0.9994281837607044, 0.9948621800635593, 0.9857755516653759,
		0.9722586055615179, 0.9544456792351128, 0.9325138055507916, 0.9066809533225443, 0.8772038610417201,
		0.8443754852945553, 0.8085220892280034, 0.7699999999999999, 0.7291920674400814, 0.6865038591157747,
		0.6423596296199048, 0.5971981041378431, 0.5514681181995137, 0.5056241569502449, 0.46012183827321185,
		0.4154133846542177, 0.3719431287914582, 0.3301430976175451, 0.29042871862175057, 0.25319469114498266,
		0.21881106368040648, 0.18761955616526999, 0.15993016381464237, 0.1360180762496948, 0.11612094253961253,
		0.10043650933837522, 0.08912065558966986, 0.08228584333191535, 0.08000000000000002,
	}

	Hamming128 = []float64{}/* 128 elements not displayed */

	Hamming256 = []float64{}/* 256 elements not displayed */

	Hamming512 = []float64{}/* 512 elements not displayed */

	Hamming1024 = []float64{}/* 1024 elements not displayed */

	Hamming2048 = []float64{}/* 2048 elements not displayed */

	Hamming4096 = []float64{}/* 4096 elements not displayed */

	Hamming8192 = []float64{}/* 8192 elements not displayed */

)
View Source
var (
	Hann8 = []float64{
		0, 0.1882550990706332, 0.6112604669781572, 0.9504844339512095, 0.9504844339512095, 0.6112604669781573,
		0.1882550990706333, 0,
	}

	Hann16 = []float64{
		0, 0.04322727117869957, 0.16543469682057083, 0.3454915028125263, 0.5522642316338267, 0.7499999999999999,
		0.9045084971874737, 0.9890738003669028, 0.9890738003669028, 0.9045084971874737, 0.7500000000000002,
		0.5522642316338271, 0.3454915028125264, 0.1654346968205711, 0.04322727117869973, 0,
	}

	Hann32 = []float64{
		0, 0.010235029373752758, 0.0405210941898847, 0.08961827939636186, 0.15551654046215668, 0.23551799483651875,
		0.32634737357758986, 0.42428611124771165, 0.5253245844193564, 0.6253262661293602, 0.7201970757788172,
		0.8060529912738315, 0.8793790613463954, 0.937173308072291, 0.9770696282000244, 0.9974346616959475,
		0.9974346616959475, 0.9770696282000244, 0.937173308072291, 0.8793790613463955, 0.8060529912738315,
		0.7201970757788171, 0.6253262661293602, 0.5253245844193564, 0.42428611124771165, 0.32634737357758986,
		0.2355179948365188, 0.1555165404621568, 0.08961827939636186, 0.040521094189884754, 0.010235029373752758, 0,
	}

	Hann64 = []float64{
		0, 0.002484612317299295, 0.009913756075728086, 0.02221359710692966, 0.03926189406479619, 0.060889213314885726,
		0.08688061284200255, 0.116977778440511, 0.15088159095696357, 0.1882550990706332, 0.22872686806712028,
		0.27189467132341855, 0.3173294878168025, 0.36457976592849745, 0.4131759111665349, 0.46263495320678794,
		0.5124653458690365, 0.5621718523237426, 0.6112604669781572, 0.6592433251258423, 0.7056435515653058, 0.75,
		0.791871836117395, 0.8308429187984298, 0.8665259359149132, 0.8985662536114613, 0.9266454408160778,
		0.9504844339512095, 0.9698463103929542, 0.984538643114539, 0.9944154131125643, 0.9993784606094611,
		0.9993784606094611, 0.9944154131125643, 0.984538643114539, 0.9698463103929542, 0.9504844339512095,
		0.9266454408160778, 0.8985662536114611, 0.8665259359149131, 0.8308429187984296, 0.7918718361173949,
		0.7499999999999998, 0.7056435515653058, 0.659243325125842, 0.6112604669781573, 0.5621718523237424,
		0.5124653458690366, 0.4626349532067878, 0.41317591116653457, 0.36457976592849745, 0.3173294878168023,
		0.27189467132341855, 0.22872686806712017, 0.1882550990706333, 0.15088159095696352, 0.11697777844051083,
		0.08688061284200255, 0.060889213314885615, 0.03926189406479619, 0.02221359710692955, 0.009913756075728086,
		0.002484612317299295, 0,
	}

	Hann128 = []float64{}/* 128 elements not displayed */

	Hann256 = []float64{}/* 256 elements not displayed */

	Hann512 = []float64{}/* 512 elements not displayed */

	Hann1024 = []float64{}/* 1024 elements not displayed */

	Hann2048 = []float64{}/* 2048 elements not displayed */

	Hann4096 = []float64{}/* 4096 elements not displayed */

	Hann8192 = []float64{}/* 8192 elements not displayed */

)

Functions

This section is empty.

Types

type GeneratorFunc

type GeneratorFunc func(int) Window

GeneratorFunc is a type of function that generates a Window based on an input size.

func (GeneratorFunc) Generate

func (w GeneratorFunc) Generate(size int) Window

Generate calls the GeneratorFunc itself, with the input int `size`.

type Window

type Window []float64

Window is a custom type for a slice of float64, that repesents a Window that shapes input signal.

func Blackman

func Blackman(i int) Window

Blackman returns an L-point Blackman window Reference: http://www.mathworks.com/help/signal/ref/blackman.html

func Hamming

func Hamming(i int) Window

Hamming returns an L-point symmetric Hamming window. Reference: http://www.mathworks.com/help/signal/ref/hamming.html

func Hann

func Hann(i int) Window

Hann returns an L-point Hann window. Reference: http://www.mathworks.com/help/signal/ref/hann.html

func New

func New(w GeneratorFunc, size int) Window

New creates a new Window from the input GeneratorFunc and size

The size should be a power of two supported in the fft package's BlockSize.

In case the input size `int` is not a power of two, it will fallback to the next available block size, with a series of bit-shifting operations on the input size to derive the closest element in the (private) blockSizes slice of ints.

func (Window) Apply

func (w Window) Apply(value []float64)

Apply will go through the input slice of float64 values, and apply the window to it by multiplying the value by the ratio in the respective element in the Window.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL