view aux/gain.m @ 15:24be5e9ce25b tip

Update README
author Brecht De Man <brecht.deman@bcu.ac.uk>
date Thu, 20 Sep 2018 12:23:20 +0200
parents 0014c50188da
children
line wrap: on
line source
function gain(filename, gainIndB, fs, bitdepth)
% GAIN amplifies the audio in 'filename' by 'gainIndB'. 
%
% by Brecht De Man at Centre for Digital Music on 21 May 2015

if nargin < 4
    bitdepth = 24;
end
if nargin < 3
    fs = 96000;
end

[audio,fsfile] = audioread(filename); % read part of file
assert(fsfile == fs); % check file has expected sampling rate
audiowrite(filename, (10^(gainIndB/20))*audio, fs, 'BitsPerSample', bitdepth);

end