Files
lmms/include/fft_helpers.h
Tobias Doerffel 3862229f6b added missing EXPORT-declarations
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1419 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-07-31 15:50:28 +00:00

90 lines
2.5 KiB
C

/*
* fft_helpers.h - some functions around FFT analysis
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _FFT_HELPERS_H
#define _FFT_HELPERS_H
#include "lmmsconfig.h"
#include "export.h"
#ifdef LMMS_HAVE_FFTW3F
#include <fftw3.h>
const int FFT_BUFFER_SIZE = 2048;
enum WINDOWS
{
KAISER=1,
RECTANGLE,
HANNING,
HAMMING
};
/* returns biggest value from abs_spectrum[spec_size] array
*
* returns -1 on error
*/
float EXPORT maximum( float * _abs_spectrum, unsigned int _spec_size );
/* apply hanning or hamming window to channel
*
* returns -1 on error
*/
int EXPORT hanming( float * _timebuffer, int _length, WINDOWS _type );
/* compute absolute values of complex_buffer, save to absspec_buffer
* take care that - compl_len is not bigger than complex_buffer!
* - absspec buffer is big enough!
*
* returns 0 on success, else -1
*/
int EXPORT absspec( fftwf_complex * _complex_buffer, float * _absspec_buffer,
int _compl_length );
/* build fewer subbands from many absolute spectrum values
* take care that - compressedbands[] array num_new elements long
* - num_old > num_new
*
* returns 0 on success, else -1
*/
int EXPORT compressbands( float * _absspec_buffer, float * _compressedband,
int _num_old, int _num_new, int _bottom, int _top );
int EXPORT calc13octaveband31( float * _absspec_buffer, float * _subbands,
int _num_spec, float _max_frequency );
/* compute power of finite time sequence
* take care num_values is length of timesignal[]
*
* returns power on success, else -1
*/
float EXPORT signalpower(float *timesignal, int num_values);
#endif
#endif