modulation using Weaver method in Real time
2 ビュー (過去 30 日間)
古いコメントを表示
I am attempting to modulate my voice in real time using the Weaver method. When I plot the output however, the graph does not appear to line up with the sound I make. I am unclear what the error in my code is.
micReader=audioDeviceReader;
speakerWriter=audioDeviceWriter;
fileWriter=dsp.AudioFileWriter;
spectAnalyzer=dsp.SpectrumAnalyzer;
fileReader=dsp.AudioFileReader;
tic;
while (toc<2)
audio=micReader();
speakerWriter(audio)
fileWriter(audio)
step(audio,Fs)
%Initial variables settings
Fs_min = 300;%minimum frequency
Fs_max =5000; %maximum frequency
channelCarrierFreq = 20000;%carrier frequency
magCarriers = 2; %magnitude of the carrier
%sampleFreq=100000; %sample frequency
messageFrequency=audio;
%messageFrequency=1000;
tt=numel(audio);
%sampleFreq=10*(channelCarrierFreq+messageFrequency);
sampleFreq=44100;
samplePerPeriod=sampleFreq/messageFrequency;
%length=[0:samplePerPeriod-1]/sampleFreq;
%samplePerPeriod=sampleFreq/messageFrequency;
%Signal=0.5*messageFrequency*cos(2*pi*messageFrequency*length)
Signal=0.5*messageFrequency.*cos(2*pi*messageFrequency*tt)
%messageFrequency = repmat(Signal',100,1);
%Sequence=messageFrequency;
Sequence=Signal;
%[num,den] = ellip(7,1,60,2*Fs_max/sampleFreq);
%Filtered_Sequence = filter (num,den,Sequence);
Filtered_Sequence=Sequence;
upper=1;
lower=-1;
t=[1:numel(Sequence)]./sampleFreq; % Time vector
fstCarrierFreq=(Fs_min +Fs_max)/2;
envelope = Filtered_Sequence; % Improper designation here but easy for future plot
% if get(handles.MatlabModulestoggle,'Value') == 0
% num =firFilter(-fstCarrierFreq,fstCarrierFreq,30,sampleFreq,'Blackman',handles);
% den = 1;
% else
%end
%MODULATION%MODULATION%MODULATION%MODULATION%MODULATION%MODULATION%MODULATION%MODULATION
%qq=fstCarrierFreq./sampleFreq
qq=0.0126;
[num,den] = ellip(7,1,60,2*qq);
par2=(magCarriers*cos(2*pi*fstCarrierFreq.*t'))
Env_I = filter (num,den,Filtered_Sequence.*par2 ); % Complex envelope chanel I
Env_Q = filter (num,den,Filtered_Sequence.* (magCarriers*sin(2*pi*fstCarrierFreq.*t'))); % complex envelope chanel Q
Iupper = Env_I .* (magCarriers*cos(2*pi*(channelCarrierFreq + upper*fstCarrierFreq).*t'));
Qupper = Env_Q .* (magCarriers*sin(2*pi*(channelCarrierFreq + upper*fstCarrierFreq).*t'));
modltCarrier = -(Iupper + Qupper); % SSB-USB
Ilower = Env_I .* (magCarriers*cos(2*pi*(channelCarrierFreq + lower*fstCarrierFreq).*t'));
Qlower = Env_Q .* (magCarriers*sin(2*pi*(channelCarrierFreq + lower*fstCarrierFreq).*t'));
LowermodltCarrier = Ilower - Qlower; % SSB-LSB
%DEMODULATION%DEMODULATION%DEMODULATION%DEMODULATION%DEMODULATION%DEMODULATION%DEMODULATION
subplot(3,1,1)
plot(t,audio);
subplot(3,1,2)
plot(t,LowermodltCarrier);
subplot(3,1,3)
plot(t,modltCarrier);
end
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Manage Products についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!