Ron N. wrote:> Jerry Avins wrote: > >>The Hann window is a raised cosine. It's performance is good, but not >>outstanding; other, better windows use more terms. Hats off to Nuttall, >>Blackman, Harris, Kaiser, and others. But before (he knew) their work, >>Hamming had a problem with a Hann window's first sidelobe. He determined >>empirically that 92% Hann and 8% rectangular knocked the first sidelobe >>down as far as it would go without raising any of the others above it. >> >>Hamming was smart. He knew not only how to get the job done, but also >>when to quit. His window is probably not optimum for much (if anything) >>but it's good enough for the particular class of problems he dealt with. >>That said, it's an empirical kludge, more like what I would do than what >>we expect from people who get remembered. Hamming is remembered for many >>things besides his window. >> >>Despite it's relatively poor sidelobe performance, a Hann window has >>a property it shares only with Bartlett (triangular) and rectangular >>windows: when overlapped 50%, the sum is uniform. That property >>recommends it for certain applications (NOT fast convolution). > > > Because the Hamming window is the sum of a Hann window and a > rectangular window, it also share's this property of a uniform sum > when overlapped 50%Yah. I wrote Hann and rectangular, assuming that we all know about superposition. Thanks for making it explicit. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

# C++ Simple Pitch Shift

Started by ●January 24, 2006

Reply by ●January 25, 20062006-01-25

Reply by ●January 25, 20062006-01-25

Jerry Avins wrote:> robert bristow-johnson wrote: > > > > it's not a bad idea to think of the window functions as the > > concatination of a fade-up and fade-down functions. the hann window is > > not bad for crossfading, but the Hamming is not so good > > (discontinuity). > > The Hann window is a raised cosine. It's performance is good, but not > outstanding; other, better windows use more terms. Hats off to Nuttall, > Blackman, Harris, Kaiser, and others. But before (he knew) their work, > Hamming had a problem with a Hann window's first sidelobe. He determined > empirically that 92% Hann and 8% rectangular knocked the first sidelobe > down as far as it would go without raising any of the others above it. > > Hamming was smart. He knew not only how to get the job done, but also > when to quit. His window is probably not optimum for much (if anything) > but it's good enough for the particular class of problems he dealt with....> Despite it's relatively poor sidelobe performance, a Hann window has a > property it shares only with Bartlett (triangular) and rectangular > windows: when overlapped 50%, the sum is uniform. That property > recommends it for certain applications (NOT fast convolution).as pointed out the Hamming can be complementary, too. if you scale it so that when it's 50% done fading out, it's at 0.5. then the Hamming will sum to 1. any of these complemetary windows satistfy: +inf SUM{ w(t - n*T) } = 1 n=-inf where T is the width between the 50% points of the window. this results with +inf SUM{ x(t) * w(t - n*T) } = x(t) n=-inf the time-scaling part of a pitch detector might be expressed as: +inf SUM{ x(t + k[n]/f0(t)) * w(t - n*T) } = x(t) n=-inf where k[n] is always an integer starting with zero and f0(t) is the fundamental frequency (determined by a simultaneous pitch detector) around time t. when no time-scaling is done, k[n] will always be zero, but when time-scaling *is* done, k[n] will increment or decrement in such a way that t/( t+ k[n]/f0(t)) is approximately the time-scaling factor. anyway, it is between these adjacent windows when k[n] jumps to another integer value that you do not want that 8% discontinuity of the Hamming window. r b-j

Reply by ●January 25, 20062006-01-25

in article 1138230108.727351.17560@g49g2000cwa.googlegroups.com, robert bristow-johnson at rbj@audioimagination.com wrote on 01/25/2006 18:01:> the time-scaling part of a pitch detector might be expressed as: > > > +inf > SUM{ x(t + k[n]/f0(t)) * w(t - n*T) } = x(t) > n=-inf > > where k[n] is always an integer starting with zero and f0(t) is the > fundamental frequency (determined by a simultaneous pitch detector) > around time t.i think this is not quite right. first i shoulda said the result is the output, y(t), not "x(t)". it will sorta work for f0(t) = constant (but then why make it a function of t?) +inf SUM{ x(t + Tau[n]) * w(t - n*T) } = y(t) n=-inf where Tau[0] = 0 Tau[n] = Tau[n-1] + m[n]/f0(t + Tau[n-1]) f0(t) is the fundamental frequency around time t, and m[n] is an integer that is either -1, 0, or +1. which value m[n] takes on is whatever it has to so that t/(t + Tau[n]) = approximately the time-scaling factor. that might be a little more accurate. anyway, the undesirability of windows with discontinuities, such as the rectangular or Hamming, remains. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."

Reply by ●January 25, 20062006-01-25

robert bristow-johnson wrote: ...> as pointed out the Hamming can be complementary, too. if you scale it > so that when it's 50% done fading out, it's at 0.5. then the Hamming > will sum to 1.It adds to 1. without scaling. A rectangular windows add to 2. Of course, any window can be scaled. For some uses, one wants the mean ordinate rather than the peak to have a specific value. Jerry *Appendix :o)* Hamming(i,N) = .5 + .5*cos(2pi*i/N); goes to .5 when i = +/-N/4 Hann(i,N) = .04 + .92*Hamming(i,N); goes to .5 when i = +/-N/4 N is the total number of points; i is zero at the center. -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Reply by ●January 26, 20062006-01-26

in article p7GdnfgUx_C7r0XeRVn-qg@rcn.net, Jerry Avins at jya@ieee.org wrote on 01/25/2006 21:21:> robert bristow-johnson wrote: > > ... > >> as pointed out the Hamming can be complementary, too. if you scale it >> so that when it's 50% done fading out, it's at 0.5. then the Hamming >> will sum to 1. > > It adds to 1. without scaling. A rectangular windows add to 2. Of > course, any window can be scaled. For some uses, one wants the mean > ordinate rather than the peak to have a specific value. > > Jerry > > *Appendix :o)* > Hamming(i,N) = .5 + .5*cos(2pi*i/N); goes to .5 when i = +/-N/4 > Hann(i,N) = .04 + .92*Hamming(i,N); goes to .5 when i = +/-N/4that looks backwards to me, Jerry. i would say it's Hann(i,N) = 0.50 + 0.50*cos(2*pi*i/N) Hamming(i,N) = 0.54 + 0.46*cos(2*pi*i/N) = 0.08 + 0.92*Hann(i,N) (for |i| < N/2) the appropriately scaled Hamming that would add to 1 would be (0.5/0.54)*Hamming(i,N) = 0.50 + 0.426*cos(2*pi*i/N)> N is the total number of points; i is zero at the center.better make N an even number (if the center is at i=0) and N-1 will be the total number of non-zero points (unless we use the two outside ones for Hamming, and then it's N+1, this mixup is evident in MATLAB's definitions). BTW, for the purposes of cross-fading (that is, if you are representing the "fade-up" or "fade-in" gain function as the rising half of the window function and "fade-down" or "fade-out" as the falling half), i find it much easier to deal with windows in continuous time even though we almost always apply them in discrete time. that way, i don't have to worry about whether or not we're including those two outside points or not. also for cross-fading, i always define the windows to be complementary: Normalized Rectangular: { 1 |u| < 0.5 w(u) = { 0.5 |u| = 0.5 { 0 |u| > 0.5 Normalized Bartlett (triangular): { 1 - |u| |u| < 1.0 w(u) = { { 0 |u| >= 1.0 Normalized Hann: { 0.5 + 0.5*cos(pi*u) |u| < 1.0 w(u) = { { 0 |u| >= 1.0 Normalized (scaled) Hamming: { 0.5 + 0.426*cos(pi*u) |u| < 1.0 w(u) = { 0.037 |u| = 1.0 { 0 |u| > 1.0 Normalized Flattened Hann: { 1/2 + (9/16)*cos(pi*u) - (1/16)*cos(3*pi*u) |u| < 1.0 w(u) = { { 0 |u| >= 1.0 for all of these windows, their leading half perfectly compliments the trailing half: +inf SUM w(u - k) = 1 k=-inf can you tell me to what derivative each is continuous to? -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."