Reply by JAlbertoDJ September 17, 20092009-09-17
>BPF filter from 1khz to 1250khz, then mix with an NCO set to 1khz? > >Chris > >>I have a audio signal from 1000Hz to 1250Hz with samplerate of 8000Hz. >> >>But i want translate the signal to the range: 0-250 Hz. >> >>Then i could resampling to 1000Hz, for example, with a low pass filter >>(antialiasing) with Fc=500Hz. >> >>¿How can i translate frecuency from 1000Hz to 0Hz? >>
I tell you what i have done (just this afternoon) and run. Instead of doing Hilbert of halfband, i do Hilbert filtering from 1000 to 1250Hz (but now we need more coefficients in the filter): Call bp_FIR(Longitud, 0, 0.12, 0.16) In Phase Call bp_FIR(Longitud, 1, 0.12, 0.16) In Quadrature After, i do decimation by 8 and then frecuency go from 0 to 250Hz with Fs=1000Hz After, i mix with a NCO, but only for little desviations of the carriers (between 1 to 8Hz, typically).
Reply by thestruuus September 17, 20092009-09-17
BPF filter from 1khz to 1250khz, then mix with an NCO set to 1khz? 

Chris

>I have a audio signal from 1000Hz to 1250Hz with samplerate of 8000Hz. > >But i want translate the signal to the range: 0-250 Hz. > >Then i could resampling to 1000Hz, for example, with a low pass filter >(antialiasing) with Fc=500Hz. > >¿How can i translate frecuency from 1000Hz to 0Hz? > > >
Reply by JAlbertoDJ September 16, 20092009-09-16
> >cool. how're you doing your Hilbert Transform? a simple FIR? and >you're delaying your in-phase signal by the same amount of delay you >have in your causal HT? > >just curious. > >r b-j >
I do two BandPass FIR Filters of lenght=37, but shift by 90 degrees. Then, delay is the same in both branchs. ifilter() is the vector of coefficients for real part. qfilter() is the vector of coefficients for imaginary part. This is the Visual Basic Code: Call BandPass_FIR(37, 0, 0.05, 0.45) For I = 0 To longitud - 1 ifilter(I) = fir(I) ' In Phase Next I Call BandPass(37, 1, 0.05, 0.45) For I = 0 To longitud - 1 qfilter(I) = fir(I) ' In Quadrature Next I Private Sub BandPass_FIR(longitud As Integer, Hilbert As Integer, f1 As Single, f2 As Single) Dim t As Single Dim h As Single Dim x As Single Dim I As Integer For I = 0 To longitud - 1 t = I - (longitud - 1#) / 2# h = I * (1# / (longitud - 1#)) If (Hilbert = 0) Then x = (2 * f2 * sinc(2 * f2 * t) - 2 * f1 * sinc(2 * f1 * t)) * hamming(h) Else x = (2 * f2 * cosc(2 * f2 * t) - 2 * f1 * cosc(2 * f1 * t)) * hamming(h) x = -x End If fir(I) = x Next I End Sub
Reply by robert bristow-johnson September 16, 20092009-09-16
On Sep 15, 7:54&#4294967295;pm, "JAlbertoDJ" <nietoro...@yahoo.es> wrote:
> >it's not equivalent. &#4294967295;your form above deals only with shifting the > >spectrum, both positive and negative frequencies in one direction (and > >leaves a complex result, you need a real result). &#4294967295;my form splits the > >positive and negative frequency halves, moves one up by f0 and the > >other down by f0. > > > OK, it's true. I am seeing it is done like you are described because he > does two channels, one in phase and the other in quadrature (Hilbert). > After he multiply by (cos+jsen). > > I have run it and now the Automatic Frecuency Control converge very well. > Before, with my method did not converge. > > Thank you very much.
cool. how're you doing your Hilbert Transform? a simple FIR? and you're delaying your in-phase signal by the same amount of delay you have in your causal HT? just curious. r b-j
Reply by JAlbertoDJ September 15, 20092009-09-15
> >it's not equivalent. your form above deals only with shifting the >spectrum, both positive and negative frequencies in one direction (and >leaves a complex result, you need a real result). my form splits the >positive and negative frequency halves, moves on up by f0 and the >other down by f0. > >r b-j > >
OK, it's true. I am seeing it is done like you are described because he does two channels, one in phase and the other in quadrature (Hilbert). After he multiply by (cos+jsen). I have run it and now the Automatic Frecuency Control converge very well. Before, with my method did not converge. Thank you very much.
Reply by robert bristow-johnson September 15, 20092009-09-15
On Sep 15, 7:47&#4294967295;am, "JAlbertoDJ" <nietoro...@yahoo.es> wrote:
> >On Sep 13, 8:33=A0pm, "JAlbertoDJ" <nietoro...@yahoo.es> wrote: > >> >>I have a audio signal from 1000Hz to 1250Hz with samplerate of > 8000Hz. > > >> >>But i want translate the signal to the range: 0-250 Hz. > > >> >>Then i could resampling to 1000Hz, for example, with a low pass > filter > >> >>(antialiasing) with Fc=3D500Hz. > > >... > >> I have done this: > > >> Stream input: InputSound.Re (samples sound card) > >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 InputSound.Im ( 0 ) > > >you need to compute the Hilbert transform (or something approximating > >it) and stick that into the imaginary part, rather than 0. > > >> Then i multiply by complex exponencial: > > >> InputSound.Re =3D InputSound.Re * Cos(2 * Pi * 1000 * n / 8000) > >> InputSound.Im =3D InputSound.Re * -Sin(2 * Pi * 1000 * n / 8000) > > >and with a non-zero imaginary part, there will be cross-product terms > >that exist in both the real and imaginary part. > > >> Now, i could apply lowpass filter and decimate (but i have no done > >> decimating yet). > > >... > > >> I have seen similars applications and look like that it use a Hilbert > >> Filter before multiply by cos and sin. why ??????????? > > >because that's how frequency shifting is done. > > > &#4294967295; x(t) --.---->[delay]--------> u(t) =3D x(t-T) > > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;| > > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;| > > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;| > > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;'---->[delayed HT]---> v(t) =3D Hilbert{ x(t-T) } > > >the frequency-shifted signal is: > > > &#4294967295; &#4294967295;w(t) =3D (u(t) + j*v(t))/2 * exp(+j*2*pi*f0*t) > > > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;+ (u(t) - j*v(t))/2 * exp(-j*2*pi*f0*t) > > >where f0 is the positive amount of frequency shift. &#4294967295;your f0 would be > >-1000 Hz. &#4294967295;the first term is the positive frequencies being shift by > >f0 and the second term is the negative frequencies getting shifted by - > >f0. &#4294967295;if you do some very simple fanagalling with the math, you will > >see that (assuming x(t) is real), the expression above is purely real > >and equal to > > > &#4294967295; &#4294967295;w(t) =3D u(t)* cos(2*pi*f0*t) - v(t)*sin(2*pi*f0*t) > > >note there is no "j" in that expression. &#4294967295;but you need to have v(t) > >and u(t) be a Hilbert pair. > > >it turns out that since you have little or no energy in the bottom 1 > >kHz or above 1.25 kHz, the computational burden of the needed Hilbert > >transform will be low. &#4294967295;strictly speaking, the Hilbert transformer > >magnitude frequency response should be pretty flat all the way down to > >nearly 0 Hz (where it crosses over through the origin), but you can be > >pretty sloppy with your Hilbert transformer. &#4294967295;if you have MATLAB or > >access to it, you can design a pretty good HT that will have few taps > >because you can be sloppy with the bottom 1/4 of the frequency > >spectrum. &#4294967295;also, because you're not worried about the top 1000 Hz > >either, you can take advantage of "half-band symmetry" and every other > >tap in your HT is zero which will cut the cost in half. > > >but you need a Hilbert transformer that is flat from 1000 Hz to 1250 > >Hz (not a hard one to do) and then perform the real equation above, > >and you're shifted and ready to resample. > > >r b-j > > I am confused because i have seen an application that not use u(t), only > he do: > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;w(t)=v(t)*(cos+jsen) > > &#4294967295; Something like this: > > &#4294967295; &#4294967295; w(t).Re = v(t).Re * cos(2*pi*f0*t) - v(t).Im * sin(2*pi*f0*t) > &#4294967295; &#4294967295; w(t).Im = v(t).Re * sin(2*pi*f0*t) + v(t).Im * cos(2*pi*f0*t) > > &#4294967295;After, w(t).Re and w(t).Im are inserted in the FFT algorithm. > > &#4294967295;Is this form correct or equivalent?
it's not equivalent. your form above deals only with shifting the spectrum, both positive and negative frequencies in one direction (and leaves a complex result, you need a real result). my form splits the positive and negative frequency halves, moves on up by f0 and the other down by f0. r b-j
Reply by JAlbertoDJ September 15, 20092009-09-15
>On Sep 13, 8:33=A0pm, "JAlbertoDJ" <nietoro...@yahoo.es> wrote: >> >>I have a audio signal from 1000Hz to 1250Hz with samplerate of
8000Hz.
>> >> >>But i want translate the signal to the range: 0-250 Hz. >> >> >>Then i could resampling to 1000Hz, for example, with a low pass
filter
>> >>(antialiasing) with Fc=3D500Hz. >> >... >> I have done this: >> >> Stream input: InputSound.Re (samples sound card) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 InputSound.Im ( 0 ) >> > >you need to compute the Hilbert transform (or something approximating >it) and stick that into the imaginary part, rather than 0. > >> Then i multiply by complex exponencial: >> >> InputSound.Re =3D InputSound.Re * Cos(2 * Pi * 1000 * n / 8000) >> InputSound.Im =3D InputSound.Re * -Sin(2 * Pi * 1000 * n / 8000) >> > >and with a non-zero imaginary part, there will be cross-product terms >that exist in both the real and imaginary part. > >> Now, i could apply lowpass filter and decimate (but i have no done >> decimating yet). >> >... > >> I have seen similars applications and look like that it use a Hilbert >> Filter before multiply by cos and sin. why ??????????? > >because that's how frequency shifting is done. > > > x(t) --.---->[delay]--------> u(t) =3D x(t-T) > | > | > | > '---->[delayed HT]---> v(t) =3D Hilbert{ x(t-T) } > > >the frequency-shifted signal is: > > > w(t) =3D (u(t) + j*v(t))/2 * exp(+j*2*pi*f0*t) > > + (u(t) - j*v(t))/2 * exp(-j*2*pi*f0*t) > >where f0 is the positive amount of frequency shift. your f0 would be >-1000 Hz. the first term is the positive frequencies being shift by >f0 and the second term is the negative frequencies getting shifted by - >f0. if you do some very simple fanagalling with the math, you will >see that (assuming x(t) is real), the expression above is purely real >and equal to > > > > > w(t) =3D u(t)* cos(2*pi*f0*t) - v(t)*sin(2*pi*f0*t) > >note there is no "j" in that expression. but you need to have v(t) >and u(t) be a Hilbert pair. > >it turns out that since you have little or no energy in the bottom 1 >kHz or above 1.25 kHz, the computational burden of the needed Hilbert >transform will be low. strictly speaking, the Hilbert transformer >magnitude frequency response should be pretty flat all the way down to >nearly 0 Hz (where it crosses over through the origin), but you can be >pretty sloppy with your Hilbert transformer. if you have MATLAB or >access to it, you can design a pretty good HT that will have few taps >because you can be sloppy with the bottom 1/4 of the frequency >spectrum. also, because you're not worried about the top 1000 Hz >either, you can take advantage of "half-band symmetry" and every other >tap in your HT is zero which will cut the cost in half. > >but you need a Hilbert transformer that is flat from 1000 Hz to 1250 >Hz (not a hard one to do) and then perform the real equation above, >and you're shifted and ready to resample. > >r b-j >
I am confused because i have seen an application that not use u(t), only he do: w(t)=v(t)*(cos+jsen) Something like this: w(t).Re = v(t).Re * cos(2*pi*f0*t) - v(t).Im * sin(2*pi*f0*t) w(t).Im = v(t).Re * sin(2*pi*f0*t) + v(t).Im * cos(2*pi*f0*t) After, w(t).Re and w(t).Im are inserted in the FFT algorithm. Is this form correct or equivalent?
Reply by robert bristow-johnson September 15, 20092009-09-15
On Sep 13, 8:33&#4294967295;pm, "JAlbertoDJ" <nietoro...@yahoo.es> wrote:
> >>I have a audio signal from 1000Hz to 1250Hz with samplerate of 8000Hz. > > >>But i want translate the signal to the range: 0-250 Hz. > > >>Then i could resampling to 1000Hz, for example, with a low pass filter > >>(antialiasing) with Fc=500Hz. >
...
> I have done this: > > Stream input: InputSound.Re (samples sound card) > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; InputSound.Im ( 0 ) >
you need to compute the Hilbert transform (or something approximating it) and stick that into the imaginary part, rather than 0.
> Then i multiply by complex exponencial: > > InputSound.Re = InputSound.Re * Cos(2 * Pi * 1000 * n / 8000) > InputSound.Im = InputSound.Re * -Sin(2 * Pi * 1000 * n / 8000) >
and with a non-zero imaginary part, there will be cross-product terms that exist in both the real and imaginary part.
> Now, i could apply lowpass filter and decimate (but i have no done > decimating yet). >
...
> I have seen similars applications and look like that it use a Hilbert > Filter before multiply by cos and sin. why ???????????
because that's how frequency shifting is done. x(t) --.---->[delay]--------> u(t) = x(t-T) | | | '---->[delayed HT]---> v(t) = Hilbert{ x(t-T) } the frequency-shifted signal is: w(t) = (u(t) + j*v(t))/2 * exp(+j*2*pi*f0*t) + (u(t) - j*v(t))/2 * exp(-j*2*pi*f0*t) where f0 is the positive amount of frequency shift. your f0 would be -1000 Hz. the first term is the positive frequencies being shift by f0 and the second term is the negative frequencies getting shifted by - f0. if you do some very simple fanagalling with the math, you will see that (assuming x(t) is real), the expression above is purely real and equal to w(t) = u(t)* cos(2*pi*f0*t) - v(t)*sin(2*pi*f0*t) note there is no "j" in that expression. but you need to have v(t) and u(t) be a Hilbert pair. it turns out that since you have little or no energy in the bottom 1 kHz or above 1.25 kHz, the computational burden of the needed Hilbert transform will be low. strictly speaking, the Hilbert transformer magnitude frequency response should be pretty flat all the way down to nearly 0 Hz (where it crosses over through the origin), but you can be pretty sloppy with your Hilbert transformer. if you have MATLAB or access to it, you can design a pretty good HT that will have few taps because you can be sloppy with the bottom 1/4 of the frequency spectrum. also, because you're not worried about the top 1000 Hz either, you can take advantage of "half-band symmetry" and every other tap in your HT is zero which will cut the cost in half. but you need a Hilbert transformer that is flat from 1000 Hz to 1250 Hz (not a hard one to do) and then perform the real equation above, and you're shifted and ready to resample. r b-j
Reply by JAlbertoDJ September 14, 20092009-09-14
>Are you trying to generate an analytic signal to get phase measurements?
>Its a bit confusing because it seems like you are trying to do three
things
>at once (spectrum shift, resample, phase measure) but I'm not sure if
you
>really want to do all three. > >-Shawn > >
OK, i will try to explain better. I have a signal from 1000 to 1250 Hz (OFDM carriers). But, because of doppler effect, signal received is from 1003 to 1253Hz. With FFT phase measure i estimate that frecuency desviation is 3Hz. Then i need shift the spectrum by 3 Hz. (Frecuency syncronization is fundamental for my applycation, and 2 or 3 Hz is a important desviation). Next, i estimate frecuency desviation again and so on. Apart from this, i would like work in the range 0-250 hz, instead of 1000-1250Hz. But that is not basic in this moment.
Reply by Shawn Stevenson September 14, 20092009-09-14
>I have done this: > >Stream input: InputSound.Re (samples sound card) > InputSound.Im ( 0 ) > >Then i multiply by complex exponencial: > >InputSound.Re = InputSound.Re * Cos(2 * Pi * 1000 * n / 8000) >InputSound.Im = InputSound.Re * -Sin(2 * Pi * 1000 * n / 8000) > >Now, i could apply lowpass filter and decimate (but i have no done >decimating yet). > >And finally, i apply FFT to process the signal. > >My problem is: > >With FFT magnitude operations, for example the energy: >qrt((FFT(k).re*FFT(k).Re+FFT(k).Im*FFT(k).Im)) i have no problems, and >results are the same than without multiply by the complex exponencial
and
>the application run very well. > >But when i want use phase information, for example: atan((FFT(k).Im / >FFT(k).Re)) i have bigs problems. Now phase is always zero, i dont know >why. > >I have seen similars applications and look like that it use a Hilbert >Filter before multiply by cos and sin. why ??????????? > >Also, i could try the first option you have told me: bandpass filter and >keep every 16th sample of the filter output, but i dont know what will >happen with phase information. ????? > >I expect yours opinions, >thanks > >
I think your problem is that you are multiplying by a complex exponential to shift the spectrum instead of by a (real) cosine function. Your original signal (no imaginary part) will have power at -1250 Hz to -1000 Hz and 1000 Hz to 1250 Hz, plus the same pattern repeated at every integer multiple of 8000 Hz (6750 Hz to 7000 Hz and 9000 Hz to 9250 Hz, and on, and on). Once you multiply by the complex exponential and lowpass, the signal components will be at -250 Hz to 0 Hz (and all the replicates at multiples of 8000 Hz). You have ended up with a single-sided spectrum and lost the positive frequencies between 0 and 250 Hz. Are you trying to generate an analytic signal to get phase measurements? Its a bit confusing because it seems like you are trying to do three things at once (spectrum shift, resample, phase measure) but I'm not sure if you really want to do all three. -Shawn