If I want to amplify a certain frequency in a digital signal, can I just take the FFT, increase the real part of the value for the frequency I want (leaving the imaginary part alone), and then take the inverse FFT? I am wanting to do this to increase the frequency at which tones are detected, for a Morse code decoder.
A few reasons why this is a terrible idea:
- Unless your frequency is an exact multiple of the FFT window size, it'll be spread over adjacent FFT bins.
- You're mentioning Morse code, so your carrier is modulated. This is not a constant tone, it has a changing envelope, and thus, its spectrum is convolved by the spectrum of the envelope. As a result, you won't see just a spectral peak at the carrier frequency. Instead, it'll be spread over a frequency band proportional to the symbol rate.
- Selectively "editing" FFT coefficients is equivalent to multiplying the spectrum by a function with sharp edges, and thus is equivalent to convolving in the time domain by a window with lots of ripples - causing ringing (More on this here).
- Unless you want something ridiculously selective, a bandpass/peaking filter is cheaper in terms of computational cost. Moreover, using the FFT/IFFT approach on long signals (or in realtime) is possible only through the overlap-add method, which is less straightforward to implement than a filter.
Finally, there's no reason why you would want to leave the imaginary part unmodified.