DSPRelated.com
Forums

Shift frequency of an audio signal

Started by Frank April 8, 2004
On Thu, 8 Apr 2004, Frank wrote:

> Hi all (especially Ian), > > So, what you're suggesting boils down to the following: > > 1. I make the signal analytic, ie. I run the speech signal through a > Hilbert transformer and combine it with the original signal into a > complex signal. > > 2. I multiply that by the complex exponential corresponding to the > frequency shift > > 3. I discard the imaginary sequence and take the real part as my > output signal.
This is basically the same procedure i described. :)
> I'm not sure if I got this right, especially (3) which seems to simple > to me. Why would I do the complex multiply if I throw away half of the > result anyway...?
Yes, you don't need the imaginary part in the end so you don't have to calculate the complete complex product. But you DO need it for the complex multiplication because it contribues to the real part. Consider x(t) is your original signal and y(t) is the 90� shifted version then z(t) = cos(t*pi*m) x(t) + sin(t*pi*m) y(t) is a frequency shifted version (shifted by m) The hilbert transform could be done with an IIR filter the cos/sin thing is an quadrature oscillator, you can calculate these coefficients iterativly by using this: cos((t+1)m) = cos(tm)^2-sin^2(tm) sin((t+1)m) = 2*sin(tm)*cos(tm) (compensate for rounding errors after some steps, i.e. make sure that sin^2+cos^2=1) ;) HTH, Sebastian -- PGP-Key-ID (long): 572B1778A4CA0707
Frank wrote:

> Hi all (especially Ian), > > thanks for the comments and ideas. > > Yes I'm positive that I want a frequency shift - NOT a pitch shift. > I've been on dspdimension.com and thats NOT what I want. > > I cannot do a FFT because that eats too much horsepower and I want to > be able to shift the frequency gradually, not discreetely (ie. by 1/10 > Hz if possible). > > So, what you're suggesting boils down to the following: > > 1. I make the signal analytic, ie. I run the speech signal through a > Hilbert transformer and combine it with the original signal into a > complex signal. > > 2. I multiply that by the complex exponential corresponding to the > frequency shift > > 3. I discard the imaginary sequence and take the real part as my > output signal.
Yes. But if you haven't the time to compute an FFT, this may cost too much also. Basically, the problem is hard.
> I'm not sure if I got this right, especially (3) which seems to simple > to me. Why would I do the complex multiply if I throw away half of the > result anyway...?
Because (a+jb)*(c+jd) doesn't equal a*c. But there are simplifications that do work.
> Thanks again for any insight you can provide! > --Frank
-- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Richard Dobson wrote:

> Ah right - I hadn't thought of that application. I am aware in a most > general way of this technique (never had occasion to use it), but it > never occurred to me that it would be an additive shift of N Hz across > the spectrum, which would produce the inharmonicity I described. Even a > shift of 5Hz at 110 Hz (as per the OP) is far from small - almost a > semitone, and I would expect that to be intrusive for anything. A 5hz > shift at 1000Hz is a different matter. It is all down to whether or not > you are preserving intervals between partials. My understanding is > insuffficient to deduce from your recipes which it is, but as I said, I > had always assumed it was a full pitch shift (e.g. measured in Cents), > so there is no warping of intervals between harmonics. The latter might > be tolerable for speech, but would surely be intolerable for instruments. > > Richard Dobson
For PA work, the decade from .3 to 3 KHz is adequate, and it's reasonable to make a quadrature shifter even with analog techniques in that range. Even in the range of .1 20 5 KHz, a 5 Hz shift leaves a speaker's voice very recognizable and clear. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
On Thu, 8 Apr 2004, Sebastian Gesemann wrote:

> cos((t+1)m) = cos(tm)^2-sin^2(tm) > sin((t+1)m) = 2*sin(tm)*cos(tm)
Sorry, this is wrong. But you'll figure it out. bye, Sebastian -- PGP-Key-ID (long): 572B1778A4CA0707