Mercurial > hg > ishara
view audio/sndfile.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | 62e31e7980e6 |
children |
line wrap: on
line source
% sndfile - audio signal from audio file % % sndfile :: % path | cell { nonneg, nonneg, path } ~'file name or { start, end, path }' % options { % enc :: {'mp3','aac','flac','ogg'}; % channels :: natural/nan ~'desired number of channels'; % rate :: nonneg/nan ~'desired sampling rate'; % bits :: natural/16 ~'desired bits per sample'; % } % -> signal(C,R). % % This will use mp3file, aacfile or flacfile for those types of file, but jsndfile % for anything else, including OGG files. % % If channels or rate are not nan, audio format will be converted to match. % If either of them are nan, the corresponding value from the audio file will % be left unchanged. function s=sndfile(file,varargin) opts=options('enc','unknown',varargin{:}); if iscell(file) s=taket(file{2}-file{1},dropt(file{1},sndfile(file{3}))) return end string=sprintf('sndfile(''%s'')',file); if strcmp(opts.enc,'mp3') || endswith(file,'mp3') || endswith(file,'MP3') s=mp3file(file,'stringfn',@()string,opts); % Java version doesn't remove padding correctly elseif strcmp(opts.enc,'aac') || endswith(file,'m4a') s=aacfile(file,'stringfn',@()string,opts); elseif strcmp(opts.enc,'flac') || endswith(file,'flac') s=flacfile(file,'stringfn',@()string,opts); else s=jsndfile(file,varargin{:}); end end