📄 examp_speech.m
字号:
%EXAMP_SPEECH Spectrogram of speech signal.%% This example show how to work with almost real world data.%% FIGURE 1 Linus%% This show a spectrogram of Linus Thorvalds saying "My name is% Linus Thorvalds, and I pronounce Linux as Linux"%% The 90% lowest values have been filtered away, to produce a% cleaner plot.%% This program is free software: you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation, either version 3 of the License, or% (at your option) any later version.% % This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% GNU General Public License for more details.% % You should have received a copy of the GNU General Public License% along with this program. If not, see <http://www.gnu.org/licenses/>.disp('Type "help examp_speech" to see a description of how this example works.');% Load the signalf=linus;% The parameters below are choosen such that the last part of the signal is% cut of; this does not matter, it is zero anyway. L=40320;a=224;M=280;b=L/M;% Optimally centered window.g=pgauss(L,a/b);% Get some coefficients.c=dgt(f,g,a,M,L);% Since the signal is real, then the absolute value of the% upper half of crect is a mirror image of the lower half. Therefore, we skip% it. cplot=abs(c(1:floor(M/2)+1,:)).^2;% Plot.figure(1);% Plotting is diffent in Matlab and Octave.if isoctave title('Linus speaking.'); imagesc(flipud(largestr(cplot,.1)));else contour(log(largestr(cplot,.1)+realmin)); title('Linus speaking.');end;% XXL: Wouldn't it be better to have 'real' time and frequency scales?% use sgram here????% We need to figure out what this example should do.% XXL: For speech I was expecting sound output%if ~isoctave % maybe only working for matlab?% if ispc% wavplay(f,8000) % SR= 8000 estimated% else % unix : does it work?% % there should not be other systems, no?% auwrite(f,8000,16,'/tmp/tmpsnd.au');% unix('cat /tmp/tmpsnd.au >/dev/audio'); % % % also possible:% % wavwrite(SIG.sig/m,SIG.fs,'/tmp/tmp.wav');% % unix('play /tmp/tmp.wav');% % unix('rm -f /tmp/tmp.wav'); % end%end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -