2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "SC_PlugIn.h"
26 //#define PI 3.1415926535898f
27 //#define TWOPI 6.28318530717952646f
29 extern InterfaceTable
*ft
;
32 extern int eqlbandbins
[43];
33 extern int eqlbandsizes
[42];
34 extern float contours
[42][11];
35 extern double phons
[11];
37 //#include "KeyTrack.h"
38 #include "BeatTrack.h"
39 //#include "Loudness.h"
42 #include "BeatTrack2.h"
44 struct Loudness
: Unit
{
57 struct KeyTrack
: Unit
{
62 //coping with different sampling rates
63 float m_srate
; //use as a flag to check sample rate is correct
64 float * m_weights
; //will point to the sample rate specific data
71 //experimental transient avoidance
72 //float m_prevphase[720]; //60*12
73 //float m_leaknote[60];
78 float m_histogram
[24]; //key histogram
79 //float m_keyleak; //fade parameter for histogram
89 int m_numcoefficients
;
95 //sampling rate specific data
100 float * m_bandweights
;
104 //////////////////////////////////////////////////////////////////////////////////////////////////
106 struct FFTAnalyser_Unit
: Unit
110 // Not always used: multipliers which convert from bin indices to freq vals, and vice versa.
111 // See also the macros for deriving these.
112 float m_bintofreq
/* , m_freqtobin */;
113 float m_halfnyq_over_numbinsp2
;
116 struct FFTAnalyser_OutOfPlace
: FFTAnalyser_Unit
122 struct SpecFlatness
: FFTAnalyser_Unit
127 struct SpecPcile
: FFTAnalyser_OutOfPlace
132 struct SpecCentroid
: FFTAnalyser_Unit
140 //required interface functions
141 void Loudness_next(Loudness
*unit
, int wrongNumSamples
);
142 void Loudness_Ctor(Loudness
*unit
);
143 void Loudness_Dtor(Loudness
*unit
);
145 void KeyTrack_next(KeyTrack
*unit
, int wrongNumSamples
);
146 void KeyTrack_Ctor(KeyTrack
*unit
);
147 void KeyTrack_Dtor(KeyTrack
*unit
);
149 void MFCC_next(MFCC
*unit
, int wrongNumSamples
);
150 void MFCC_Ctor(MFCC
*unit
);
151 void MFCC_Dtor(MFCC
*unit
);
153 void SpecFlatness_Ctor(SpecFlatness
*unit
);
154 void SpecFlatness_next(SpecFlatness
*unit
, int inNumSamples
);
156 void SpecPcile_Ctor(SpecPcile
*unit
);
157 void SpecPcile_next(SpecPcile
*unit
, int inNumSamples
);
158 void SpecPcile_Dtor(SpecPcile
*unit
);
160 void SpecCentroid_Ctor(SpecCentroid
*unit
);
161 void SpecCentroid_next(SpecCentroid
*unit
, int inNumSamples
);