0
$\begingroup$

As I was learned in signal processing, modulation took the signal spectrum to higher frequency range, so I made an experiment for audio file. The audio file "handel.ogg" plays a small part of music "hallelujah". I was expected that I would hear higher frequency or higher tone of the modulated sound than the unmodulated one when I played the modulated sound, but it didn't.

Why the thing that frequencies in spectrum get higher doesn't mean that the tone or the frequency of signal will get higher? Can someone tell me what's difference, thank you.

Here is my code:

clear;
clc;

% handel.ogg is a sample audio file in matlab.
[x, fs]=audioread('handel.ogg');

% carrier frequency
fc = 100;

% modulated signal
time = (1:numel(x))/fs;
x_modulated = x.*exp(1j*2*pi*fc*time');

% play the music
sound(real(x_modulated), fs)
$\endgroup$
1
$\begingroup$

Eventhough your expectation is sensible on the surface, once you think deeper into audio signals, you'll see that modulation of audio in that way will not produce the expected sonic result. Furthermore your implementation is also wrong.

Consider the audio spectrum; it has two conjugate symmetric lobes into the positive and negative frequencies each about $W$ kHz denoting the bandwidth of your audio. And lower frequency band between $-20$ Hz and $20$ Hz is empty.

First note that you should keep this symmetry in the frequency domain if you want to listen to the modulated bare audio. Your multiplication of a single complex exponential completely destroys the spectral symmetry. [edit: as @DanBoschen reminded, you take the real part of the multiplication so that spectral symmetry is preserved!]. Nevertheless, it's cheaper to multiply with a cosine than a complex exponential, so you better multiply with a cosine() waveform instead of multiplying with a single complex exponential and taking real part of it.

Second, even if the audio is multipleid with a cosine waveform, a shift of $100$ Hz simply creates a huge overlap in the spectrum resulting in aliasing distortion; i.e., shifting of the spectrum to right and left by $100$ Hz creates right and left lobes to cosite on each other, creating terrible aliasing. To prevent this, you can, in principle, apply separate shifts of left and right single side lobes independently and then sum the result.

Third, even if you do this perfectly, you will not get what you expect as the harmonicity of the audio spectrum is also distorted. The fundamental frequencies and their corresponding higher harmonics do not align on proper places. You should have scaled the frequency axis instead, but you have only linearly shifted the spectrum. To numerically see the effect, consider three harmonic frequencies in the original spectrum at, say, fundemantal at 120, and hamronics 240, and 480 Hzs. When you shift them by, say, 1499 Hz, the new frequencies will be 1619, 1739, and 1979 Hzs. And this new set is not harmonic anymore; i.e., they won't sound natural...

If you want to listen to the same audio at a higher pitch, then you can play with the output DAC sampling frequency. It will strecth the spectrum correctly keeping the harmonicity intact and prevent aliasing also, but it will change the duration of the playback...

$\endgroup$
  • $\begingroup$ since he took the real part of the result, he needn’t multiply by a cosine wave- the result would be the same! $\endgroup$ – Dan Boschen Dec 3 at 14:03
  • 1
    $\begingroup$ @DanBoschen yes indeed !! I have possibly just skipped the real part extraction. Thanks for pointing out... $\endgroup$ – Fat32 Dec 3 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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