Marsyas
0.6.0-alpha
|
00001 /* 00002 ** Copyright (C) 1998-2010 George Tzanetakis <gtzan@cs.uvic.ca> 00003 ** 00004 ** This program is free software; you can redistribute it and/or modify 00005 ** it under the terms of the GNU General Public License as published by 00006 ** the Free Software Foundation; either version 2 of the License, or 00007 ** (at your option) any later version. 00008 ** 00009 ** This program is distributed in the hope that it will be useful, 00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 ** GNU General Public License for more details. 00013 ** 00014 ** You should have received a copy of the GNU General Public License 00015 ** along with this program; if not, write to the Free Software 00016 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef MARSYAS_CONVERSIONS_H 00020 #define MARSYAS_CONVERSIONS_H 00021 00022 #include <marsyas/common_header.h> 00023 00024 #include <cmath> 00025 #include <string> 00026 00027 namespace Marsyas 00028 { 00035 marsyas_EXPORT mrs_real pitch2hertz(mrs_real pitch); 00036 marsyas_EXPORT mrs_real hertz2pitch(mrs_real hz); 00037 00038 marsyas_EXPORT mrs_natural hertz2samples(mrs_real hz, mrs_real srate); 00039 00040 marsyas_EXPORT mrs_real samples2hertz(mrs_real samples, mrs_real srate); 00041 marsyas_EXPORT mrs_real samples2hertz(mrs_natural samples, mrs_real srate); 00042 00043 marsyas_EXPORT mrs_natural time2samples(std::string time, mrs_real srate); 00044 marsyas_EXPORT mrs_natural time2usecs(std::string time); 00045 00046 marsyas_EXPORT mrs_real amplitude2dB(mrs_real a); 00047 marsyas_EXPORT mrs_real dB2amplitude(mrs_real a); 00048 00049 marsyas_EXPORT mrs_real hertz2octs(mrs_real f, mrs_real middleAfreq = 440.0); 00050 00051 marsyas_EXPORT mrs_real hertz2bark(mrs_real f, mrs_natural mode = 0); 00052 marsyas_EXPORT mrs_real bark2hertz(mrs_real f, mrs_natural mode = 0); 00053 00054 marsyas_EXPORT mrs_real hertz2erb(mrs_real f); 00055 marsyas_EXPORT mrs_real erb2hertz(mrs_real e); 00056 00057 marsyas_EXPORT mrs_real hertz2mel(mrs_real f, bool htk = false); 00058 marsyas_EXPORT mrs_real mel2hertz(mrs_real z, bool htk = false); 00059 00060 marsyas_EXPORT mrs_real bin2hertz(mrs_natural bin, mrs_real nyquistFreq, 00061 mrs_real framerate); 00062 00063 marsyas_EXPORT mrs_natural powerOfTwo(mrs_real v); 00064 00065 marsyas_EXPORT void string2parameters(std::string s, realvec &v, char d); 00066 00067 }//namespace Marsyas 00068 00069 #endif