MATLAB calculates short-time average zero-crossing rate of signal

tags: MATLAB realizes speech signal processing

1. Principle:

The short-term average zero-crossing rate indicates the number of times the speech signal waveform crosses the horizontal axis in a frame of speech

Two, calculate the zero-crossing rate code

clear all; clc; close all;
filedir=[];                       % Set path
filename='bluesky3.wav';          %  Set file name
fle=[filedir filename];           %  Compose the complete path and file name
[xx,Fs]=audioread(fle);             %  Read in the data file
x=detrend(xx);                    %  Eliminate DC component
wlen=200; inc=80;                 %  Set frame length, frame shift
win=hanning(wlen);                %  Window function
N=length(x);                      %  Find the data length
X=enframe(x,win,inc)';            %  Framing
fn=size(X,2);                     %  Get the number of frames
zcr1=zeros(1,fn);                 %  Initialize
for i=1:fn
    z=X(:,i);                     %  Get a frame of data
    for j=1: (wlen-1);          %  Find zero crossings in one frame
         if z(j)* z(j+1)< 0       %  Determine whether it is a zero-crossing point
             zcr1(i)=zcr1(i)+1;   %  Is the zero crossing point, record1Times
         end
    end
end
time=(0:N-1)/Fs;                  %  Calculate time coordinate
frameTime=frame2time(fn,wlen,inc,Fs);  %  Find the time corresponding to each frame
%  Drawing
subplot 211; plot(time,x,'k'); grid;
title('Speech waveform');
ylabel('Amplitude'); xlabel(['Time/s' 10 '(a)']);
subplot 212; plot(frameTime,zcr1,'k'); grid;
title('Short-term average zero-crossing rate');
ylabel('Amplitude'); xlabel(['Time/s' 10 '(b)']);


The short-time average zero-crossing rate can be used to find the voice signal from the background noise, which can be used to determine the start and end positions of the silent and no-talk segments.

Intelligent Recommendation

Zero-crossing rate and energy is calculated

Calculation of energy By calculating the rate of zero  ...

Zero Crossing Rate and Python implementation

Zero crossing rate (Zero Crossing Rate,ZCR) Refers to the number of times the voice signal passes through the zero point (from positive to negative or from negative to positive) in each frame. This fe...

[Short-term average zero zero] Based on the shortcoming zero zero zero zero zero zero-in-law [including the MATLAB source code 1721]

First, get the code method Get a code method 1: The full code has uploaded my resources:[Short-term average zero zero] Based on the shortcoming zero zero zero zero zero zero-in-law [including the MATL...

Python calculates the average rate module

Reprinted at: https://blog.51cto.com/bobo123/1895692...

More Recommendation

Matlab calculates signal time domain and frequency domain characteristic parameters

1. Time domain characteristic parameters: Baidu by yourself 2. Frequency domain characteristic parameters: Baidu by yourself To be honest, I compiled it myself according to the mathematical definition...

MATLAB realizes short-time Fourier transform of speech signal

One, function call Second, the function source code...

[Short -time energy] Based on Matlab voice signal short -term energy [Contains MATLAB source code 1719 period]

1. Get code method Obtain code method 1: The full code has uploaded my resources:[Short -time energy] Based on Matlab voice signal short -term energy [Contains MATLAB source code 1719 period] Obtain c...

SQL29 calculates the average subs retained rate of users

Topic: Now, it is now necessary to see the average probability of brushing the title the next day after brushing questions a day. Please take the appropriate data. According to the example, your query...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top