我正在做语音分析。我录制了5秒的声音。应用汉明窗,直流偏移和归一化以及使用fft取得了光谱。我想知道声音有多大变化。那么有没有办法将fft转换回时域?
clc,clear;
% Record your voice for 5 seconds.
%recObj = audiorecorder;
recObj = audiorecorder(96000, 16, 1);
disp('Start speaking.')
recordblocking(recObj,5);
disp('End of Recording.');
% Play back the recording.
play(recObj);
get(recObj);
myspeech = getaudiodata(recObj);
wavwrite(double(myspeech),96000,'C://Users//naveen//Desktop//unprocessed')
% Store data in double-precision array.
myRecording = getaudiodata(recObj);
% Store data in double-precision array.
myRecording = getaudiodata(recObj);
% Plot the samples.
figure,plot(myRecording),title('Original Sound');
%Offset Elimination
a = myRecording;
a=double(a);
D = a-mean(a);
figure,plot(myRecording),title('Sound after Offset Elimination');
%normalizing
w = D/max(abs(D));
figure,plot(w),title('Normalized Sound');
% hamming window
a1=double(w);
%a1=a1';
N=length(w);
hmw = hamming(N);
temp = a1.*hmw;
a1 = temp;
%Fast Fourier Transform
a2=double(a1);
N=length(a1);
n=ceil(log2(N));
nz=2^n;
fs = 96000;
x_z=0*[1:nz];
x_z(1:N)=a2;
X=fft(x_z);
x1=abs(X);
wq=double(0:nz-1)*(fs/nz);
figure,stem(wq,x1),title('Spectrum');
xlabel('Frequency (Hz)');
ylabel('Magnitude of FFT Coefficients');
nz1=round(nz/2)
x2=x1(1:nz1);
w1=wq(1:nz1);
figure,plot(w1,x2);
title('Half Length Spectrum of Sound');
nz2=nz1*10;
答案 0 :(得分:0)
与您fft
一样,您也可以应用ifft
,这是傅里叶变换的反转(http://www.mathworks.es/es/help/matlab/ref/ifft.html)
答案 1 :(得分:0)
对复杂数据使用abs()函数是一种有损操作,会丢弃任何相位信息。相位信息对波形形状以及FFT窗口中的任何瞬变的定时进行编码。由于该信息已被丢弃,因此单独使用幅度谱或频谱图不能将其转换为听起来像原始语音的音频。
但如果保留FFT的完整复杂结果,那么复杂的IFFT可能会用于某种再合成过程。