• 大小: 1.55MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-01
  • 语言: Matlab
  • 标签: pesq  lsd  matlab  

资源简介

可以直接打开压缩包,在matlab上运行

资源截图

代码片段和文件信息

function LSD=LogSpectralDistance(CleanNoisyfsRSRange)

%LSD=LOGSPECTRALDISTANCE(CLEANNOISYFSRSRANGE)
% Calculates the average log-spectral distance between CLEAN and NOISY
% signals. frames are 25ms long with 60 percent (15ms) overlap hamming
% windowed. RS is the remove silence option (default: 0) if 1 the program
% uses a Voice Activity Detector to find non-speech frames and eliminates
% them from calculation of LSD. FS is the sampling frequency (Default
% 10KHz). RANGE is the frequency range used in the calculation of LSD
% (default: [0 FS/2]) it is a two-element vector the first element should
% be smaller than the second one and non of them should be greater than
% FS/2.

if nargin<3
    fs=10000;
end
if nargin<4
    RS=0;
end
if nargin<5
    Range=[0fs/2];
end
% RS=0;
% Range=[0fs/2];
% [filenamepathname]=uigetfile(‘*.wav‘‘请选择纯净语音文件:‘);
% [Cleanfsnbits]=wavread([pathname filename])‘;
% [filenamepathname]=uigetfile(‘*.wav‘‘请选择增强语音文件:‘);
% Noisy=wavread([pathname filename])‘;

if RS==1
    [Clean Noisy]=RemoveSilence(CleanNoisyfs);
end

Len=min(length(Clean)length(Noisy));
Clean=Clean(1:Len);
Noisy=Noisy(1:Len);
Clean=Clean./sqrt(sum(Clean.^2));
Noisy=Noisy./sqrt(sum(Noisy.^2));

W=round(.025*fs);
SP=.4;
CL=abs(mySpecgram(CleanWSP));
NO=abs(mySpecgram(NoisyWSP));
nfft2=size(CL1);
N=min(size(CL2)size(NO2)); %Number of frames
RangeBin=freq2bin(Rangefs/2nfft2);
RangeBin=RangeBin(1):RangeBin(2);
LSD=mean(sqrt(mean((log(CL(RangeBin1:N))-log(NO(RangeBin1:N))).^2)));



function [x2 y2]=RemoveSilence(x1y1fsIS)

% Remove Silence
% [X2 Y2]=REMOVESILENCE(X1Y1FSIS)
% This function removes the silence parts from the signals X1 and Y1 and
% returns the corresponding wave forms. Y1 is normally a modified (noisy or
% enhanced) version of X1. The silence frames are detected using X1 which
% is supposed to be the clean signal. For this purpose a Voice Activity
% Detector (VAD) is used. The use of this function is for evaluation of the
% speech quality (e.g. SNR) at speech active frame only. FS is tha sampling
% frequency. IS is the initial silence duration (the defaul value) which is
% used to model the noise template. the default value of IS is 0.25 sec.
% Date: Feb-05
% Author: Esfandiar Zavarehei

if (nargin<4)
    IS=.25; %seconds
end
% Window size and overlap and other initialization values
W=.025*fs;
SP=.010*fs/W;
wnd=hamming(W);

NIS=fix((IS*fs-W)/(SP*W) +1);%number of initial silence segments

Y1=segment(y1WSPwnd);
Y1=fft(Y1);
Y1=Y1(1:fix(end/2)+1:);
Y1P=angle(Y1);
Y1=abs(Y1);
X1=segment(x1WSPwnd);
X1=fft(X1);
X1=X1(1:fix(end/2)+1:);
X1P=angle(X1);
X1=abs(X1);
NumOfframes=min(size(X12)size(Y12));

NoiseLength=15;
N=mean(X1(:1:NIS)‘)‘; %initial Noise Power Spectrum mean

%Find the non-speech frames of X1
for i=1:NumOfframes
    if i<=NIS
        SpeechFlag(i)=0;
        NoiseCounter=100;
        Dist=.1;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-09-11 13:45  PESQ与LSD评价\
     目录           0  2016-08-27 22:16  PESQ与LSD评价\g_Spectral_Distance matlab\
     目录           0  2016-08-28 15:23  PESQ与LSD评价\g_Spectral_Distance matlab\Log_Spectral_Distance\
     文件        6363  2008-04-08 01:38  PESQ与LSD评价\g_Spectral_Distance matlab\Log_Spectral_Distance\LogSpectralDistance.m
     文件         348  2016-08-27 23:11  PESQ与LSD评价\g_Spectral_Distance matlab\Log_Spectral_Distance\Log_SD.m
     文件         270  2008-07-05 10:28  PESQ与LSD评价\g_Spectral_Distance matlab\Log_Spectral_Distance\程序说明.txt
     目录           0  2016-09-11 13:44  PESQ与LSD评价\psc\
     文件        1633  2014-02-12 13:26  PESQ与LSD评价\psc\license.txt
     目录           0  2016-09-11 13:44  PESQ与LSD评价\psc\psc\
     文件        5953  2011-03-21 12:16  PESQ与LSD评价\psc\psc\mcode.sty
     文件       15122  2011-03-21 12:16  PESQ与LSD评价\psc\psc\myspectrogram.m
     文件        1469  2011-03-22 03:32  PESQ与LSD评价\psc\psc\pesq.m
     文件       21015  2011-03-22 03:32  PESQ与LSD评价\psc\psc\pesq.p
     文件        6480  2011-03-21 14:18  PESQ与LSD评价\psc\psc\psc.m
     文件      416086  2011-03-22 03:38  PESQ与LSD评价\psc\psc\psc.pdf
     文件        1282  2011-03-22 03:37  PESQ与LSD评价\psc\psc\psc.tex
     文件       85526  2011-03-21 13:41  PESQ与LSD评价\psc\psc\sp10.wav
     文件       85526  2011-03-21 13:41  PESQ与LSD评价\psc\psc\sp10_white_sn10.wav
     文件      946001  2011-03-22 03:38  PESQ与LSD评价\psc\psc\test_psc.eps
     文件        3088  2011-03-22 03:37  PESQ与LSD评价\psc\psc\test_psc.m
     文件      529977  2011-03-22 03:38  PESQ与LSD评价\psc\psc\test_psc.png
     文件         672  2011-03-22 03:38  PESQ与LSD评价\psc\psc\test_psc.txt

评论

共有 条评论