1 ## Copyright (C) 1995-2012 Andreas Weingessel
3 ## This file is part of Octave.
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {} synthesis (@var{y}, @var{c})
21 ## Compute a signal from its short-time Fourier transform @var{y} and a
22 ## 3-element vector @var{c} specifying window size, increment, and
25 ## The values @var{y} and @var{c} can be derived by
28 ## [@var{y}, @var{c}] = stft (@var{x} , @dots{})
32 ## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at>
33 ## Description: Recover a signal from its short-term Fourier transform
35 function x = synthesis (y, c)
43 error ("synthesis: C must contain exactly 3 elements");
51 w_coeff = hanning (w_size);
53 w_coeff = hamming (w_size);
55 w_coeff = ones (w_size, 1);
57 error ("synthesis: window_type must be 1, 2, or 3");
61 st = fix ((w_size-inc) / 2);
62 z = z(st:st+inc-1, :);
63 w_coeff = w_coeff(st:st+inc-1);
67 z(:, i) = z(:, i) ./ w_coeff;
70 x = reshape(z, inc * nc, 1);