
function [ Y, bits ] = read8( pcmfile );

% [ Y, bits ] = read8( pcmfile );
% reads a binary file into an array Y, assuming 8bits signed integers
%
% 

if ~isstr( pcmfile )
  error( 'pcmfile must be a string.' );
end

% add default extension
if isempty( findstr( pcmfile, '.' ) )
  pcmfile = [ pcmfile '.pcm' ];
end

fid_in = fopen( pcmfile, 'r', 'ieee-le' );
if ( fid_in == -1 )
  error('Can''t open PCM file for output.');
end

[ Y, bits ] = fread( fid_in, inf, 'int8' );
fclose( fid_in );
