How to distinguish male and female Voice by matlab
This article mainly introduces "how to distinguish male and female voices by matlab". In daily operation, I believe that many people have doubts about how to distinguish male and female voices by matlab. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to distinguish male and female voices by matlab". Next, please follow the editor to study!
Function man_or_woman (file) [xjingfs] = audioread (file);% read sound file% = time domain image = over time sound assigned concussion diagram data=x (:, 1);% take mono n=0:length (x)-1;% establish a signal equal length sequence time=n/fs;% establish time series as Abscissa figure (1) % figure 1: time domain waveform plot (time,data);% mapping title ('audio signal time domain map')% title xlabel ('time / s');% label Abscissa ylabel ('amplitude');% label ordinate grid on;% open grid lines% = frequency domain map = N=length (data) % take the length of the signal matrix Y1=fft (data,N);% N-point Fourier transform mag=abs (Y1);% take the mode fancin Fourier transform SNR N;% frequency sequence figure (2);% figure 2: spectral graph plot (f (1:fix (Nhand 2)), mag (1:fix (Nap2)); title ('audio signal fft spectrum') % title xlabel ('frequency / Hz');% label Abscissa ylabel (' amplitude');% label ordinate grid on;% Open gridlines% = pitch frequency extraction = [~, index] = max (data);% return maximum maximum index timewin=floor (0.015*fs); xwin=data (index-timewin:index+timewin); [YJing ~] = xcov (xwin); ylen=length (y) Halflen= (ylen+1) / 2 + 30 disp (halflen: ylen); [~, maxindex] = max (yy); fmax=fs/ (maxindex+30); disp ([file,' pitch is', num2str (fmax), 'Hz'])% = judge male and female voices by pitch frequency = if fmax