From bf1c67fb127f12391d110d9ab56611dd9bdffd66 Mon Sep 17 00:00:00 2001 From: Jan-Gerrit Richter Date: Wed, 9 Aug 2017 13:49:18 +0200 Subject: [PATCH] added core audio format to ita_read --- kernel/DataAudio_IO/ita_read/ita_read_caf.m | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 kernel/DataAudio_IO/ita_read/ita_read_caf.m diff --git a/kernel/DataAudio_IO/ita_read/ita_read_caf.m b/kernel/DataAudio_IO/ita_read/ita_read_caf.m new file mode 100644 index 00000000..1290f39e --- /dev/null +++ b/kernel/DataAudio_IO/ita_read/ita_read_caf.m @@ -0,0 +1,37 @@ +function result = ita_read_caf(filename,varargin) +%ITA_READ_FLAC - Read Free Lossless Audio Codec Files +% This function is completely based on the MATLAB audioread. +% +% It returns a itaAudio object containing the files data and metadata. +% +% See also ita_read, ita_write, audioread. + +% +% This file is part of the ITA-Toolbox. Some rights reserved. +% You can find the license for this m-file in the license.txt file in the ITA-Toolbox folder. +% + + +%% Return type of data this function can read +if nargin == 0 + result{1}.extension = '.caf'; + result{1}.comment = 'Core Audio Format Files (*.caf)'; + return +end + + +if ~exist(filename,'file') + error('ITA_READ_CAF: File does not exist'); +end + +try + [data,fs] = audioread(filename); + result = itaAudio; + result.samplingRate = fs; + result.timeData = data; +catch + error('ITA_READ_CAF: Something went wrong'); +end + +end + -- GitLab