Mercurial > hg > audio-degradation-toolbox
comparison AudioDegradationToolbox/support/adthelper_normalizeAudio.m @ 28:76f45f5c9afd DoP tip
- added units
* adaptiveEqualizer
* applyMfccMeanAdaption
- added corresponding data files for presets
- modified applyImpulseReponse to use the estimated average group delay to adjust
the output audio and keep the timestamps as is (was vice versa before)
- added new units demos, incl one for applyLowpass
author | SebastianEwert |
---|---|
date | Tue, 21 Jan 2014 18:08:28 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
27:5ab87a0152e7 | 28:76f45f5c9afd |
---|---|
1 function [f_audio_out,timepositions_afterDegr] = adthelper_normalizeAudio(f_audio, samplingFreq, timepositions_beforeDegr, parameter) | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % Name: adthelper_normalizeAudio | |
4 % Date of Revision: 2013-04 | |
5 % Programmer: Sebastian Ewert | |
6 % | |
7 % Description: | |
8 % - normalizes audio | |
9 % | |
10 % Input: | |
11 % f_audio - audio signal \in [-1,1]^{NxC} with C being the number of | |
12 % channels | |
13 % samplingFreq - sampling frequency of f_audio | |
14 % timepositions_beforeDegr - some degradations delay the input signal. If | |
15 % some points in time are given via this | |
16 % parameter, timepositions_afterDegr will | |
17 % return the corresponding positions in the | |
18 % output. Set to [] if unavailable. Set f_audio | |
19 % and samplingFreq to [] to compute only | |
20 % timepositions_afterDegr. | |
21 % | |
22 % Input (optional): parameter | |
23 % .maxAmplitude = 0.999; | |
24 % | |
25 % Output: | |
26 % f_audio_out - audio signal \in [-1,1]^{NxC} with C being the number of | |
27 % channels | |
28 % timepositions_afterDegr - time positions corresponding to timepositions_beforeDegr | |
29 % | |
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
31 | |
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
33 % Audio Degradation Toolbox | |
34 % | |
35 % Centre for Digital Music, Queen Mary University of London. | |
36 % This file copyright 2013 Sebastian Ewert, Matthias Mauch and QMUL. | |
37 % | |
38 % This program is free software; you can redistribute it and/or | |
39 % modify it under the terms of the GNU General Public License as | |
40 % published by the Free Software Foundation; either version 2 of the | |
41 % License, or (at your option) any later version. See the file | |
42 % COPYING included with this distribution for more information. | |
43 % | |
44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
45 | |
46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
47 % Check parameters | |
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
49 if nargin<4 | |
50 parameter=[]; | |
51 end | |
52 if nargin<3 | |
53 timepositions_beforeDegr=[]; | |
54 end | |
55 if nargin<2 | |
56 error('Please specify input data'); | |
57 end | |
58 if isfield(parameter,'maxAmplitude')==0 | |
59 parameter.maxAmplitude = 0.999; | |
60 end | |
61 | |
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
63 % Main program | |
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
65 | |
66 f_audio_out = []; | |
67 if ~isempty(f_audio) | |
68 f_audio_out = parameter.maxAmplitude * f_audio / max(max(max(abs(f_audio))),eps); | |
69 end | |
70 | |
71 % This function does not impose a delay | |
72 timepositions_afterDegr = timepositions_beforeDegr; | |
73 | |
74 end | |
75 | |
76 | |
77 |