Frequency modulation to a digital signal

5 Ansichten (letzte 30 Tage)
Haman Siu
Haman Siu am 25 Feb. 2018
Kommentiert: Haman Siu am 25 Feb. 2018
So I have a digital sound signal that i am trying to have its frequency being modulated by a sinusoidal waveform. I tried to used the following code to create the effect but then realize that all it does is moving samples around creating noise rather than creating the effect that i wish to create does anyone have any idea how to create a piece of code to apply FM to a digital audio file?
[x,Fs]=audioread('Guitar sample file.wav');
duration = size(x);
index = 1 : length(x);
time_delay = 0.04;
delay = ceil(time_delay*Fs);
Fc = 20;
a= 1;
b= 1;
modulation_argument = 2*pi*Fc/Fs
;
for i= delay+1:1:duration
modulation(i)=sin(modulation_argument*i);
delay2 = round(delay + modulation(i));
d=(i-delay2);
z(i) = a*x(d);
end;

Antworten (1)

John BG
John BG am 25 Feb. 2018
Hi Haman
1.
do you want to use the function fmmod?
y = fmmod(x,Fc,Fs,freqdev)
It does the job and save you time.
Fs is the frequency of the modulating tone.
.
2.
You can shift the phase (< 1 cycle) a constant value adding the optional phase shift.
y = fmmod(x,Fc,Fs,freqdev,ini_phase)
.
3.
If interested to know more how does fmmod work then check
.
4.
Use fmdemod to FM demodulate, either to recover signal, or just to check fmmod works ok.
.
5.
Also, perhaps you would like to switch to Simulink.
Simulink has a really powerful array of blocks for signals modulation.
.
6.
A few toolboxes that you may find interesting:
Communications Toolbox:
DSP Systems Toolbox:
.
Haman
f you find this answer useful would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance
John BG
  1 Kommentar
Haman Siu
Haman Siu am 25 Feb. 2018
I do not have access to the fmmod function as its not included in my licence and I am working with the code for a project, so simulink is not an option for me

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by