load_wavs.m
来自「The MATLAB and Praat code files for perf」· M 代码 · 共 34 行
M
34 行
function [wavs,fs] = load_wavs(directory)
% LOAD_WAVS Loads all wavs in the current directory.
%
% LOAD_WAVS Returns an array of all the wave files in the current directory
% and their sampling frequency.
% LOAD_WAVS(directory) Returns an array of all the wave files in the
% specified directory and their sampling frequency.
%
% By: Matthew Hutchinson
% Created: 12/09/04
% Rice University
% Elec 301 Project
% Initialize variables
data = 0;
fs = 0;
% Load the wavs
if(nargin < 1),
D = dir;
else
D = dir(directory);
end
for i=2:size(D,1),
if(size(findstr(D(i).name,'.wav'),1))
[wav,fs,nbits] = wavread(D(i).name);
wav = wav(:,1);
data = add_wav(wav,data);
end
end
wavs = zeros(size(data,2)-1,size(data,1));
for i=2:size(data,2),
wavs(i-1,:) = data(:,i)';
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?