[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Frequency shift to alleviate acoustic feedback



Dear all

On 26/01/2013 22:48, Steve Beet 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.

SuperCollider is open source
so this is not a very difficult problem to investigate here

http://supercollider.sourceforge.net/

Besides that I would like to mention that frequency shifting by ~31Hz,
as was intended in the original post, is pretty much. As frequency
shifting destroys the harmonic relation of the partials of the sound
signal it can introduce systematic artifacts. For me, using speech
signals), artifacts are hardly perceivable  if frequency shifting is
well below 8Hz. But this depends obviously on the sound material you
need to shift.

For  4Hz shifting you would need a FFT size of about 4096 for 16kHz
sample rate which requires zero padding but does not introduce
additional latency.

best
Axel

> 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@xxxxxxxxxxxxxxxxxx] 
>> Sent: Saturday, January 26, 2013 8:08 PM
>> To: Steve Beet
>> Cc: AUDITORY@xxxxxxxxxxxxxxx
>> 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@xxxxxxx> 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@xxxxxxxxxxxxxxxxxx>
>> Prof. of Music and Assoc. Prof. (by courtesy) of Electrical 
>> Engineering
>> CCRMA, Stanford University
>> http://ccrma.stanford.edu/~jos/ <http://ccrma.stanford.edu/~jos/>  
>>
> 


-- 
Axel Roebel
Head of the Analysis/Synthesis Team, IRCAM
Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540