Matlab程序:
mkdir('classicalshengputu');%创建保存声谱图的文件夹
file = '/Users/liupeng/Desktop/matlab/speechRecognition...file2(i).name);
[x,fs]=audioread(file3);%读取.au 文件
str1 = strcat('/Users/liupeng/Desktop/matlab/speechRecognition...如需要对于音乐采样调用该函数
s=specgram(x(:,1),N,fs,window,overlap);%生成声谱图
y=20*log10(abs(s)+eps);%如需要在转换实数和虚数...bluesshengputu
imshow(y,'border','tight');%如需显示声谱图调用
set(gcf,'position',[0,0,255,256]);%设定 figure 的位置和大小