Re: Frequency shift to alleviate acoustic feedback (Siping Tao )


Subject: Re: Frequency shift to alleviate acoustic feedback
From:    Siping Tao  <siping.tao@xxxxxxxx>
Date:    Mon, 28 Jan 2013 09:52:03 +0800
List-Archive:<http://lists.mcgill.ca/scripts/wa.exe?LIST=AUDITORY>

--e89a8fb1f07c13fed604d44f866e Content-Type: text/plain; charset=ISO-8859-1 Hi Julius and Steve, Thanks for your help, my application scenario requires real-time processing, i.e. delay should be kept below 10ms at most. Anyway, I think the code of Julius is helpful, to give me a good reference. Steve, I will read the paper you recommended, thanks, your explaination is very clear. Frequency shift is absolutely harder than I thought :) Thanks, Siping On Sun, Jan 27, 2013 at 5:48 AM, Steve Beet <steve.beet@xxxxxxxx> wrote: > Hi Julius, > > That looks like a pretty good implementation of the block-based approach > which Siping wanted to implement. The only problem from Siping's point of > view is that it uses the two functions PV_BinShift() and PV_PhaseShift(), > which are not defined here and may rely on the fact that (in this example) > the FFT size is an exact multiple of the window length. If that is an issue > (or if the 2048-sample length window is important) then Siping would have > to > redefine the problem. > > I presume the 160-sample blocks were originally specified to keep the > real-time processing delay short. Is that correct, Siping? If so then a > 2048-sample window is probably not acceptable. > > Steve > > > -----Original Message----- > > From: Julius Smith [mailto:jos@xxxxxxxx > > Sent: Saturday, January 26, 2013 8:08 PM > > To: Steve Beet > > Cc: AUDITORY@xxxxxxxx > > Subject: Re: Frequency shift to alleviate acoustic feedback > > > > Hi All, > > > > I don't know if this will help or confuse things, but here is > > a pretty smooth frequency-shifting implementation in SuperCollider: > > > > // Frequency-Shifting Example 5: Add phase-correction > > // MouseX = amplitude > > // MouseY = frequency shift (400 * (2 ** MouseY(-1,1)) in [200,800]) > > // MouseButton = clear frequency shift > > // START WITH MOUSE NEAR THE LEFT OF YOUR SCREEN > > ( > > x = { > > var in, out, amp, f0=400, fftSize=8192, winLen=2048, hopFrac=0.5, > > chain, mexp, fScaled, df, binShift, phaseShift, > > inWinType=0, outWinType=0; > > amp = MouseX.kr(-60,10).dbamp; > > in = SinOsc.ar(f0,0,amp); > > chain = FFT(LocalBuf(fftSize), in, hopFrac, inWinType, 1, winLen); > > mexp = MouseY.kr(-1.0,1.0); > > mexp = mexp*(1-MouseButton.kr); > > fScaled = f0 * (2.0 ** mexp); > > df = fScaled - f0; > > binShift = fftSize * (df / s.sampleRate); > > chain = PV_BinShift(chain, stretch:1, shift:binShift, interp:1); > > phaseShift = 2 * pi * binShift * hopFrac * (winLen/fftSize); > > chain = PV_PhaseShift(chain, phaseShift, integrate:1); > > out = IFFT(chain,outWinType,winLen); > > Out.ar(0, out.dup); > > }.play > > ) > > > > - Julius > > > > At 04:48 AM 1/25/2013, Steve Beet wrote: > > > > > > Dear Siping, > > > > I'd agree with Dick's simplification, except to note > > that *if* you can assume that the listeners are not sensitive > > to phase, then frequency shifting is actually very easy - you > > merely have to ensure phase continuity at block boundaries, > > or (my preferred approach) do the processing sample-by-sample > > using a direct analogue of the traditional EE approach: > > heterodyning followed by linear filtering. > > > > I've also just remembered one reference which is > > relevant to this, and should give you some idea of the issues > > involved in manipulating an audio signal in terms of the > > frequencies, amplitudes and phases of its components: > > > > R.J. McAulay, T. F. Quartieri; "Speech > > analysis/synthesis based on a sinusoidal representation"; > > IEEE Trans. on Acoust., Speech and Signal Proc., vol ASSP-34, > > pp. 744-754, 1986. > > > > Good luck, > > > > Steve > > > > > > > > > > On Thu, 24 Jan 2013 22:41:05 -0800 > > "Richard F. Lyon" <dicklyon@xxxxxxxx> wrote: > > > > > 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 > > > > > > > > > Julius O. Smith III <jos@xxxxxxxx> > > Prof. of Music and Assoc. Prof. (by courtesy) of Electrical > > Engineering > > CCRMA, Stanford University > > http://ccrma.stanford.edu/~jos/ <http://ccrma.stanford.edu/~jos/> > > > --e89a8fb1f07c13fed604d44f866e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Julius and Steve,<br><br>Thanks for your help, my application scenario r= equires real-time processing, i.e. delay should be kept below 10ms at most.= <br><br>Anyway, I think the code of Julius is helpful, to give me a good re= ference.<br> <br>Steve, I will read the paper you recommended, thanks, your explaination= is very clear. Frequency shift is absolutely harder than I thought :)<br><= br>Thanks,<br>Siping<br><br><div class=3D"gmail_quote">On Sun, Jan 27, 2013= at 5:48 AM, Steve Beet <span dir=3D"ltr">&lt;<a href=3D"mailto:steve.beet@xxxxxxxx= ieee.org" target=3D"_blank">steve.beet@xxxxxxxx</a>&gt;</span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex">Hi Julius,<br> <br> That looks like a pretty good implementation of the block-based approach<br= > which Siping wanted to implement. The only problem from Siping&#39;s point = of<br> view is that it uses the two functions PV_BinShift() and PV_PhaseShift(),<b= r> which are not defined here and may rely on the fact that (in this example)<= br> the FFT size is an exact multiple of the window length. If that is an issue= <br> (or if the 2048-sample length window is important) then Siping would have t= o<br> redefine the problem.<br> <br> I presume the 160-sample blocks were originally specified to keep the<br> real-time processing delay short. Is that correct, Siping? If so then a<br> 2048-sample window is probably not acceptable.<br> <br> Steve<br> <div><div class=3D"h5"><br> &gt; -----Original Message-----<br> &gt; From: Julius Smith [mailto:<a href=3D"mailto:jos@xxxxxxxx">j= os@xxxxxxxx</a>]<br> &gt; Sent: Saturday, January 26, 2013 8:08 PM<br> &gt; To: Steve Beet<br> &gt; Cc: <a href=3D"mailto:AUDITORY@xxxxxxxx">AUDITORY@xxxxxxxx= CA</a><br> &gt; Subject: Re: Frequency shift to alleviate acoustic feedback<br> &gt;<br> &gt; Hi All,<br> &gt;<br> &gt; I don&#39;t know if this will help or confuse things, but here is<br> &gt; a pretty smooth frequency-shifting implementation in SuperCollider:<br= > &gt;<br> &gt; // Frequency-Shifting Example 5: Add phase-correction<br> &gt; // =A0 MouseX =3D amplitude<br> &gt; // =A0 MouseY =3D frequency shift (400 * (2 ** MouseY(-1,1)) in [200,8= 00])<br> &gt; // =A0 MouseButton =3D clear frequency shift<br> &gt; // START WITH MOUSE NEAR THE LEFT OF YOUR SCREEN<br> &gt; (<br> &gt; x =3D {<br> &gt; var in, out, amp, f0=3D400, fftSize=3D8192, winLen=3D2048, hopFrac=3D0= .5,<br> &gt; chain, mexp, fScaled, df, binShift, phaseShift,<br> &gt; inWinType=3D0, outWinType=3D0;<br> &gt; amp =3D MouseX.kr(-60,10).dbamp;<br> &gt; in =3D SinOsc.ar(f0,0,amp);<br> &gt; chain =3D FFT(LocalBuf(fftSize), in, hopFrac, inWinType, 1, winLen);<b= r> &gt; mexp =3D MouseY.kr(-1.0,1.0);<br> &gt; mexp =3D mexp*(1-MouseButton.kr);<br> &gt; fScaled =3D f0 * (2.0 ** mexp);<br> &gt; df =3D fScaled - f0;<br> &gt; binShift =3D fftSize * (df / s.sampleRate);<br> &gt; chain =3D PV_BinShift(chain, stretch:1, shift:binShift, interp:1);<br> &gt; phaseShift =3D 2 * pi * binShift * hopFrac * (winLen/fftSize);<br> &gt; chain =3D PV_PhaseShift(chain, phaseShift, integrate:1);<br> &gt; out =3D IFFT(chain,outWinType,winLen);<br> &gt; Out.ar(0, out.dup);<br> &gt; }.play<br> &gt; )<br> &gt;<br> &gt; - Julius<br> &gt;<br> &gt; At 04:48 AM 1/25/2013, Steve Beet wrote:<br> &gt;<br> &gt;<br> &gt; =A0 =A0 =A0 Dear Siping,<br> &gt;<br> &gt; =A0 =A0 =A0 I&#39;d agree with Dick&#39;s simplification, except to no= te<br> &gt; that *if* you can assume that the listeners are not sensitive<br> &gt; to phase, then frequency shifting is actually very easy - you<br> &gt; merely have to ensure phase continuity at block boundaries,<br> &gt; or (my preferred approach) do the processing sample-by-sample<br> &gt; using a direct analogue of the traditional EE approach:<br> &gt; heterodyning followed by linear filtering.<br> &gt;<br> &gt; =A0 =A0 =A0 I&#39;ve also just remembered one reference which is<br> &gt; relevant to this, and should give you some idea of the issues<br> &gt; involved in manipulating an audio signal in terms of the<br> &gt; frequencies, amplitudes and phases of its components:<br> &gt;<br> &gt; =A0 =A0 =A0 R.J. McAulay, T. F. Quartieri; &quot;Speech<br> &gt; analysis/synthesis based on a sinusoidal representation&quot;;<br> &gt; IEEE Trans. on Acoust., Speech and Signal Proc., vol ASSP-34,<br> &gt; pp. 744-754, 1986.<br> &gt;<br> &gt; =A0 =A0 =A0 Good luck,<br> &gt;<br> &gt; =A0 =A0 =A0 Steve<br> &gt;<br> &gt;<br> &gt;<br> &gt;<br> &gt; =A0 =A0 =A0 On Thu, 24 Jan 2013 22:41:05 -0800<br> &gt; =A0 =A0 =A0 &quot;Richard F. Lyon&quot; &lt;<a href=3D"mailto:dicklyon= @xxxxxxxx">dicklyon@xxxxxxxx</a>&gt; wrote:<br> &gt;<br> &gt; =A0 =A0 =A0 &gt; To put it more simply, the original assumption that<b= r> &gt; frequency shifting<br> &gt; =A0 =A0 =A0 &gt; would be &quot;the simplest method&quot; was unfounde= d.<br> &gt; =A0 =A0 =A0 &gt; Frequency shifting is actually quite complicated,<br> &gt; subtle, error prone, and<br> &gt; =A0 =A0 =A0 &gt; not so well defined.<br> &gt; =A0 =A0 =A0 &gt;<br> &gt; =A0 =A0 =A0 &gt; Dick<br> &gt; =A0 =A0 =A0 &gt;<br> &gt;<br> &gt;<br> &gt; Julius O. Smith III &lt;<a href=3D"mailto:jos@xxxxxxxx">jos@xxxxxxxx= ccrma.stanford.edu</a>&gt;<br> &gt; Prof. of Music and Assoc. Prof. (by courtesy) of Electrical<br> &gt; Engineering<br> &gt; CCRMA, Stanford University<br> </div></div>&gt; <a href=3D"http://ccrma.stanford.edu/~jos/" target=3D"_bla= nk">http://ccrma.stanford.edu/~jos/</a> &lt;<a href=3D"http://ccrma.stanfor= d.edu/~jos/" target=3D"_blank">http://ccrma.stanford.edu/~jos/</a>&gt;<br> &gt;<br> </blockquote></div><br> --e89a8fb1f07c13fed604d44f866e--


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