Updated SWH plugins and added missing hermes_filter plugin
[lmms/mlankhorst.git] / include / fft_helpers.h
blobc6c941c43338464255488374819e8bafbadf5d9d
1 /*
2 * fft_helpers.h - some functions around FFT analysis
4 * Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
5 *
6 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
26 #ifndef _FFT_HELPERS_H
27 #define _FFT_HELPERS_H
29 #include "lmmsconfig.h"
30 #include "export.h"
32 #ifdef LMMS_HAVE_FFTW3F
34 #include <fftw3.h>
36 const int FFT_BUFFER_SIZE = 2048;
38 enum WINDOWS
40 KAISER=1,
41 RECTANGLE,
42 HANNING,
43 HAMMING
46 /* returns biggest value from abs_spectrum[spec_size] array
48 * returns -1 on error
50 float EXPORT maximum( float * _abs_spectrum, unsigned int _spec_size );
52 /* apply hanning or hamming window to channel
54 * returns -1 on error
56 int EXPORT hanming( float * _timebuffer, int _length, WINDOWS _type );
58 /* compute absolute values of complex_buffer, save to absspec_buffer
59 * take care that - compl_len is not bigger than complex_buffer!
60 * - absspec buffer is big enough!
62 * returns 0 on success, else -1
64 int EXPORT absspec( fftwf_complex * _complex_buffer, float * _absspec_buffer,
65 int _compl_length );
67 /* build fewer subbands from many absolute spectrum values
68 * take care that - compressedbands[] array num_new elements long
69 * - num_old > num_new
71 * returns 0 on success, else -1
73 int EXPORT compressbands( float * _absspec_buffer, float * _compressedband,
74 int _num_old, int _num_new, int _bottom, int _top );
77 int EXPORT calc13octaveband31( float * _absspec_buffer, float * _subbands,
78 int _num_spec, float _max_frequency );
80 /* compute power of finite time sequence
81 * take care num_values is length of timesignal[]
83 * returns power on success, else -1
85 float EXPORT signalpower(float *timesignal, int num_values);
87 #endif
89 #endif