導航:首頁 > 源碼編譯 > MATLAB深度語音源碼

MATLAB深度語音源碼

發布時間:2023-05-24 07:33:52

Ⅰ matlab 源代碼

%後邊不都是已經加註釋了嗎?
不了解應用情況,解答這個代碼很難的。
推薦:
www.ilovematlab.com!
論壇版主很強!

Ⅱ 求matlab源代碼

z=0:0.1:1000;

N=length(z);

dz=cos(0.8*z)+cos(0.5*z);

fz=sign(dz);

y=abs(fft(fz))/N;

x=(0:N-1)*2*pi/1000;

yy=y(1:floor(N/2)+1)*2;

xx=x(1:floor(N/2)+1);


[pks locs] = findpeaks(yy(xx<=1),'minpeakheight',0.01);


plot(xx,yy,'k');

set(gca,'Xlim',[0 1]);

ylabel('弊禪Fourier Coeffcient');

xlabel('Reciprocal Vectros');

for ii=1:length(pks);

畝慧 text(xx(locs(ii)),pks(ii),num2str(xx(locs(ii)),'%.2f'),'Rotation'迅卜答,90);

end


Ⅲ 關於一個MATLAB源代碼

你這個是普羅克斯或者譯為普羅金斯的現代通信系統使用matlab一書上的吧。這個是多幅度信號模擬。使用的的是蒙特卡羅模擬方法,就是用很多次實驗的到的結果模擬理論值,容易理解的就是投10000次硬幣,5005次整,4995次反,等到正的概率與反的概率。
Function[p]=smldPe58(snr_in_dB) 函數名,輸入變數時信噪比dB形式的
d=1; 這李簡襪里表示電信號幅度,一個單位
SNR=exp(snr_in_dB*log(10)/10); 將信噪比化成正常的形式,dB你哪激知道吧
Sgma=sqrt((5*d^2)/(4*SNR)); 雜訊咐爛標准差,出自理論公式
N=10000; 實驗次數
for i=1:N,
temp=rand; 產生一個隨機數0-1的
if(temp<0.25), 因為這里模擬四種電平,且認為出現概率相同
dsource(i)=0: 0-0.25是0
elseif(temp<0.5),
dsource(i)=1; 0.25-0.5是1
elseif(temp<0.75),
dsource(i)=2 0.5-0.75是2
else
dsource=3 0.75-1是3剛好四種
end
end;
numoferr=0; 這是個計數器,積累錯誤個數
for i=1:N,
if(dsource(i)==0),
r=-3*d+gngauss(sgma); 這里把四種電平對應了四種幅度
elseif(dsource(i)==1), -3*d -d d 3*d 間隔2d是信號大小
r=-d+gngauss(sgma); gngauss函數在該書前幾章有
elseif(dsuorce(i)==2), 產生高斯分布雜訊,
r=d+gngauss(sgma); 這里就是信號加雜訊,相當於信號
else 通過信道
r=3*d+gngauss(sgma);
end:
if(r<-2*d), 這里相當於到了接受端,
decis=0; 按接收大小來判決屬於0.1.2.3哪種信號
elseif(r<0),
decis=1;
elseif(r<2*d),
decis=2;
elseif
decis=3;
end;
if(decis=dsource(i)), 判決信號和發送的原始信號比較
numoferr=numoferr+1; 不一樣就說明錯了一個,誤碼1
end;
end;
p=numoferr/N; 錯了多少除以總數,誤碼率

Ⅳ matlab源代碼

hrollfcoef這個函數不是matlab自帶的

function [xh] = hrollfcoef(irfn,ipoint,sr,alfs,ncc)

%****************** variables *************************
% irfn : Number of symbols to use filtering
% ipoint : Number of samples in one symbol
% sr : symbol rate
% alfs : rolloff coeficiense
% ncc : 1 -- transmitting filter 0 -- receiving filter
% *****************************************************

xi=zeros(1,irfn*ipoint+1);
xq=zeros(1,irfn*ipoint+1);

point = ipoint;
tr = sr ;
tstp = 1.0 ./ tr ./ ipoint;
n = ipoint .* irfn;
mid = ( n ./ 2 ) + 1;
sub1 = 4.0 .* alfs .* tr; % 4*alpha*R_s

for i = 1 : n

icon = i - mid;
ym = icon;

if icon == 0.0
xt = (1.0-alfs+4.0.*alfs./pi).* tr; % h(0)
else
sub2 =16.0.*alfs.*alfs.*ym.*ym./ipoint./ipoint;
if sub2 ~= 1.0
x1=sin(pi*(1.0-alfs)/ipoint*ym)./pi./(1.0-sub2)./ym./tstp;
x2=cos(pi*(1.0+alfs)/ipoint*ym)./pi.*sub1./(1.0-sub2);
xt = x1 + x2; % h(t) plot((1:length(xh)),xh)
else % (4alphaRst)^2 = 1plot((1:length(xh)),xh)
xt = alfs.*tr.*((1.0-2.0/pi).*cos(pi/4.0/alfs)+(1.0+2.0./pi).*sin(pi/4.0/alfs))./sqrt(2.0);
end % if sub2 ~= 1.0
end % if icon == 0.0

if ncc == 0 % in the case of receiver
xh( i ) = xt ./ ipoint ./ tr; % normalization
elseif ncc == 1 % in the case of transmitter
xh( i ) = xt ./ tr; % normalization
else
error('ncc error');
end % if ncc == 0

end % for i = 1 : n

%******************** end of file ***************************

網上找的,你看看能不能拼到你那個程序里去

Ⅳ matlab採集語音信號後進行PCM編碼然後卷積編碼進行差錯控制的以及反演的源代碼!

1.PCM 編碼實滾簡現(M函數)

function code=PCMcoding(Range,S)
code=zeros(1,8);
Normalization=abs(S)/Range;
deta=1/2048;
if sign(S)==1
code(1)=1;
else
code(1)=0;
end
detas=ceil(Normalization/deta);
if detas>128
code(2)=1;
if detas>512
code(3)=1;
if detas>1024
code(4)=1;
end
elseif detas>256
code(4)=1;
end
elseif detas>32
code(3)=1;
if detas>64
code(4)=1;
end
elseif detas>16
code(4)=1;
end

Tribal=bin2dec(num2str(code(2:4)))+1;
if Tribal==1
Interval=1;
else Interval=(2^(Tribal+2))/16;
end
if Tribal==1
code(5)=(2^3)*Interval<detas;
code(6)=code(5)*(2^3)*Interval+(2^2)*Interval<detas;
code(7)=code(5)*(2^3)*Interval+code(6)*(2^2)*Interval+(2^1)*Interval<橘帶detas;
code(8)=code(5)*(2^3)*Interval+code(6)*(2^2)*Interval+code(7)*(2^1)*Interval+(2^0)*Interval<detas;
else
code(5)=2^(Tribal+2)+(2^3)*Interval<detas;
code(6)=2^(Tribal+2)+code(5)*(2^3)*Interval+(2^2)*Interval<detas;
code(7)=2^(Tribal+2)+code(5)*(2^3)*Interval+code(6)*(2^2)*Interval+(2^1)*Interval<detas;
code(8)=2^(Tribal+2)+code(5)*(2^3)*Interval+code(6)*(2^2)*Interval+code(7)*(2^1)*Interval+(2^0)*Interval<detas;
end

2。PCM 解碼實現(M函數)大伍褲

%PCM Decoding
function S=PCMdecoding(Range,code)
deta=Range/2048;
Tribal=bin2dec(num2str(code(2:4)))+1;
if Tribal==1
Interval=1;
else Interval=(2^(Tribal+2))/16;
end
if Tribal==1
S=code(5)*(2^3)*Interval+code(6)*(2^2)*Interval+code(7)*(2^1)*Interval+code(8)*(2^0)*Interval+Interval;
else
S=2^(Tribal+2)+code(5)*(2^3)*Interval+code(6)*(2^2)*Interval+code(7)*(2^1)*Interval+code(8)*(2^0)*Interval+Interval;
end
S=S*deta;

Ⅵ 用Matlab語言編寫一個語音信號或圖象信號去噪的程序請高手幫忙

不好意思,沒看到維納濾波,程序罩唯就不刪了

%譜減法語音增強
%輸入參數轎悶滾s 語音數據,fs 采樣頻率,p 下面有說明,共11個,可不輸入,有默認值
%「過度減法(oversubtraction)」作減法的時候,保留一小部分原來的背景噪音,用這部分背景噪音來掩蓋住音樂噪音的譜峰,從而消除了令人不悅的音樂噪音。

%通過給閉余的參數p,估計噪音,做譜減法。從而消除噪音。
function [ss,po]=specsubm(s,fs,p)
%利用頻譜相減(spectral subtraction)增強 [SS,PO]=(S,FS,P)
%
% implementation of spectral subtraction algorithm by R Martin (rather slow)
% algorithm parameters: t* in seconds, f* in Hz, k* dimensionless
% 1: tg = smoothing time constant for signal power estimate (0.04): high=reverberant, low=musical
% 2: ta = smoothing time constant for signal power estimate
%

used in noise estimation (0.1)
% 3: tw = fft window length (will be rounded up to 2^nw samples)
% 4: tm = length of minimum filter (1.5): high=slow response to noise increase, low=distortion
% 5: to = time constant for oversubtraction factor (0.08)
% 6: fo = oversubtraction corner frequency (800): high=distortion, low=musical
% 7: km = number of minimisation buffers to use (4): high=waste memory, low=noise molation
% 8: ks = oversampling constant (4)
% 9: kn = noise estimate compensation (1.5)
% 10:kf = subtraction floor (0.02): high=noisy, low=musical
% 11:ko = oversubtraction scale factor (4): high=distortion, low=musical

%檢查函數的輸入參數,如果輸入少於三個,po為默認值,po的參數上面有說明
if nargin<3 po=[0.04 0.1 0.032 1.5 0.08 400 4 4 1.5 0.02 4].'; else po=p; end

ns=length(s);
ts=1/fs;
ss=zeros(ns,1);

ni=pow2(nextpow2(fs*po(3)/po(8)));
ti=ni/fs;
nw=ni*po(8);
nf=1+floor((ns-nw)/ni);
nm=ceil(fs*po(4)/(ni*po(7)));

win=0.5*hamming(nw+1)/1.08;win(end)=[];
zg=exp(-ti/po(1));
za=exp(-ti/po(2));
zo=exp(-ti/po(5));

px=zeros(1+nw/2,1);
pxn=px;
os=px;
mb=ones(1+nw/2,po(7))*nw/2;
im=0;
osf=po(11)*(1+(0:nw/2).'*fs/(nw*po(6))).^(-1);

imidx=[13 21]';
x2im=zeros(length(imidx),nf);
osim=x2im;
pnim=x2im;
pxnim=x2im;
qim=x2im;

for is=1:nf
idx=(1:nw)+(is-1)*ni;
x=rfft(s(idx).*win);
x2=x.*conj(x);

pxn=za*pxn+(1-za)*x2;
im=rem(im+1,nm);
if im

mb(:,1)=min(mb(:,1),pxn);
else

mb=[pxn,mb(:,1:po(7)-1)];
end
pn=po(9)*min(mb,[],2);
%os= oversubtraction factor
os=zo*os+(1-zo)*(1+osf.*pn./(pn+pxn));

px=zg*px+(1-zg)*x2;
q=max(po(10)*sqrt(pn./x2),1-sqrt(os.*pn./px));

ss(idx)=ss(idx)+irfft(x.*q);

end
if nargout==0
soundsc([s; ss],fs);
end

Ⅶ MATLAB 語音信號處理

1.改變聲音播放速度
所謂改變聲音的播放速度也就是改變采樣間隔(sampling interval)(即改變衫鬧了采樣頻率),但是這個頻率依然要在2f(Nyquist rate)之上簡塌亂,否則就會產生失真(distortion)。

2.實現對聲音信號放大和衰減功能
所謂放大或者衰減並不改變聲音信號頻域上的特徵,只改變時域上的幅值,這時就需要全通濾波器(all pass filter)攔檔然後加一個固有的參數。改變參數可以實現對聲音信號放大和衰減功能

3.實現混音音效效果
所謂混音就是不同的聲音疊加在一起,而又不影響分別的時域和頻域的特徵。

4.實現迴音音效效果
回聲在時域上幅值減小了,頻域上的特徵不變,只需要把原信號添加一個延時(delay)和對時域的幅度(Amplitude)添加一個參數(coefficient).然後和原信號疊加(同三)。

5.實現男女變聲音效效果
男女變音就是需要改變頻域的幅度,但是是線性的改變幅度。

閱讀全文

與MATLAB深度語音源碼相關的資料

熱點內容
怎麼把電腦里文件夾挪出來 瀏覽:693
java流程處理 瀏覽:683
ftp創建本地文件夾 瀏覽:659
腰椎第一節壓縮 瀏覽:738
xp去掉加密屬性 瀏覽:117
2345怎麼壓縮文件 瀏覽:982
迷你奪寶新演算法 瀏覽:407
伺服器如何防止木馬控制 瀏覽:715
壓縮空氣用電磁閥 瀏覽:742
微信為什麼不能設置加密認證 瀏覽:672
鄧倫參加密室逃脫視頻 瀏覽:391
音頻壓縮編碼標准 瀏覽:300
常提到的app是表示什麼 瀏覽:261
天津程序員傳銷 瀏覽:349
下班之後的程序員 瀏覽:73
檢測支持ssl加密演算法 瀏覽:344
衢州發布新聞什麼APP 瀏覽:85
中國移動長沙dns伺服器地址 瀏覽:252
wifi密碼加密了怎麼破解嗎 瀏覽:599
linux命令cpu使用率 瀏覽:70