Mercurial > hg > ape
comparison aux/clipfade.m @ 4:b28ffd29e6e1
Audio file preparation for listening test
author | Brecht De Man <b.deman@qmul.ac.uk> |
---|---|
date | Wed, 19 Nov 2014 18:59:51 +0000 |
parents | 4fd284285159 |
children | ed0a8621b96a |
comparison
equal
deleted
inserted
replaced
3:1f7b986dab05 | 4:b28ffd29e6e1 |
---|---|
1 function clipfade(folder, startTime, endTime, fs) | 1 function clipfade(folder, starttime, endtime, fadetime, fs, bitdepth) |
2 % CLIPFADE clips and fades a fragment [start end] of all audio files in | 2 % CLIPFADE clips and fades a fragment [start end] of all audio files in |
3 % a folder. | 3 % a folder. |
4 % | 4 % |
5 % folder: path to all audio files (automatically selected) | 5 % folder: path to all audio files (automatically selected) |
6 % start: start time in seconds | 6 % start: start time in seconds |
7 % end: end time in seconds | 7 % end: end time in seconds |
8 % | 8 % |
9 % by Brecht De Man at Centre for Digital Music on 25 October 2013 | 9 % by Brecht De Man at Centre for Digital Music on 25 October 2013 |
10 | 10 |
11 if nargin < 4 | 11 if nargin < 6 |
12 fs = 96000; | 12 bitDepth = 24; |
13 end | 13 end |
14 | 14 slash = '/'; |
15 fadeTime = 1; % fade time in seconds | |
16 bitDepth = 16; | |
17 slash = '/'; % depending on OS | |
18 | |
19 %newFolder = 'Clips'; % folder where output files will be stored | |
20 % MODIFICATION: store in place, do not keep unclipped files! | |
21 | 15 |
22 % list all audio files | 16 % list all audio files |
23 list = dir([folder slash '*.wav']); | 17 list = dir([folder slash '*.wav']); |
24 | 18 |
25 % make new folder if not present yet | 19 % remove hidden files from list |
26 % if ~exist([folder slash newFolder], 'dir') % make output folder if not there | 20 % see http://www.mathworks.co.uk/matlabcentral/newsreader/view_thread/258220 |
27 % mkdir(folder, newFolder); | 21 for k = length(list):-1:1 |
28 % end | 22 fname = list(k).name; |
23 if fname(1) == '.' | |
24 list(k) = [ ]; | |
25 end | |
26 end | |
29 | 27 |
30 for i = 1:length(list) | 28 for i = 1:length(list) |
31 if strcmp(list(i).name, 'bounce.wav') | 29 if strcmp(list(i).name, 'bounce.wav') |
32 %disp([' ' folder slash list(i).name]); % DEBUG | 30 %disp([' ' folder slash list(i).name]); % DEBUG |
33 | 31 |