performing a deconvolution on signals
35 ビュー (過去 30 日間)
古いコメントを表示
i took 2 signals and convolved them to encrypt the signal, how can i separate the 2 audios using a known audio?
% this project is a door locking and unlocking mechanism using an audio
% file , by taking an input form a user we store the file in the memory
% then we encrypt it with another audio file using convolution, the user
% enters the audio file 2 , in this case the chicken sound into the door
% and using deconcolution we decrypt the signal once again
% first we record an audio to store in matlab
recObj = audiorecorder
recDuration = 5;
disp("Begin speaking.")
recordblocking(recObj,recDuration);
disp("End of recording.")
play(recObj);
y = getaudiodata(recObj);
plot(y);
% we read the audio file 2 that we have stored on our device
[audio2,fs] = audioread('chicken-2.wav');
% we take the audio from file transform it to the frequency domain
W=length(audio2);
b=(1/W)*ones(1,W);
F= fft(audio2);
H1= fftshift(F);
S1 = log(1+abs(H1));
figure(1);plot(S1);
title('Fourrier transform of audio 1')
% we filter and fourier transform the audio we recorded
W2=length(y);
b2=(1/W2)*ones(1,W2);
a2=1;
audiohe1=filter(b2,a2,audio2);
F2= fft(audio2);
H2= fftshift(F2);
S2 = log(1+abs(H2));
figure(2);
plot(S2);
title('Fourrier transform of audio 2')
%bow we have to make them the same lengh
% this is useful to encrypt the signal and to compare the signals later
%make both signals same size
if W>W2
S1=resample(S1,W,W2);
end
if W<W2
S2=resample(S2,W,W2);
end
figure
aud_pad = cat(1,y(:,1),zeros(7890000,1)); %we pad the audios with zeros
aud_pad2 = cat(1,audio2(:,1),zeros(458383,1));
aconv=conv(y(:,1),audio2(:,1));
sound(aconv)
plot(aconv);
title('Convolutions');
s5 = ifft(aconv);
plot(s5);
title('signal in time domain')
%now the sound is ecrypted all what we have left to do is deconvolve
2 件のコメント
Image Analyst
2022 年 11 月 23 日
OK, thanks for the announcement. Good luck with it. 🙂
If you have a question, just ask it.
回答 (1 件)
Sai Kiran
2022 年 12 月 23 日
Hi,
I understand that you want to seperate two audio files from the encrypted audio using one of the known audio file.
To perform deconvolution, you can use the deconv function in MATLAB.
This function takes the convolved signal and the known signal as inputs and returns the original signals as output.
For example, to separate the two signals in your code, you can use the following lines of code:
[audio_1,audio_2] = deconv(aconv,audio_2);
This will give you the original signals audio_1 and audio_2 that were used to produce the convolved signal aconv.
I hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Audio and Video Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!