-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathADDAC_Ntof.h
executable file
·70 lines (53 loc) · 1.55 KB
/
ADDAC_Ntof.h
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
/*
* ADDAC_Ntof
*
* Developer's blank page Class example
*
* in Arduino environment simply add at the very top:
#include <ADDAC_Ntof.h> // This loads the Class when compiling
ADDAC_Ntof Empty; // This Instantiates 1 Class with the name "Empty"
*
*
* then in BEHAVIOUR() add at a position of your choice:
unsigned int CV = Empty.update(random(0, 65535));
or if you want to write it straight out at channel 1 for ex.:
VCC.WriteChannel(1, Empty.update(random(0, 65535)) );
*
*
* or to simply get the current value back use:
*
*
*/
#ifndef ADDAC_Ntof_h
#define ADDAC_Ntof_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include <WProgram.h>
#endif
class ADDAC_Ntof{
public: // Functions to be called from Arduino Environment
/*! \brief Default constructor for ADDAC_Ntof. */
ADDAC_Ntof(void){};
float calc(float _midiNote, int _offset){
return pow(2,(_midiNote - _offset)/12) * 440;
};
float period(float _Notes05v, int _offset){
float Note= (_Notes05v *5.0f)*12.0f; // entre 0 e 5 oitavas
//Serial.print(" note:");
//Serial.print(Note);
Note= pow(2,(Note- _offset)/12) * 440;
//Serial.print(" freq:");
//Serial.print(Note);
float period = 1/(Note/1000000);
//if(period< 956.25) period= 956.25;
//else if(period>10000) period= 10000;
//Serial.print(" Period:");
//Serial.print(period);
return period;
}
float calc(float _val, float _factor);
float log10(float _x);
float CVstream; // Public Variables
};
#endif