Frequency modulation to a digital signal

조회 수: 13 (최근 30일)
Haman Siu
Haman Siu 2018년 2월 25일
댓글: Haman Siu 2018년 2월 25일
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;

답변 (1개)

John BG
John BG 2018년 2월 25일
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
Haman Siu
Haman Siu 2018년 2월 25일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Modulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by