annotate 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
rev   line source
b@11 1 function gain(filename, gainIndB, fs, bitdepth)
b@11 2 % GAIN amplifies the audio in 'filename' by 'gainIndB'.
b@11 3 %
b@11 4 % by Brecht De Man at Centre for Digital Music on 21 May 2015
b@11 5
b@11 6 if nargin < 4
b@11 7 bitdepth = 24;
b@11 8 end
b@11 9 if nargin < 3
b@11 10 fs = 96000;
b@11 11 end
b@11 12
b@11 13 [audio,fsfile] = audioread(filename); % read part of file
b@11 14 assert(fsfile == fs); % check file has expected sampling rate
b@11 15 audiowrite(filename, (10^(gainIndB/20))*audio, fs, 'BitsPerSample', bitdepth);
b@11 16
b@11 17 end