日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > 循环神经网络 >内容正文

循环神经网络

麦克风阵列matlab,双通道麦克风阵列方向采集MATLAB代码实现

發布時間:2023/12/8 循环神经网络 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 麦克风阵列matlab,双通道麦克风阵列方向采集MATLAB代码实现 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

總共有四個函數分別如下,導入采集到的音頻文件,設置好代碼讀取路徑就可以實現了。

第一個函數:采集系統

% In this program, the signals are divided in pieces of lengData samples

% and process separately. This program calls two functions:

% f_adap

% get_angle

% At the end it returns the direction in degrees.

% CONSTANT VALUES

i=0;

fs=44100; % Sampling frequency (Hz)

d_micro=0.1; % Distance between microphones (m)

c=340; % Speed of sound (m/s)

muestrasMAX=ceil(d_microfs/c); % Maximum number of samples Nmax

DESP=ceil(muestrasMAX1.5); % Delay we insert in the micro 2

% We leave 50% of margin of error.

lengData=441000.5; % Number of samples in which the voice

% signals are divided to be processed.

% All values depend on fs and d_micro in

% case it was necessary to change them.

% Importing the file to process.

signal1=audioread(‘60.wav’)’;% LOOP WHERE THE DIFFERENT PARTS OF THE IMPORTED FILE ARE PROCESSED

for k=lengData:lengData:length(signal1)

tic; % Measure of time tic;toc;

signal=signal1(1,k-(lengData-1):k); % Signal in MIC B

d=signal1(2,k-(lengData-1):k); % Signal in MIC A

% NORMALIZATION PROCESS

M1=max(abs(signal)); % Maximum of channel 1

M2=max(abs(d)); % Maximum of channel 2

M3=max(M1,M2); % Normalization value

signal=signal/M32; % Normalizing

d=d/M32;

% LMS ALGORITHM

hDESP=[zeros(1,DESP) 1]; % Filter to delay the signal DESP samples.

d1=conv(hDESP,d);

P=50; % Parameters of the algorithm

mu=0.0117;

h0=zeros(1,P); h0(1)=0; % Initialazing the adaptative filter

[h y e]=f_adap(signal,d1,h0,mu); % Recursive function calculating the

% coefficients of the filter h(n)

% PROCESSING THE FILTER BEFORE THE FREQUENCY ANALYSIS.

h1=[zeros(1,DESP-muestrasMAX-3),h(DESP-muestrasMAX-2:length(h))];

h1(DESP+muestrasMAX+2:length(h1))=0;

h1(DESP+1)=h1(DESP+1)/2;

[B,I]=sort(h1,‘descend’);

H1=[zeros(1,I(1)-3),h(I(1)-2:I(1)+2),zeros(1,length(h)-(I(1)+2))];

% FREQUENCY ANALYSIS TO OBTAIN THE DELAY (IN SAMPLES)

% 1-FFT

lh=128; % Length of the FFT

H=fft(h1,lh); % FFT of the filter h(n)

% 2-ANGLE(+UNWRAP)

alpha=angle(fftshift(H)); % Obtaining the phase

q=unwrap(angle(fftshift(H)));

% 3-SLOPE

M=diff(q); % Obtaining the slope of the phase

% 4-SLOPE’S AVERAGE

lM=length(M)+2; % The slope M1 is not a unique value,

p1=floor(lM/2-4); % it’s an array. So we calculate the

p2=ceil(lM/2+4); % average of the values, K.

K=mean(M(p1:p2));

Nprime=(-Klh/(2*pi)); % Number of samples before

% substracting DESP.

% 5-SAMPLES

if Nprime<0 % Two possible cases: negative or positive

N=Nprime+lh;

N=N-DESP;

else

N=Nprime;

N=N-DESP;

end

% CALLING THE FUNCTION WHICH RETURNS THE ANGLE

angleGRAD1=get_angle(N,fs,d_micro);

if isreal(angleGRAD1)==1 % Security measures in case

angleGRAD1 % the number is complex

i=i+1;

else

angleGRAD1=real(angleGRAD1)

i=i+1;

end

timeElapsed=toc; % Time is kept in variable timeElapsed

timeElapsed;

i

end

總結

以上是生活随笔為你收集整理的麦克风阵列matlab,双通道麦克风阵列方向采集MATLAB代码实现的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。