2 Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
4 This file is part of aubio.
6 aubio is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 aubio is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with aubio. If not, see <http://www.gnu.org/licenses/>.
23 Vector scaling function
25 This object, inspired from the scale object in FTS, the jMax engine, scales
26 the values of a vector according to an affine function defined as follow:
28 \f$ y = (x - ilow)*(ohig-olow)/(ihig-ilow) + olow \f$
31 #ifndef _AUBIO_SCALE_H
32 #define _AUBIO_SCALE_H
39 typedef struct _aubio_scale_t aubio_scale_t;
41 /** create a scale object
43 \param flow lower value of output function
44 \param fhig higher value of output function
45 \param ilow lower value of input function
46 \param ihig higher value of output function
49 aubio_scale_t * new_aubio_scale(smpl_t flow, smpl_t fhig,
50 smpl_t ilow, smpl_t ihig);
51 /** delete a scale object
53 \param s scale object as returned by new_aubio_scale
56 void del_aubio_scale(aubio_scale_t *s);
57 /** scale input vector
59 \param s scale object as returned by new_aubio_scale
60 \param input vector to scale
63 void aubio_scale_do(aubio_scale_t *s, fvec_t * input);
64 /** modify scale parameters after object creation
66 \param s scale object as returned by new_aubio_scale
67 \param olow lower value of output function
68 \param ohig higher value of output function
69 \param ilow lower value of input function
70 \param ihig higher value of output function
73 uint_t aubio_scale_set_limits (aubio_scale_t *s, smpl_t ilow, smpl_t ihig,
74 smpl_t olow, smpl_t ohig);
80 #endif /* _AUBIO_SCALE_H */