I'm attempting to use a frequency mixer to shift one frequency range to another. Right now, I have a complex sine wave at $43\ \rm kHz$. My imaginary value on the complex object is 0.
If I output a frequency-amplitude spectrum it looks like this:
Now let's say I want to move that frequency to $65\ \rm kHz$. For that I realized that I need to create a new complex sine wave at that frequency and multiply it by my original signal in time.
The problem is, it's not working. I'm getting 2 spikes for some reason. I don't understand why that happens.
Here is my code:
typedef std::complex<float> Complex; Complex chunk[N]; float Fs = 176400; // How many time points are needed i,e., Sampling Frequency const double T = 1 / Fs; // At what intervals time points are sampled float value; float value2; for (int i = 0; i < N; i++) { value2 = (float)(1 * sin(2 * M_PI * 43000 * (i * T))); // Original Signal Complex value3 = {(float)(1 * sin(2 * M_PI * 12000 * (i * T))), 0}; // The frequency I want to add double multiplier = 0.5 * (1 - cos(2*M_PI*i/256)); // Hamming Window chunk[i] = {value2 * multiplier, 0 };// generate (complex) sine waveform chunk[i] = chunk[i] * value3; // Frequency Mixer } 
