-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a description for maxobjects and a helper header file
- Loading branch information
Showing
4 changed files
with
309 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
sc.whitenoise~ equal power noise Generates noise whose spectrum has equal power at all frequencies | ||
|
||
sc.brownnoise~ browninan motion Generates noise whose spectrum falls off in power by 6 dB per octave | ||
sc.clipnoise~ Clip Noise. Generates noise whose spectrum falls off in power by 3 dB per octave. | ||
sc.crackle~ Chaotic noise function. A noise generator based on a chaotic function. | ||
sc.dust~ Random Impulses. Generates random impulses from 0 to +1. | ||
sc.dust2~ Random Impulses. Generates random impulses from -1 to +1. | ||
sc.gendy1~ An implementation of the dynamic stochastic synthesis generator conceived by Iannis Xenakis and described in Formalized Music | ||
sc.gendy2~ An implementation of the dynamic stochastic synthesis generator conceived by Iannis Xenakis and described in Formalized Music | ||
sc.gendy3~ An implementation of the dynamic stochastic synthesis generator conceived by Iannis Xenakis and described in Formalized Music | ||
sc.graynoise~ Generates noise which results from flipping random bits in a word. | ||
sc.lfclipnoise~ Clipped Noise. Randomly generates the values -1 or +1 at a rate given by the nearest integer division of the sample rate by the freq argument | ||
sc.lfnoise0~ Generates random values at a rate | ||
sc.lfnoise1~ Generates linearly interpolated random values at a rate | ||
sc.lfnoise2~ Generates quadratically interpolated random values at a rate | ||
sc.logistic~ chaotic noise function. A noise generator based on the logistic map y = chaosParam * y * (1.0 - y) | ||
sc.mantissamask~ Reduce Precision. Masks off bits in the mantissa of the floating point sample value | ||
sc.pinknoise~ 1/f noise Generates noise whose spectrum falls off in power by 3 dB per octave |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* scmax.h | ||
* (c) stephen lumenta under GPL | ||
* | ||
* conveniences for commonly used functions | ||
* some parts are friendly derived from tim blechmanns sc4pd project | ||
* | ||
* http://www.gnu.org/licenses/gpl.html | ||
* part of sc-max http://github.com/sbl/sc-max | ||
* see README | ||
*/ | ||
|
||
#ifndef SCMAX_H_XHP91X4G | ||
#define SCMAX_H_XHP91X4G | ||
|
||
#include <cmath> | ||
|
||
// rate conversions | ||
|
||
#undef SAMPLERATE | ||
#define SAMPLERATE sys_getsr() | ||
|
||
#undef BUFLENGTH | ||
#define BUFLENGTH sys_getblksize() | ||
|
||
float sc_radiansPerSample(){ | ||
return TWOPI / sys_getsr(); | ||
} | ||
|
||
float sc_bufDuration(){ | ||
return sys_getblksize() / sys_getsr(); | ||
} | ||
|
||
float sc_bufrate(){ | ||
return 1 / sc_bufDuration(); | ||
} | ||
|
||
float sc_slopeFactor(){ | ||
return 1 / sys_getblksize(); | ||
} | ||
|
||
int sc_filterLoops(){ | ||
return sys_getblksize() / 3; | ||
} | ||
|
||
int sc_filterRemain(){ | ||
return sys_getblksize() % 3; | ||
} | ||
|
||
float sc_filterSlope(){ | ||
float loops = sc_filterLoops(); | ||
if (loops == 0) | ||
return 0; | ||
else | ||
return 1. / loops; | ||
} | ||
|
||
// DSP loops | ||
|
||
#define ZXP(z) (*(z)++) | ||
|
||
|
||
|
||
#define LOOP(length, stmt) \ | ||
{ int xxn = (length); \ | ||
while (--xxn) { \ | ||
stmt; \ | ||
} \ | ||
} | ||
|
||
// math | ||
const double log001 = std::log(0.001); | ||
const double log01 = std::log(0.01); | ||
const double log1 = std::log(0.1); | ||
const double rlog2 = 1./std::log(2.); | ||
const double sqrt2 = std::sqrt(2.); | ||
const double rsqrt2 = 1. / sqrt2; | ||
const float pi_f = std::acos(-1.f); | ||
const float pi2_f = pi_f * 0.5f; | ||
const float pi32_f = pi_f * 1.5f; | ||
const float twopi_f = pi_f * 2.f; | ||
const float sqrt2_f = std::sqrt(2.f); | ||
const float rsqrt2_f= 1.f/std::sqrt(2.f); | ||
|
||
|
||
typedef float float32; | ||
|
||
inline float32 zapgremlins(float32 x) | ||
{ | ||
float32 absx = abs(x); | ||
// very small numbers fail the first test, eliminating denormalized numbers | ||
// (zero also fails the first test, but that is OK since it returns zero.) | ||
// very large numbers fail the second test, eliminating infinities | ||
// Not-a-Numbers fail both tests and are eliminated. | ||
return (absx > (float32)1e-15 && absx < (float32)1e15) ? x : (float32)0.; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.