Mercurial > hg > ape
view aux/removesilent.m @ 5:85bff3d1b6fe
Equalise loudness in prepare2listen.m
author | Brecht De Man <b.deman@qmul.ac.uk> |
---|---|
date | Sun, 23 Nov 2014 23:24:35 +0000 |
parents | 4fd284285159 |
children |
line wrap: on
line source
function removesilent(foldername) % REMOVESILENT removes audiofiles in folder <foldername> that are silent % (compares maximum value against small number) % % by Brecht De Man at Centre for Digital Music on 15 July 2013 MIN = 0.001; WARNING = 0.1; list = dir([foldername '/*.wav']); for i = 2:length(list) [audio,fs] = audioread([foldername '/' list(i-1).name]); S = max(max(audio.^2)); % max of squared values over all channels if S < MIN % if empty delete([foldername '/' list(i-1).name]); % remove this audio file fprintf('''%s'' removed (maximum squared value = %f < %f).', list(i-1).name, S, MIN); else if S < WARNING fprintf('''%s'': maximum squared value = %f < %f.', list(i-1).name, S, WARNING); end end end end