MCPcopy Create free account
hub / github.com/corbanbrook/dsp.js / WindowFunction

Function WindowFunction

dsp.js:1371–1417  ·  view source on GitHub ↗
(type, alpha)

Source from the content-addressed store, hash-verified

1369
1370
1371function WindowFunction(type, alpha) {
1372 this.alpha = alpha;
1373
1374 switch(type) {
1375 case DSP.BARTLETT:
1376 this.func = WindowFunction.Bartlett;
1377 break;
1378
1379 case DSP.BARTLETTHANN:
1380 this.func = WindowFunction.BartlettHann;
1381 break;
1382
1383 case DSP.BLACKMAN:
1384 this.func = WindowFunction.Blackman;
1385 this.alpha = this.alpha || 0.16;
1386 break;
1387
1388 case DSP.COSINE:
1389 this.func = WindowFunction.Cosine;
1390 break;
1391
1392 case DSP.GAUSS:
1393 this.func = WindowFunction.Gauss;
1394 this.alpha = this.alpha || 0.25;
1395 break;
1396
1397 case DSP.HAMMING:
1398 this.func = WindowFunction.Hamming;
1399 break;
1400
1401 case DSP.HANN:
1402 this.func = WindowFunction.Hann;
1403 break;
1404
1405 case DSP.LANCZOS:
1406 this.func = WindowFunction.Lanczoz;
1407 break;
1408
1409 case DSP.RECTANGULAR:
1410 this.func = WindowFunction.Rectangular;
1411 break;
1412
1413 case DSP.TRIANGULAR:
1414 this.func = WindowFunction.Triangular;
1415 break;
1416 }
1417}
1418
1419WindowFunction.prototype.process = function(buffer) {
1420 var length = buffer.length;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected