clear all;
clc
fs=8000; %語音信號采樣頻率為8000
x=audioread('E:\a.wav');
t=(0:length(x)-1)/8000;
Y=fft(x,2048); %對信號做2048點FFT變換
f=fs*(0:1023)/2048;
figure(1)
subplot(2,2,1);
plot(t,x) %做原始語音信號的時域圖形
grid on; axis tight;
title('原始語音信號');
xlabel('time(s)');
ylabel('幅度');
subplot(2,2,2);
plot(f,abs(Y(1:1024))) %做原始語音信號的FFT頻譜圖
grid on; axis tight;
title('原始語音信號FFT頻譜')
xlabel('Hz');
ylabel('幅度');
%sound(x)
%預處理語音信號(原始信號擴大10000倍)
x1=ceil(10000*x);%變整數
Y1=fft(x1,2048);
%figure(2)
subplot(2,2,3);
plot(t,x1) %預處理語音信號的時域圖形
grid on; axis tight;
title('預處理語音信號');
xlabel('time(s)');
ylabel('幅度');
subplot(2,2,4);
plot(f,abs(Y1(1:1024))) %預處理語音信號的FFT頻譜圖
grid on; axis tight;
title('預處理語音信號FFT頻譜')
xlabel('Hz');
ylabel('幅度');
%sound(x1)
x2=dec2bin(x1); %將語音信號由10進制轉化為2進制
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/55707.html
標籤:其他開發語言
