Mercurial > hg > may
changeset 382:a519d3b7e32c
My alpha, beta are not working in emacs on Windows (pity)
author | Chris Cannam |
---|---|
date | Mon, 16 Sep 2013 10:53:37 +0100 |
parents | ff6f59832f15 |
children | 4b104ef8d110 |
files | may/signal/window.yeti |
diffstat | 1 files changed, 19 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/may/signal/window.yeti Fri Sep 13 14:59:27 2013 +0100 +++ b/may/signal/window.yeti Mon Sep 16 10:53:37 2013 +0100 @@ -97,7 +97,7 @@ vec.fromList ((take n0 (reverse half)) ++ (take n1 half)); fi; -kaiser 𝛽 n = +kaiser beta n = (bes0 x = (fact x = fold do x y: x*y done 1 [1..x]; // x! ipow a b = fold do x _: x*a done 1 [1..b]; // a^b where b∈ℕ @@ -108,48 +108,48 @@ _: (ipow (x/2) (i*2)) / (square (fact i)); esac; sum (map (term x) [0..20])); - denominator = bes0 𝛽; + denominator = bes0 beta; vec.fromList (map do i: k = 2*i / (n-1) - 1; - bes0 (𝛽 * sqrt (1 - k*k)) / denominator; + bes0 (beta * sqrt (1 - k*k)) / denominator; done [0..n-1])); /** Kaiser window with sidelobe attenuation of 𝛼 dB and window length n */ -kaiserForAttenuation 𝛼 n = - (𝛽 = - if 𝛼 > 50 then 0.1102 * (𝛼 - 8.7) - elif 𝛼 > 21 then 0.5842 * Math#pow(𝛼 - 21, 0.4) + 0.07886 * (𝛼 - 21) +kaiserForAttenuation alpha n = + (beta = + if alpha > 50 then 0.1102 * (alpha - 8.7) + elif alpha > 21 then 0.5842 * Math#pow(alpha - 21, 0.4) + 0.07886 * (alpha - 21) else 0 fi; - kaiser 𝛽 n); + kaiser beta n); /** - Kaiser window with sidelobe attenuation of 𝛼 dB and transition + Kaiser window with sidelobe attenuation of alpha dB and transition bandwidth of (tw * samplerate) / (2 * pi) */ -kaiserForTransitionLength 𝛼 tw = - (m = if 𝛼 > 21 - then Math#ceil((𝛼 - 7.95) / (2.285 * tw)) +kaiserForTransitionLength alpha tw = + (m = if alpha > 21 + then Math#ceil((alpha - 7.95) / (2.285 * tw)) else Math#ceil(5.79 / tw) fi; - kaiserForAttenuation 𝛼 (m+1)); + kaiserForAttenuation alpha (m+1)); /** - Kaiser window with sidelobe attenuation of 𝛼 dB and transition + Kaiser window with sidelobe attenuation of alpha dB and transition bandwidth of tbw Hz at the given sampleRate */ -kaiserForBandwidth 𝛼 tbw samplerate = - kaiserForTransitionLength 𝛼 ((tbw * 2 * pi) / samplerate); +kaiserForBandwidth alpha tbw samplerate = + kaiserForTransitionLength alpha ((tbw * 2 * pi) / samplerate); windowFunction type options = (var sampling = Periodic (); - var 𝛽 = 4; + var beta = 4; for options \case of Symmetric s: if s then sampling := Symmetric () fi; - Beta b: 𝛽 := b; + Beta b: beta := b; esac; case type of Hann (): hann sampling; @@ -160,7 +160,7 @@ BlackmanHarris (): blackmanHarris sampling; Boxcar (): boxcar; Bartlett (): bartlett sampling; - Kaiser (): kaiser 𝛽; + Kaiser (): kaiser beta; esac); //!!! should use vector. but does anyone use this function anyway? would we use it in framer if it used vector?