-1
$\begingroup$

What I need is to invert a signal (on spectrogram it would look like a vertical flip) of a WAV file. Actually, of a bandpass of a signal - from 500 to 800 Hz, for example.

This image will perfectly explain what I mean: This is what I want to do

I am using C#, NWaves and R language (seewave library). But I can consider any language, tool, library or software to achieve it. I just need to find any way to do it.

If it can be done using R, this is a bandpass I am using:

LF.croak <- ffilter(bull, f = [email protected], channel = 1, from = startFreq, to = endFreq, bandpass = TRUE, custom = NULL, wl = 4096, ovlp = 90, wn = "hanning", fftw = FALSE, rescale=FALSE, listen=FALSE, output="Wave")

If it can be done using Nwaves, this is the signal and where we start:

DiscreteSignal signal = waveContainer[Channels.Left];

Any help or hint will be appreciated!

$\endgroup$

1 Answer 1

0
$\begingroup$

If you have a real signal signal is $x_n$, then $x_n' = (-1)^n \, x_n$, by the convolution theorem $X'(f) = X(f_s/2-f)$, and you also have frequency aliasing, as a result. $X'(f)$ is the complex conjugate of $X(f)$ flipped, in the spectrogram you are looking at the magnitude of the spectrum, so you should have your spectrum flipped.

$\endgroup$
2
  • $\begingroup$ Thank you for the answer. But its quite hard for me since I'm not into this theory... What I've managed to do for now is to actually invert it (the band) the way I want by multiplying every other sample by -1: float[] real = bandPassedUpperCarrier.Samples; for (int i = 0; i < real.Length; i++) { if (i % 2 == 0) real[i] = real[i] * -1; } But the problem is that my band (from 2320Hz to 2440Hz) has been shifted upper and is now from 16332Hz to 16412Hz. How do I avoid it and keep it within the same frequency range (from 2320Hz to 2440Hz)? Shift it back down? (I can do it using R) $\endgroup$
    – Ivan G
    Commented Dec 4, 2022 at 13:03
  • $\begingroup$ Yes, it will flip the band around $f_s/4$, so you could downsample your signal to a frequency 4x the center around which you want to flip. $\endgroup$
    – Bob
    Commented Dec 5, 2022 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.