annotate audio/aacfile.m @ 61:eff6bddf82e3
tip
Finally implemented perceptual brightness thing.
author |
samer |
date |
Sun, 11 Oct 2015 10:20:42 +0100 |
parents |
fb17caaf9153 |
children |
|
rev |
line source |
samer@44
|
1 % aacfile - audio signal from AAC file using faad
|
samer@44
|
2 %
|
samer@44
|
3 % aacfile ::
|
samer@44
|
4 % path ~'path to AAC encoded audio file',
|
samer@44
|
5 % options { bits :: natural/16 ~'requested sample resolution' }
|
samer@44
|
6 % -> signal(C,R).
|
samer@44
|
7 %
|
samer@44
|
8 % Options are also passed to RAWPIPE
|
samer@44
|
9 function s=aacfile(file,varargin)
|
samer@44
|
10 opts=options('bits',16,varargin{:});
|
samer@44
|
11 % this is just to get format information - it's no good for getting data
|
samer@50
|
12 s1=sndpipe(sprintf('faad -w %s',bash_arg(file)));
|
samer@44
|
13
|
samer@44
|
14 % can't remember what's wrong with this...
|
samer@44
|
15 % s=sndpipe(sprintf('faad -f 2 -w "%s" | sox -t raw -r %d -b 16 -c %d -e signed - -t au -',file,rate(s1),channels(s1)),'stringfn',@()sprintf('aacfile(''%s'')',file),varargin{:});
|
samer@44
|
16 switch opts.bits
|
samer@44
|
17 case 16, bits_code=1;
|
samer@44
|
18 case 24, bits_code=2;
|
samer@44
|
19 case 32, bits_code=3;
|
samer@44
|
20 otherwise, error('Illegal bits-per-sample');
|
samer@44
|
21 end
|
samer@44
|
22
|
samer@44
|
23 s=rawpipe( sprintf('faad -f 2 -b %d -w %s',bits_code,bash_arg(file)), ...
|
samer@44
|
24 audio_format(channels(s1),rate(s1),opts.bits), ...
|
samer@44
|
25 'stringfn',@()sprintf('aacfile(''%s'')',file), ...
|
samer@44
|
26 opts);
|
samer@44
|
27 end
|
samer@44
|
28
|