ReassignedSpectrum.h

00001 #ifndef INCLUDE_REASSIGNEDSPECTRUM_H
00002 #define INCLUDE_REASSIGNEDSPECTRUM_H
00003 /*
00004  * This is the Loris C++ Class Library, implementing analysis, 
00005  * manipulation, and synthesis of digitized sounds using the Reassigned 
00006  * Bandwidth-Enhanced Additive Sound Model.
00007  *
00008  * Loris is Copyright (c) 1999-2007 by Kelly Fitz and Lippold Haken
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY, without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  *
00025  * ReassignedSpectrum.h
00026  *
00027  * Definition of class Loris::ReassignedSpectrum.
00028  *
00029  * Kelly Fitz, 7 Dec 1999
00030  * loris@cerlsoundgroup.org
00031  *
00032  * http://www.cerlsoundgroup.org/Loris/
00033  *
00034  */
00035 
00036 #include "FourierTransform.h"
00037 #include <vector>
00038 
00039 //  begin namespace
00040 namespace Loris {
00041 
00042 // ---------------------------------------------------------------------------
00043 //  class ReassignedSpectrum
00044 //
00047 //  
00048 class ReassignedSpectrum
00049 {
00050 //  -- public interface --
00051 public:
00054     typedef FourierTransform::size_type size_type;
00055 
00056 //  --- lifecycle ---
00057 
00061     ReassignedSpectrum( const std::vector< double > & window );
00062 
00063     // compiler-generated copy, assign, and destroy are sufficient
00064 
00065 //  --- operations ---
00066 
00083     void transform( const double * sampsBegin, const double * pos, const double * sampsEnd );
00084     
00085 //  --- inquiry ---
00086 
00088     size_type size( void ) const;   
00089 
00093     const std::vector< double > & window( void ) const;
00094     
00095 
00096 //  --- reassigned transform access ---
00097         
00105     double convergence( long idx ) const;
00106 
00112     double reassignedFrequency( long idx ) const;
00113 
00119     double reassignedMagnitude( long idx ) const;
00120 
00128     double reassignedPhase( long idx ) const;   
00129 
00135     double reassignedTime( long idx ) const;
00136 
00137 //  --- reassignment operations ---
00138     
00147     double frequencyCorrection( long sample ) const;
00148 
00155     double timeCorrection( long sample ) const;
00156 
00157 //  --- legacy support ---
00158 
00159     //  These members are deprecated, and included only
00160     //  to support old code. New code should use the
00161     //  corresponding documented members.
00162     //  All of these members are deprecated.
00163     
00164     double reassignedPhase( long idx, double, double ) const
00165         { return reassignedPhase( idx ); }
00166     double reassignedMagnitude( double, long intBinNumber ) const
00167         { return reassignedMagnitude( intBinNumber ); }
00168     
00169     //  subscript operator
00170     //  The signature has changed, can no longer return a reference,
00171     //  but since the reference returned was const, this version should 
00172     //  keep most old code working, if not all.
00173     std::complex< double > operator[]( unsigned long idx ) const;
00174     
00175 private:
00176 //  -- instance variables --
00177 
00179     FourierTransform mMagnitudeTransform;
00180     
00182     FourierTransform mCorrectionTransform;
00183     
00185     std::vector< double > mWindow;
00186     
00188     std::vector< std::complex< double > > mMagnitudeTransformWindow;
00189 
00191     std::vector< std::complex< double > > mCorrectionTransformWindow;
00192         
00193 };  //  end of class ReassignedSpectrum
00194 
00195 }   //  end of namespace Loris
00196 
00197 #endif /* ndef INCLUDE_REASSIGNEDSPECTRUM_H */

Generated on Sat Jan 19 19:02:50 2008 for Loris by  doxygen 1.5.2