ofxPDSP
ofxPDSPFunctions.h
1 
2 #ifndef OFXPDSP_FUNCTIONS_INCLUDED
3 #define OFXPDSP_FUNCTIONS_INCLUDED
4 
5 #include "../DSP/core/Preparable.h"
6 #include "../DSP/utility/PitchToFreq.h"
7 #include "../DSP/utility/DBtoLin.h"
8 #include "../math/random/random.h"
9 
10 
11 
16 float dB ( float dBvalue );
17 
18 
19 namespace pdsp{
20 
25 float panL ( float pan );
26 
31 float panR ( float pan );
32 
37 float f2p( float freq);
38 
39 
45 float pratio ( float pitch, float ratio );
46 
47 
51 int highestPartial( float pitch );
52 
53 
57 inline_f float urand( ){
58  return randomUnipolarInclusive();
59 };
60 
65 inline_f float brand(){
66  return randomBipolar();
67 };
68 
74 inline_f int dice( int min, int maxExclusive ){
75  return (dice(maxExclusive-min) + min);
76 };
77 
78 
87 float spread(int index, int max, float spread, bool fromCenter = false);
88 
89 
94 float p2f( float pitch);
95 
96 } // end namespace
97 
98 
99 
104 
105  friend float pdsp::p2f( float pitch);
106  friend float pdsp::pratio( float pitch, float ratio);
107  friend int pdsp::highestPartial( float pitch );
108  friend float pdsp::f2p( float freq );
109  friend float panL ( float pan );
110  friend float panR ( float pan );
111  friend float dB ( float dBvalue );
112  friend bool pdsp::chance( float chance );
113  friend float pdsp::urand( );
114  friend float pdsp::brand( );
115  friend int pdsp::dice( int sides );
116  friend int pdsp::dice( int min, int maxExclusive );
117  friend float pdsp::spread(int index, int max, float spread, bool fromCenter);
118 };
119 
120 
121 // ------------------------- OLD FUNCTIONS -----------------------------------
122 
128 [[deprecated("pdspSpread deprecated, use pdsp::spread instead")]]
129 inline float pdspSpread(int index, int max, float spread, bool fromCenter = false){
130  return pdsp::spread( index, max, spread, fromCenter );
131 }
132 
133 [[deprecated("pdspChance deprecated, use pdsp::chance instead")]]
134 inline_f bool pdspChance( float value ){
135  return pdsp::chance(value);
136 };
137 
138 [[deprecated("pdspDice deprecated, use pdsp::dice instead")]]
139 inline_f int pdspDice( int sides ){
140  return pdsp::dice(sides);
141 };
142 
143 [[deprecated("pdspDice deprecated, use pdsp::dice instead")]]
144 inline_f int pdspDice( int min, int maxExclusive ){
145  return (pdsp::dice(maxExclusive-min) + min);
146 };
147 
148 [[deprecated("pdspURan deprecated, use pdsp::urand instead")]]
149 inline_f float pdspURan( ){
150  return pdsp::randomUnipolarInclusive();
151 };
152 
153 [[deprecated("pdspBRan deprecated, use pdsp::brand instead")]]
154 inline_f float pdspBRan(){
155  return pdsp::randomBipolar();
156 };
157 
163 #endif // OFXPDSP_FUNCTIONS_INCLUDED
float f2p(float freq)
take a frequency value as input an returns a pitch value. Standard reference tuning is 440hz...
Definition: ofxPDSPFunctions.cpp:4
deactivated documentation of some global functions ( ofxPDSPFunctions is just a dummy class for gener...
Definition: ofxPDSPFunctions.h:103
float pratio(float pitch, float ratio)
take a pitch value and a float ratio. The returns a pitch that is the pitch value of the frequency co...
Definition: ofxPDSPFunctions.cpp:8
inline_f float brand()
returns a random float value ranging from -1.0f to 1.0f. Use this instead of ofRandom() in the code t...
Definition: ofxPDSPFunctions.h:65
int highestPartial(float pitch)
take a pitch value as input an returns the highest partial before 20000hz of a waweform with that bas...
Definition: ofxPDSPFunctions.cpp:14
float spread(int index, int max, float spread, bool fromCenter=false)
returns a value for panning voices in an uniform distribution into the stereo panorama ...
Definition: ofxPDSPFunctions.cpp:64
float panL(float pan)
returns a float value you can use to multiply your signal for panning when patching to a left channel...
Definition: ofxPDSPFunctions.cpp:31
inline_f int dice(int min, int maxExclusive)
returns a random int value that ranges from min to maxExclusive-1
Definition: ofxPDSPFunctions.h:74
float p2f(float pitch)
take a pitch value as input an returns a frequency value. Standard reference tuning is 440hz...
Definition: ofxPDSPFunctions.cpp:60
Thread-safe value control with smoothing.
Definition: SequencerBridge.h:11
float panR(float pan)
returns a float value you can use to multiply your signal for panning when patching to a right channe...
Definition: ofxPDSPFunctions.cpp:44
inline_f float urand()
returns a random float value ranging from 0.0f, to the 1.0f. Use this instead of ofRandom() in the co...
Definition: ofxPDSPFunctions.h:57