aboutsummaryrefslogtreecommitdiff
path: root/pvtuner.h
blob: 6f51fc8aa738bafaadb893a3411d40093dca9929 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#define MAXTONES (1024)
#define BASE_FREQ (27.5)	/* low A  */
#define DIATONIC 0
#define EASTERN 1
#define MINOR 2
#define EQ12 3
#define PENTATONIC 4
#define MAJOR_ADDED_SIXTH 5
#define MINOR_ADDED_SIXTH 6
#define MAJOR_SEVENTH_CHORD 7
#define MINOR_SEVENTH_CHORD 8
#define DOMINANT_SEVENTH_CHORD 9
#define EQ8 10
#define PENTACLUST 11
#define QUARTERCLUST 12
#define EQ5 13
#define SLENDRO 14
#define PELOG 15
#define IMPORTED_SCALE 16

#define DEFAULT_VECTOR_SIZE 512
static t_class *pvtuner_class;

typedef struct _pvtuner
{
  t_object x_obj;
  t_float x_f;
  int R;
  int	N;
  int	N2;
  int	Nw;
  int	Nw2; 
  int	D; 
  int	i;
  int	inCount;
  float *Wanal;	
  float *Wsyn;	
  float *input;	
  float *Hwin;
  float *buffer;
  float *channel;
  float *output;
  // for convert
  float *c_lastphase_in;
  float *c_lastphase_out;
  float c_fundamental;
  float c_factor_in;
  float c_factor_out;

  // for oscbank
  int NP;
  float P;
  int L;
  int first;
  float Iinv;
  float *lastamp;
  float *lastfreq;
  float *bindex;
  float *table;
  float myPInc;
  float ffac;
  //
  int lo_bin;
  int hi_bin;
  float topfreq;
  float synt;
  float myPI;
  float TWOmyPI;
  // for fast fft
  float mult; 
  float *trigland;
  int *bitshuffle;
  //
  float *prebuffer;
  float *postbuffer;
  //
  int bypass_state;
  int pitch_connected;
  int synt_connected;
  // TUNING
  float *pitchgrid ;
  float pbase ;
  int scale_steps;
  short current_scale;
  short mute;
  //
  float TWOPIoL;
  float user_lofreq;
  float user_hifreq;
  int vector_size;
  float funda;
  float curfreq;
  int overlap;
  int window_factor;
  float tabscale;
  int quality;
  int scale_len;
} t_pvtuner;


float closestf(float test, float *arr) ;
void pvtuner_diatonic( t_pvtuner *x );
void pvtuner_eastern( t_pvtuner *x );
void pvtuner_minor( t_pvtuner *x );
void pvtuner_eq12( t_pvtuner *x );
void pvtuner_pentatonic( t_pvtuner *x );
void pvtuner_major_added_sixth( t_pvtuner *x );
void pvtuner_minor_added_sixth( t_pvtuner *x );
void pvtuner_major_seventh_chord( t_pvtuner *x );
void pvtuner_minor_seventh_chord( t_pvtuner *x );
void pvtuner_dominant_seventh_chord( t_pvtuner *x );
void pvtuner_eq8( t_pvtuner *x );
void pvtuner_pentaclust( t_pvtuner *x );
void pvtuner_quarterclust( t_pvtuner *x );
void pvtuner_eq5( t_pvtuner *x );
void pvtuner_slendro( t_pvtuner *x );
void pvtuner_pelog( t_pvtuner *x );
void pvtuner_update_imported( t_pvtuner *x );