Masood_786
Junior Member level 2
- Joined
- Dec 21, 2010
- Messages
- 21
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,488
Hi
I have downloaded I/Q samples of AM modulated signals (Radio broadcast) that contains 2 stations. one centered at 0 Khz and other at 8 Khz.
I am able to play 0 Khz stations by demodulation. now i want to shift (down-conversion) the 8 Khz signal to 0 Khz. I understand the process and studied various books but by applying what i have studied i am unable to shift frequency. I have done the following
Fs=22050
Fc=-8000 // 8Khz to be shifted to 0 Khz
ph_inc=(2*PI*FC/Fs) for NCO
LO_ph_acc=0
fptr[1024] //it contains I and Q samples interleaved
then in loop i do following
for(int a=0; a<samples_count*2;a+=2)
{
i = fptr[a];
q = fptr[a+1];
LO_ph_acc+=LO_Ph_Inc;
if(LO_ph_acc> (2 * PI) )
LO_ph_acc-=(2 * PI);
i=(i * cos(LO_ph_acc)) - (q* (sin(LO_ph_acc) ) );
q=(q* cos(LO_ph_acc))- (i* (sin(LO_ph_acc) )) +
newfrq[a]=i; //still the frequency is not shifted
newfrq[a+1]=q;
}
In SDR applications like SDRSharp, two stations can be seen and even 8 Khz station shifted to 0 Khz when selected for shifting. Can any one tell mistake in the code.
I have downloaded I/Q samples of AM modulated signals (Radio broadcast) that contains 2 stations. one centered at 0 Khz and other at 8 Khz.
I am able to play 0 Khz stations by demodulation. now i want to shift (down-conversion) the 8 Khz signal to 0 Khz. I understand the process and studied various books but by applying what i have studied i am unable to shift frequency. I have done the following
Fs=22050
Fc=-8000 // 8Khz to be shifted to 0 Khz
ph_inc=(2*PI*FC/Fs) for NCO
LO_ph_acc=0
fptr[1024] //it contains I and Q samples interleaved
then in loop i do following
for(int a=0; a<samples_count*2;a+=2)
{
i = fptr[a];
q = fptr[a+1];
LO_ph_acc+=LO_Ph_Inc;
if(LO_ph_acc> (2 * PI) )
LO_ph_acc-=(2 * PI);
i=(i * cos(LO_ph_acc)) - (q* (sin(LO_ph_acc) ) );
q=(q* cos(LO_ph_acc))- (i* (sin(LO_ph_acc) )) +
newfrq[a]=i; //still the frequency is not shifted
newfrq[a+1]=q;
}
In SDR applications like SDRSharp, two stations can be seen and even 8 Khz station shifted to 0 Khz when selected for shifting. Can any one tell mistake in the code.