Rowan-Classes/6th-Semester-Spring-2024/DSP/Labs/FinalProject/load_or_audioread.m
2024-04-25 18:38:09 -04:00

19 lines
603 B
Matlab

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Either load in an ascii .dat file or
% uses wavread to read a wave file
% function [speechData] = load_or_audioread(speechFile)
% speechfile in quotes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [speechData] = load_or_audioread(speechFile)
% The speech file is loaded
if (ischar(speechFile))
if(strcmpi(speechFile(end-3:end),'.dat'))
speechData = load(speechFile);
elseif(strcmpi(speechFile(end-3:end),'.wav'))
speechData = audioread(speechFile);
end
elseif (isnumeric(speechFile))
speechData = speechFile;
end