[Voice analysis] based on matlab voice short-time frequency domain analysis [including Matlab source code 558]

1. Introduction

Principle
1
Short Time Fourier Transform Short Time Fourier Analysis (Short Time Fourier Analysis, STFA) is suitable for analyzing the spectrum analysis of slow time-varying signals, and has been widely used in speech analysis and processing. The method is to divide the speech signal into frames first, and then perform Fourier transform on each frame. Each frame of speech signal can be considered to be cut out from various different stationary signal waveforms, and the short-time frequency spectrum of each frame of speech is an approximation of the frequency spectrum of each stationary signal waveform.

Since the speech signal is short-time stable, the speech can be divided into frames and the Fourier transform of a certain frame can be calculated, so that the short-time Fourier transform is obtained. It is defined as
Insert picture description here
Insert picture description here
③The shorter the window length, the higher the time resolution, but the frequency resolution will decrease accordingly. For example, using a short window can clearly observe the changes of formants in different pitch periods, but the fine structure of the fundamental frequency and harmonics disappears on the short-term spectrogram.
④ Due to the contradictory relationship between time resolution and frequency resolution, when performing short-time Fourier transform, the window length should be selected as a compromise based on the purpose of analysis.

2 Representation and realization method of
spectrogram The spectrograph is to send the electrical signal of the voice to a group of narrowband filters connected in sequence in frequency, and the output of each narrowband filter is rectified and the mean square is in the order of frequency from low to high. Record on a roll of recording paper. The strength of the signal is represented by the gray scale recorded on the paper. If the signal output by a certain filter is strong, the corresponding record will be darker; otherwise, it will be lighter. The recording paper rotates at a certain speed, which is equivalent to recording the corresponding filter output at different times. The resulting graph is the spectrogram of the speech signal. The horizontal direction is the time axis and the vertical direction is the frequency axis. The gray stripes on the graph represent the short-time spectrum of speech at each moment. The spectrogram reflects the dynamic spectrum characteristics of the speech signal and is called visual speech.

Second, the source code

clear all;
clc; 
close all;

[x,fs]=audioread('audio.wav');       % 读入数据文件
wlen=256;
nfft=wlen;
win=hanning(wlen);
inc=128;          % 给出帧长和帧移

y=STFFT(x,win,nfft,inc);        %求短时傅里叶变换

fn=size(y,2);                           %帧数

freq=(0:wlen/2)*fs/wlen;                % 计算FFT后的频率刻度

frameTime=FrameTimeC(fn,wlen,inc,fs); % 计算每帧对应的时间
imagesc(frameTime,freq,20*log10(abs(y)+eps)); % 画出Y的图像  
axis xy; ylabel('频率/Hz');xlabel('时间/s');
title('能量谱图');
function frameout=enframe(x,win,inc)

nx=length(x(:));            % 取数据长度
nwin=length(win);           % 取窗长
if (nwin == 1)              % 判断窗长是否为1,若为1,即表示没有设窗函数
   len = win;               % 是,帧长=win
else
   len = nwin;              % 否,帧长=窗长
end
if (nargin < 3)             % 如果只有两个参数,设帧inc=帧长
   inc = len;
end
nf = fix((nx-len+inc)/inc); % 计算帧数
frameout=zeros(nf,len);            % 初始化
indf= inc*(0:(nf-1)).';     % 设置每帧在x中的位移量位置
inds = (1:len);             % 每帧数据对应1:len

Three, running results

Insert picture description here

Four, remarks

Complete code or writing add QQ 1564658423 past review
>>>>>>
[Feature extraction] Audio watermark embedding and extraction based on matlab wavelet transform [Include Matlab source code 053]
[Speech processing] Voice signal processing based on matlab GUI [Include Matlab Source code issue 290]
[Voice acquisition] based on matlab GUI voice signal collection [including Matlab source code 291]
[Voice modulation] based on matlab GUI voice amplitude modulation [including Matlab source code 292]
[Speech synthesis] based on matlab GUI voice synthesis [including Matlab Source code issue 293]
[Voice encryption] Voice signal encryption and decryption based on matlab GUI [With Matlab source code 295]
[Speech enhancement] Matlab wavelet transform-based voice enhancement [Matlab source code 296]
[Voice recognition] Based on matlab GUI voice base frequency Recognition [Including Matlab source code 294]
[Speech enhancement] Matlab GUI Wiener filtering based voice enhancement [Including Matlab source code 298]
[Speech processing] Based on matlab GUI voice signal processing [Including Matlab source code 299]
[Signal processing] Based on Matlab speech signal spectrum analyzer [including Matlab source code 325]
[Modulation signal] Digital modulation signal simulation based on matlab GUI [including Matlab source code 336]
[Emotion recognition] Voice emotion recognition based on matlab BP neural network [including Matlab source code 349 Issue]
[Voice Steganography] Quantified Audio Digital Watermarking Based on Matlab Wavelet Transform [Include Matlab Source Code Issue 351]
[Feature extraction] based on matlab audio watermark embedding and extraction [including Matlab source code 350 period]
[speech denoising] based on matlab low pass and adaptive filter denoising [including Matlab source code 352 period]
[emotion recognition] based on matlab GUI voice emotion classification Recognition [Including Matlab source code 354 period]
[Basic processing] Matlab-based speech signal preprocessing [Including Matlab source code 364 period]
[Speech recognition] Matlab Fourier transform 0-9 digital speech recognition [Including Matlab source code 384 period]
[Speech Recognition] 0-9 digital speech recognition based on matlab GUI DTW [including Matlab source code 385]
[Voice playback] Matlab GUI MP3 design [including Matlab source code 425]
[Voice processing] Speech enhancement algorithm based on human ear masking effect Noise ratio calculation [Including Matlab source code 428]
[Speech denoising] Based on matlab spectral subtraction denoising [Including Matlab source code 429]
[Speech recognition] BP neural network speech recognition based on the momentum item of matlab [Including Matlab source code 430]
[Voice steganography] based on matlab LSB voice hiding [including Matlab source code 431]
[Voice recognition] based on matlab male and female voice recognition [including Matlab source code 452]
[Voice processing] based on matlab voice noise adding and noise reduction processing [including Matlab source code Issue 473]
[Speech denoising] based on matlab least squares (LMS) adaptive filter [including Matlab source code 481]
[Speech enhancement] based on matlab spectral subtraction, least mean square and Wiener filter speech enhancement [including Matlab source code 482 period】
[Communication] based on matlab GUI digital frequency band (ASK, PSK, QAM) modulation simulation [including Matlab source code 483]
[Signal processing] based on matlab ECG signal processing [including Matlab source code 484]
[Voice broadcast] based on matlab voice Broadcast [Including Matlab source code 507]
[Signal processing] Matlab wavelet transform based on EEG signal feature extraction [Including Matlab source code 511]
[Voice processing] Based on matlab GUI dual tone multi-frequency (DTMF) signal detection [Including Matlab source code 512 】
【Voice steganography】based on matlab LSB to realize the digital watermark of speech signal 【Include Matlab source code 513】
【Speech enhancement】Speech recognition based on matlab matched filter 【Include Matlab source code 514】
【Speech processing】Based on matlab GUI voice Frequency domain spectrogram analysis [including Matlab source code 527]
[Speech denoising] based on matlab LMS, RLS algorithm voice denoising [including Matlab source code 528]
[Voice denoising] based on matlab LMS spectral subtraction voice denoising [including Matlab Source code issue 529]
[Voice denoising] based on matlab soft threshold, hard threshold, compromise threshold voice denoising [including Matlab source code 530]
[Voice recognition] based on matlab specific person's voice recognition discrimination [including Matlab source code 534]
[ Speech denoising] based on matlab wavelet soft threshold speech noise reduction [including Matlab source code 531]
[speech denoising] based on matlab wavelet hard threshold speech noise reduction [including Matlab source code 532]
[speech recognition] based on matlab MFCC and SVM specific Human gender recognition [including Matlab source code 533]
[Voice recognition] GMM speech recognition based on MFCC [including Matlab source code 535 period]
[Voice recognition] Based on matlab VQ specific person isolated words voice recognition [including Matlab source code 536 period]
[Voice recognition] based on matlab GUI voiceprint recognition [including Matlab] Source code issue 537]
[Acquisition and reading] based on matlab voice collection and reading [including Matlab source code 538]
[Voice editing] based on matlab voice editing [including Matlab source code 539]
[Voice model] based on matlab voice signal mathematical model [including Matlab source code 540]
[Speech soundness] based on matlab voice intensity and loudness [including Matlab source code 541]
[Emotion recognition] based on matlab K nearest neighbor classification algorithm voice emotion recognition [including Matlab source code 542]
[Emotion recognition] based on matlab Support vector machine (SVM) speech emotion recognition [including Matlab source code 543]
[Emotion recognition] Neural network-based speech emotion recognition [including Matlab source code 544]
[Sound source localization] Sound source localization based on matlab different spatial spectrum estimation Algorithm comparison [Include Matlab source code 545]
[Sound source localization] Based on matlab microphone receiving signal under different signal-to-noise ratio [Include Matlab source code 546]
[Sound source localization] Room impulse response based on matlab single sound source and dual microphones [ Contains Matlab source code 547]
[Sound source localization] Matlab generalized cross-correlation sound source location [Matlab source code 548 is included]
[Sound source location] Matlab array manifold matrix-based signal display [Matlab source code 549]
[Features Extraction] based on matlab formant estimation [including Matlab source code 550 period]
[Feature extraction] based on matlab pitch period estimation [including Matlab source code 551]
[Feature extraction] based on matlab voice endpoint detection [including Matlab source code 552]
[Voice coding] based on matlab ADPCM codec [including Matlab source code 553]
[Voice Encoding] based on matlab LPC encoding and decoding [including Matlab source code 554]
[Voice encoding] based on matlab PCM encoding and decoding [including Matlab source code 555]
[Speech analysis] Based on matlab cepstrum analysis and MFCC coefficient calculation [including Matlab source code 556]
[Speech analysis] comparison of linear prediction coefficients based on matlab [including Matlab source code 557]

Guess you like

Origin blog.csdn.net/TIQCmatlab/article/details/114986342