Mercurial > hg > may
changeset 49:8c10155c99a7
Obtain windowed and frequency-domain frames
author | Chris Cannam |
---|---|
date | Sun, 06 Jan 2013 21:55:52 +0000 |
parents | f97abcda094f |
children | f9c4ec20ff62 |
files | framer.yeti window.yeti |
diffstat | 2 files changed, 23 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/framer.yeti Sat Dec 29 23:06:22 2012 +0000 +++ b/framer.yeti Sun Jan 06 21:55:52 2013 +0000 @@ -7,7 +7,10 @@ */ block = load block; +bf = load blockfuncs; af = load audiofile; +win = load window; +fft = load fft; blockList framesize stream = if stream.finished? then @@ -46,16 +49,26 @@ framesize (block.zeros framesize); fi; -framesOfFile { framesize, hop } filename = - if framesize == hop then - blockList framesize (af.open filename) - else - overlappingBlockList framesize hop (af.open filename) - framesize (block.zeros framesize); - fi; +windowedFrames { framesize, hop, window } stream = + (win = window framesize; + map (bf.multiply win) (frames { framesize, hop } stream)); + +frequencyDomainFrames { framesize, hop } stream = + (f = fft.realForward framesize; + map f (windowedFrames { framesize, hop, window = win.hann } stream)); { frames, - framesOfFile, + windowedFrames, + frequencyDomainFrames, + + framesOfFile parameters filename = + frames parameters (af.open filename), + + windowedFramesOfFile parameters filename = + windowedFrames parameters (af.open filename), + + frequencyDomainFramesOfFile parameters filename = + frequencyDomainFrames parameters (af.open filename), }
--- a/window.yeti Sat Dec 29 23:06:22 2012 +0000 +++ b/window.yeti Sun Jan 06 21:55:52 2013 +0000 @@ -32,7 +32,7 @@ done [0..m-1] ]); -windowedFrames windowFunc frames = +windowed windowFunc frames = case frames of []: frames; _: (first = head frames; @@ -42,6 +42,6 @@ { cosinewin, hann, hamming, blackman, nuttall, blackmanHarris, boxcar, bartlett, -windowedFrames +windowed };