Re: Frequency shift to alleviate acoustic feedback ("Richard F. Lyon" )


Subject: Re: Frequency shift to alleviate acoustic feedback
From:    "Richard F. Lyon"  <dicklyon@xxxxxxxx>
Date:    Thu, 24 Jan 2013 22:41:05 -0800
List-Archive:<http://lists.mcgill.ca/scripts/wa.exe?LIST=AUDITORY>

--20cf300fb36f39300404d41736ff Content-Type: text/plain; charset=ISO-8859-1 To put it more simply, the original assumption that frequency shifting would be "the simplest method" was unfounded. Frequency shifting is actually quite complicated, subtle, error prone, and not so well defined. Dick On Thu, Jan 24, 2013 at 9:04 AM, Steve Beet <steve.beet@xxxxxxxx> wrote: > Dear Siping, > > I'm afraid I don't know of any references on this subject, but I'll try to > explain a bit more clearly - and without making too many mistakes this time. > > As I understand it, what you are doing is roughly as follows: > > You take the first 160 samples, apply a Hanning window, then zero-pad to > 512 samples so you can take the DFT. At this stage you should really set > the zero-frequency and Nyquist-frequency FFT outputs to zero (the phase is > ambiguous at these two points, and it's less likely that you will introduce > any audible artefacts if you set the amplitudes to zero, rather than using > non-zero but incorrect values). > > You then shift the FFT outputs (real and imaginary) up by one bin and > perform an IFFT to get an approximation to a Hanning-windowed version of > the frequency-shifted signal you require. Just to clarify - the IFFT > effectively sums a set of sinewaves with initial phase and amplitude > determined by the real and imaginary parts of the FFT bin value. You should > (of course) also make sure that the new zero and Nyquist frequency bins are > still zeroed at this point. > > Finally, you take the first 160 outputs from the IFFT, and add them, > starting at the 81st sample, to the next set of outputs, formed by stepping > along the input by 80 samples and repeating the above procedure. > > It is worth noting that the result of the IFFT operation is only > *approximately* Hanning-windowed. Indeed, it was derived from the original > Hanning-windowed signal, but because of the effects of frequency-shifting > the different frequency components will have increasingly different phase > relationships as you progress along the array, and when you get beyond the > point where the original signal had ended and the zero-padding had begun > (160 samples), there will still be finite (i.e. non-zero) signal energy. > > If it were not for the frequency shifting, at every point which was > originally zero-padded, the different sinewaves would all cancel out > exactly and the output signal would be an exact copy of the input, > including the effects of the window. But frequency is just the derivative > of the phase of each sinewave, so if you change the frequency of a > sinewave, the respective phase will progress at a different rate, and after > a while two sinewaves which may originally have reinforced each other (i.e. > been "in phase") may cancel each other out (i.e. be "out-of-phase"). > > So the problem with this overlapped-block approach is that the successive > IFFT outputs are not accurately limited to the 160 sample length that your > inputs were, and while the total amplitude of 50% overlapped Hanning > windows would be constant, when you overlap and add your IFFT outputs, the > effective amplitude of the "window" will have been distorted and will not > be constant any more. > > Further, during the transition between the peak of one window and the > next, there will also be periods when the shifted frequency sinewaves from > one window, reinforce or cancel those from the other, producing a kind of > "beating" effect. > > I'm afraid this is getting rather too long and detailed for the general > auditory list though, so if you want to discuss it further, I'd suggest we > continue off-list. > > Best, > > Steve Beet > > > > On Thu, 24 Jan 2013 10:05:14 +0800 > Siping Tao <siping.tao@xxxxxxxx> wrote: > > > Dear Steve, > > > > Your explaination is reasonable, I do just copy the real and imaginary > > parts without the consideration of phase. > > > > I did not fully understand the method you recommended due to my limited > > knowledge. > > > > 1. "*by the end of each block, the new signal will have been through a > > different number of cycles of each sinusoidal component*" > > what's the meaning of cycles? why overlap processing induces this > > problem? > > 2. "*by converting the phase of each FFT bin to a time delay (rather > than a > > phase angle)*" > > how can I get the phase or set the phase for the delayed bin? In > > overlap case, how to promise each bin has only one phase > > rather than the average of several different phases? Any example code > > or papers, whatever? > > > > Thanks for your help! > > Siping > > > > On Wed, Jan 23, 2013 at 6:48 PM, Steve Beet <steve.beet@xxxxxxxx> wrote: > > > > > Dear Siping, > > > > > > The most likely explanation is that when you shift the FFT by one bin, > you > > > (presumably) just copy the real and imaginary parts, so the initial > phase > > > of the respective components stays the same at the new frequency. > However, > > > by the end of each block, the new signal will have been through a > different > > > number of cycles of each sinusoidal component, so the phase at the end > of > > > the frequency-shifted block will not match up with the phase at the > start > > > of the next block. > > > > > > Manipulating the phases so that the different components maintain the > > > "correct" phase relationships with the signal components in subsequent > > > blocks could be done by converting the phase of each FFT bin to a time > > > delay (rather than a phase angle), and calculating the phase for the > > > shifted signal which would give the same time delay. > > > > > > There may be other issues too (e.g. the handling of the first and last > DFT > > > bins, where there's no phase information), but I would try setting the > > > phase such that the signal at the centre of each overlapped window is > > > "correct", and hope that the taper of the Hanning window will minimise > the > > > effect of any discontinuities near the ends of each block. > > > > > > Let us know how you get on! > > > > > > Steve Beet > > > > > > > > > On Wed, 23 Jan 2013 11:05:08 +0100 > > > Zlatan Ribic <zlatan@xxxxxxxx> wrote: > > > > > > > M. Hartley Jones: "Frequency Shifter for "Howl" Suppression", > Wireless > > > World, July 1973. 317-322 > > > > > > > > ----- Original Message ----- > > > > From: Siping Tao > > > > To: AUDITORY@xxxxxxxx > > > > Sent: Wednesday, January 23, 2013 9:56 AM > > > > Subject: Frequency shift to alleviate acoustic feedback > > > > > > > > > > > > Dear experts, > > > > > > > > Acoustic feedback can be removed by several methods: frequency > shift, > > > phase shift, notch filter, adaptive cancellation. I tried the simplest > > > method I thought, frqeuency shift. However, it's not easy as I > thought. In > > > realtime processing scenario, I need to process every 10ms audio sample > > > without significant delay, so I do the following implementation: > > > > > > > > 1. sampling rate is 16K, so I have 160 samples every 10ms. > > > > 2. do DFT for these 160 samples, the DFT length is 512, pending > zeros > > > since I only have 160 samples > > > > 3. shift the frequency by one fft coefficient, that is, shift > > > 16000/512=31.25Hz (DC is not shifted) > > > > 4. do IDFT > > > > > > > > After doing that, I can notice the spectrum is shifted in > cool-edit, > > > but with some processing noise (not the artifacts due to frequency > shift). > > > I guess this noise is caused by different processing for successive10ms > > > data, I am not sure here. However, I try to use overlap processing in > my > > > code, hanning window, 50% overlap, then the processing noise is reduced > > > much. Unfortunately, I found that overlap processing sometimes make the > > > frequency shift useless (e.g. 75% overlap by blackman window), what I > mean > > > useless is I cannot notice spectrum shift in cool-edit. > > > > > > > > Can anybody help me to understand why overlap processing hurts > > > frequency shift? Or point out the incorrect parts of my implementation. > > > > > > > > Thanks, > > > > Siping > > > > --20cf300fb36f39300404d41736ff Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable To put it more simply, the original assumption that frequency shifting woul= d be &quot;the simplest method&quot; was unfounded.<br>Frequency shifting i= s actually quite complicated, subtle, error prone, and not so well defined.= <br> <br>Dick<br><br><div class=3D"gmail_quote">On Thu, Jan 24, 2013 at 9:04 AM,= Steve Beet <span dir=3D"ltr">&lt;<a href=3D"mailto:steve.beet@xxxxxxxx" ta= rget=3D"_blank">steve.beet@xxxxxxxx</a>&gt;</span> wrote:<br><blockquote cl= ass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;p= adding-left:1ex"> Dear Siping,<br> <br> I&#39;m afraid I don&#39;t know of any references on this subject, but I&#3= 9;ll try to explain a bit more clearly - and without making too many mistak= es this time.<br> <br> As I understand it, what you are doing is roughly as follows:<br> <br> You take the first 160 samples, apply a Hanning window, then zero-pad to 51= 2 samples so you can take the DFT. At this stage you should really set the = zero-frequency and Nyquist-frequency FFT outputs to zero (the phase is ambi= guous at these two points, and it&#39;s less likely that you will introduce= any audible artefacts if you set the amplitudes to zero, rather than using= non-zero but incorrect values).<br> <br> You then shift the FFT outputs (real and imaginary) up by one bin and perfo= rm an IFFT to get an approximation to a Hanning-windowed version of the fre= quency-shifted signal you require. Just to clarify - the IFFT effectively s= ums a set of sinewaves with initial phase and amplitude determined by the r= eal and imaginary parts of the FFT bin value. You should (of course) also m= ake sure that the new zero and Nyquist frequency bins are still zeroed at t= his point.<br> <br> Finally, you take the first 160 outputs from the IFFT, and add them, starti= ng at the 81st sample, to the next set of outputs, formed by stepping along= the input by 80 samples and repeating the above procedure.<br> <br> It is worth noting that the result of the IFFT operation is only *approxima= tely* Hanning-windowed. Indeed, it was derived from the original Hanning-wi= ndowed signal, but because of the effects of frequency-shifting the differe= nt frequency components will have increasingly different phase relationship= s as you progress along the array, and when you get beyond the point where = the original signal had ended and the zero-padding had begun (160 samples),= there will still be finite (i.e. non-zero) signal energy.<br> <br> If it were not for the frequency shifting, at every point which was origina= lly zero-padded, the different sinewaves would all cancel out exactly and t= he output signal would be an exact copy of the input, including the effects= of the window. But frequency is just the derivative of the phase of each s= inewave, so if you change the frequency of a sinewave, the respective phase= will progress at a different rate, and after a while two sinewaves which m= ay originally have reinforced each other (i.e. been &quot;in phase&quot;) m= ay cancel each other out (i.e. be &quot;out-of-phase&quot;).<br> <br> So the problem with this overlapped-block approach is that the successive I= FFT outputs are not accurately limited to the 160 sample length that your i= nputs were, and while the total amplitude of 50% overlapped Hanning windows= would be constant, when you overlap and add your IFFT outputs, the effecti= ve amplitude of the &quot;window&quot; will have been distorted and will no= t be constant any more.<br> <br> Further, during the transition between the peak of one window and the next,= there will also be periods when the shifted frequency sinewaves from one w= indow, reinforce or cancel those from the other, producing a kind of &quot;= beating&quot; effect.<br> <br> I&#39;m afraid this is getting rather too long and detailed for the general= auditory list though, so if you want to discuss it further, I&#39;d sugges= t we continue off-list.<br> <br> Best,<br> <br> Steve Beet<br> <div class=3D"im"><br> <br> <br> On Thu, 24 Jan 2013 10:05:14 +0800<br> Siping Tao &lt;<a href=3D"mailto:siping.tao@xxxxxxxx">siping.tao@xxxxxxxx</a>= &gt; wrote:<br> <br> &gt; Dear Steve,<br> &gt;<br> </div>&gt; Your explaination is reasonable, I do just copy the real and ima= ginary<br> <div class=3D"im">&gt; parts without the consideration of phase.<br> &gt;<br> &gt; I did not fully understand the method you recommended due to my limite= d<br> &gt; knowledge.<br> &gt;<br> </div>&gt; 1. &quot;*by the end of each block, the new signal will have bee= n through a<br> &gt; different number of cycles of each sinusoidal component*&quot;<br> <div class=3D"im">&gt; =A0 =A0 what&#39;s the meaning of cycles? why overla= p processing induces this<br> &gt; problem?<br> </div>&gt; 2. &quot;*by converting the phase of each FFT bin to a time dela= y (rather than a<br> &gt; phase angle)*&quot;<br> <div class=3D"im">&gt; =A0 =A0 how can I get the phase or set the phase for= the delayed bin? In<br> &gt; overlap case, how to promise each bin has only one phase<br> &gt; =A0 =A0 rather than the average of several different phases? Any examp= le code<br> &gt; or papers, whatever?<br> &gt;<br> &gt; Thanks for your help!<br> </div>&gt; Siping<br> <div class=3D"im HOEnZb">&gt;<br> &gt; On Wed, Jan 23, 2013 at 6:48 PM, Steve Beet &lt;<a href=3D"mailto:stev= e.beet@xxxxxxxx">steve.beet@xxxxxxxx</a>&gt; wrote:<br> &gt;<br> &gt; &gt; Dear Siping,<br> &gt; &gt;<br> </div><div class=3D"HOEnZb"><div class=3D"h5">&gt; &gt; The most likely exp= lanation is that when you shift the FFT by one bin, you<br> &gt; &gt; (presumably) just copy the real and imaginary parts, so the initi= al phase<br> &gt; &gt; of the respective components stays the same at the new frequency.= However,<br> &gt; &gt; by the end of each block, the new signal will have been through a= different<br> &gt; &gt; number of cycles of each sinusoidal component, so the phase at th= e end of<br> &gt; &gt; the frequency-shifted block will not match up with the phase at t= he start<br> &gt; &gt; of the next block.<br> &gt; &gt;<br> &gt; &gt; Manipulating the phases so that the different components maintain= the<br> &gt; &gt; &quot;correct&quot; phase relationships with the signal component= s in subsequent<br> &gt; &gt; blocks could be done by converting the phase of each FFT bin to a= time<br> &gt; &gt; delay (rather than a phase angle), and calculating the phase for = the<br> &gt; &gt; shifted signal which would give the same time delay.<br> &gt; &gt;<br> &gt; &gt; There may be other issues too (e.g. the handling of the first and= last DFT<br> &gt; &gt; bins, where there&#39;s no phase information), but I would try se= tting the<br> &gt; &gt; phase such that the signal at the centre of each overlapped windo= w is<br> &gt; &gt; &quot;correct&quot;, and hope that the taper of the Hanning windo= w will minimise the<br> &gt; &gt; effect of any discontinuities near the ends of each block.<br> &gt; &gt;<br> &gt; &gt; Let us know how you get on!<br> &gt; &gt;<br> &gt; &gt; Steve Beet<br> &gt; &gt;<br> &gt; &gt;<br> &gt; &gt; On Wed, 23 Jan 2013 11:05:08 +0100<br> &gt; &gt; Zlatan Ribic &lt;<a href=3D"mailto:zlatan@xxxxxxxx">zlatan@xxxxxxxx= IBIC.COM</a>&gt; wrote:<br> &gt; &gt;<br> &gt; &gt; &gt; M. Hartley Jones: &quot;Frequency Shifter for &quot;Howl&quo= t; Suppression&quot;, Wireless<br> &gt; &gt; World, July 1973. 317-322<br> &gt; &gt; &gt;<br> &gt; &gt; &gt; =A0 ----- Original Message -----<br> &gt; &gt; &gt; =A0 From: Siping Tao<br> &gt; &gt; &gt; =A0 To: <a href=3D"mailto:AUDITORY@xxxxxxxx">AUDITORY= @xxxxxxxx</a><br> &gt; &gt; &gt; =A0 Sent: Wednesday, January 23, 2013 9:56 AM<br> &gt; &gt; &gt; =A0 Subject: Frequency shift to alleviate acoustic feedback<= br> &gt; &gt; &gt;<br> &gt; &gt; &gt;<br> &gt; &gt; &gt; =A0 Dear experts,<br> &gt; &gt; &gt;<br> &gt; &gt; &gt; =A0 Acoustic feedback can be removed by several methods: fre= quency shift,<br> &gt; &gt; phase shift, notch filter, adaptive cancellation. I tried the sim= plest<br> &gt; &gt; method I thought, frqeuency shift. However, it&#39;s not easy as = I thought. In<br> &gt; &gt; realtime processing scenario, I need to process every 10ms audio = sample<br> &gt; &gt; without significant delay, so I do the following implementation:<= br> &gt; &gt; &gt;<br> &gt; &gt; &gt; =A0 1. sampling rate is 16K, so I have 160 samples every 10m= s.<br> &gt; &gt; &gt; =A0 2. do DFT for these 160 samples, the DFT length is 512, = pending zeros<br> &gt; &gt; since I only have 160 samples<br> &gt; &gt; &gt; =A0 3. shift the frequency by one fft coefficient, that is, = shift<br> &gt; &gt; 16000/512=3D31.25Hz (DC is not shifted)<br> &gt; &gt; &gt; =A0 4. do IDFT<br> &gt; &gt; &gt;<br> &gt; &gt; &gt; =A0 After doing that, I can notice the spectrum is shifted i= n cool-edit,<br> &gt; &gt; but with some processing noise (not the artifacts due to frequenc= y shift).<br> &gt; &gt; I guess this noise is caused by different processing for successi= ve10ms<br> &gt; &gt; data, I am not sure here. However, I try to use overlap processin= g in my<br> &gt; &gt; code, hanning window, 50% overlap, then the processing noise is r= educed<br> &gt; &gt; much. Unfortunately, I found that overlap processing sometimes ma= ke the<br> &gt; &gt; frequency shift useless (e.g. 75% overlap by blackman window), wh= at I mean<br> &gt; &gt; useless is I cannot notice spectrum shift in cool-edit.<br> &gt; &gt; &gt;<br> &gt; &gt; &gt; =A0 Can anybody help me to understand why overlap processing= hurts<br> &gt; &gt; frequency shift? Or point out the incorrect parts of my implement= ation.<br> &gt; &gt; &gt;<br> &gt; &gt; &gt; =A0 Thanks,<br> &gt; &gt; &gt; =A0 Siping<br> &gt; &gt;<br> </div></div></blockquote></div><br> --20cf300fb36f39300404d41736ff--


This message came from the mail archive
/var/www/postings/2013/
maintained by:
DAn Ellis <dpwe@ee.columbia.edu>
Electrical Engineering Dept., Columbia University