denoising-historical-data/PQevalAudio/Misc/PQwavFilePar.m
2021-08-30 18:42:12 +03:00

33 lines
887 B
Matlab

function WAV = PQwavFilePar (File)
% Print a WAVE file header, pick up the file parameters
% P. Kabal $Revision: 1.1 $ $Date: 2003/12/07 13:34:11 $
persistent iB
if (isempty (iB))
iB = 0;
else
iB = mod (iB + 1, 2); % Only two files can be "active" at a time
end
%[size WAV.Fs Nbit] = wavread (File, 'size');
[sound, WAV.Fs] = audioread(File);
Nbit = 16;
WAV.Fname = File;
WAV.Nframe = size(sound, 1);
WAV.Nchan = size(sound, 2);
WAV.iB = iB; % Buffer number
% Initialize the buffer
PQgetData (WAV, 0, 0);
fprintf (' WAVE file: %s\n', File);
if (WAV.Nchan == 1)
fprintf (' Number of samples : %d (%.4g s)\n', WAV.Nframe, WAV.Nframe / WAV.Fs);
else
fprintf (' Number of frames : %d (%.4g s)\n', WAV.Nframe, WAV.Nframe / WAV.Fs);
end
fprintf (' Sampling frequency: %g\n', WAV.Fs);
fprintf (' Number of channels: %d (%d-bit integer)\n', WAV.Nchan, Nbit);