b@11: function gain(filename, gainIndB, fs, bitdepth) b@11: % GAIN amplifies the audio in 'filename' by 'gainIndB'. b@11: % b@11: % by Brecht De Man at Centre for Digital Music on 21 May 2015 b@11: b@11: if nargin < 4 b@11: bitdepth = 24; b@11: end b@11: if nargin < 3 b@11: fs = 96000; b@11: end b@11: b@11: [audio,fsfile] = audioread(filename); % read part of file b@11: assert(fsfile == fs); % check file has expected sampling rate b@11: audiowrite(filename, (10^(gainIndB/20))*audio, fs, 'BitsPerSample', bitdepth); b@11: b@11: end