www.pudn.com > LPCToolbox.rar > LOADSOUND.M
function [err,msg] = loadsound(idx)
global Filelist Cs Ap Handle
maxitems = length(Filelist);
if idx > maxitems,
err=1; msg = 'End of file list';
return;
elseif idx < 1,
err=2; msg = 'Beginning of file list';
return;
end
>-------------------------------
> First read in the .RAW file into a temporary variable.
> this ensures that if there is any error, we can back off
> before committing to changes in Cs.
[sndfilename, datfilename, ext] = fixfilename(Filelist{idx});
[snd,Fs,err,msg] = getsound(sndfilename, ext, Ap.defaultFs);
if err ~= 0, return; end
>-------------------------------
> No problems reading the files. Change all the Ap entries
> together, so the info is always consistent.
Cs.sndindex = idx; > index of sound in the given list
Cs.sndfilename = sndfilename;
Cs.datfilename = datfilename;
Cs.Fs = Fs;
Cs.snd = snd;
Cs.framerange = [];
Cs.ncoeffs = 0;
Cs.nframes = 0; > number of analysis frames
Cs.spcgm = []; > this is computed in pksfig_draw
Cs.spcgmx = [];
Cs.spcgmy = [];
err=0; msg='';