14 #define USE_TEST_MAIN // use the main() function in test_support.h
37 logMsg(
"playing clipped sin...");
56 double resp[] = { 0., 1., 0. };
57 double freq[] = { 0., 200., 250., 500., 600., 44100. };
58 double weight[] = { 10., 2., 10. };
74 logMsg(
"playing FIR filtered noise...");
86 logMsg(
"playing Butterworth high-passed white noise...");
95 logMsg(
"playing Butterworth band-passed white noise...");
103 logMsg(
"playing Butterworth low-passed white noise...");
111 logMsg(
"playing Butterworth band-rejected white noise...");
119 Notch notch(white5, 500.0f, 0.99995f);
120 logMsg(
"playing Notch filtered white noise...");
127 Formant formant(white6, 100.0f, 0.5f);
128 logMsg(
"playing Formant filtered white noise...");
136 logMsg(
"playing All-passed square wave...");
141 float bcoeffs[3] = {0.05f, 0.0f, -0.0496f};
142 float acoeffs[2] = {-1.843f, 0.9f};
144 Filter filter(white0, bcoeffs ,acoeffs, 3, 2);
145 logMsg(
"playing BP filtered white noise...");
166 logMsg(
"playing biquad high-passed white noise...");
171 logMsg(
"playing biquad band-passed white noise...");
176 logMsg(
"playing biquad low-passed white noise (Q = 1)...");
181 logMsg(
"playing biquad low-passed white noise (Q = 4)...");
186 logMsg(
"playing biquad low-passed white noise (Q = 12)...");
191 logMsg(
"playing biquad band-rejected white noise...");
196 logMsg(
"playing biquad peaked white noise...");
201 logMsg(
"playing biquad peaked white noise2...");
206 logMsg(
"playing biquad low shelf white noise...");
211 logMsg(
"playing biquad low shelf white noise...");
216 logMsg(
"playing biquad hi shelf white noise...");
221 logMsg(
"playing biquad hi shelf white noise...");
234 logMsg(
"playing dynamic Butterworth band-passed white noise...");
250 logMsg(
"playing filtered snd file...");
260 float scale = 3.0f / (float) num;
262 for (
int i = 0; i < num; i++) {
273 logMsg(
"playing mix of %d Butterworth band-passed white noise layers...", num);
283 ADSR mChiffEnv(1, 0.01, 0.01, 0.0, 1.5);
292 logMsg(
"playing Reverb test\n");
294 for (
unsigned i = 0; i < 4; i++) {
306 ADSR mEnv(1, 0.005, 0.01, 0.0, 1.5);
308 float ctrFrq =
fRandB(3000, 1000);
313 Panner mPanner(mFilter, 0.0);
322 logMsg(
"playing Stereoverb test\n");
323 for (
unsigned i = 0; i < 10; i++) {
338 ADSR mChiffEnv(1, 0.01, 0.01, 0.0, 1.5);
362 logMsg(
"playing multi-tap delay test\n");
364 for (
unsigned i = 0; i < 4; i++) {
380 vox.setFrequency(f_env);
384 logMsg(
"playing random gliss in a block up-sizer...");
396 vox.setFrequency(f_env);
400 logMsg(
"playing random gliss in a block down-sizer...");
423 logMsg(
"playing splitter/joiner/mixer-based crossover filter...");
451 logMsg(
"playing splitter/joiner/mixer-based crossover filter...");
463 vox.setFrequency(f_env);
473 logMsg(
"playing fan-out + mixer 1...");
485 vox.setFrequency(f_env);
496 logMsg(
"playing fan-out + mixer 2...");
509 float duration = 4.0f;
516 for (
unsigned i = 0; i < 4; i++) {
520 insts.push_back(pan);
522 logMsg(
"playing mix of 4 sweep layers...");
528 for (
unsigned i = 0; i < 2; i++)
534 for (
unsigned i = 0; i < 4; i++) {
544 for (
unsigned i = 2; i < 5; i++)
550 for (
unsigned i = 0; i < 2; i++) {
559 for (
unsigned i = 0; i < 6; i++)
561 logMsg(
"removed all but one");
577 unsigned numFrames = outputBuffer.mNumFrames;
584 for (
unsigned i = 0; i < numFrames; i++) {
585 val = *inPtr++ * mCoeff;
586 *out++ = val + mStore;
600 logMsg(
"playing filtered snd file...");
624 "Clipper",
testClipper,
"Demonstrate the signal clipper",
625 "FIR filter",
testFIR,
"Play an FIR band-pass filter",
626 "All filters",
testFilters,
"Test different filter types",
627 "Biquad filters",
testBiquads,
"Test biquad filter types",
631 "Reverb",
testReverb,
"Show mono reverb on impulses",
633 "Multi-tap delay",
testMultiTap,
"Play a multi-tap delay line",
634 "Split/Join filter",
testSplitJoin1,
"Play a splitter/joiner cross-over filter",
635 "Split/Join/Mix filter",
testSplitJoin2,
"Play a splitter/joiner/mixer cross-over filter",
636 "FanOut + Mixer 1",
testFanMix1,
"Play a sound through fan-out + mixer",
637 "FanOut + Mixer 2",
testFanMix2,
"Play a sound through fan-out + mixer",
641 "Sample-avg filter",
testSAFilter,
"Demo in-line sample-average-filter class",
sample * SampleBuffer
1-channel buffer data type, vector of (sample)
void logMsg(const char *format,...)
These are the public logging messages.
void testFanMix1()
Test a fan-out + mixer using UnitGenerator's built-in fan-out.
void pullInput(Buffer &outputBuffer)
void testFIR()
Test the FIR filter - LPF @ 300 Hz on pink noise.
RingBuffer is the storage + a default reader.
void setOffset(int offset)
void testFilters()
Filter tests.
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
Effect – mix-in for classes that have unit generators as inputs (like filters).
virtual void trigger()
reset internal time to restart envelope
Regularizes the amount of data called for. This is useful for time-frequency transformations that onl...
UnitGenerator * createRandFreqEnvPatch(float dur)
Function to create and answer a RandFreqEnv UGen patch this is in test envelopes. ...
void testSplitJoin2()
Test a Split/Join with a cross-over filter pair LPF to left, HPF to the right mixer added in just for...
UGenVector * getInputs(void)
void nextBuffer(Buffer &outputBuffer, unsigned outBufNum)
really compute the next buffer given an offset base channel; this is called by nextBuffer, possibly multiple times
void setRoomSize(float size)
Setting the room size makes longer tails. The value has a range from 0 to 1.
RingBufferTap mTap
internal tap so a RingBuffer can also be a a UnitGenerator
void testDynamicFilters()
Test dynamic BP filter.
Filter: the canonical-form n-pole/m-zero filter class.
White noise – equal power per frequency.
void removeInput(UnitGenerator &inp)
Notch Filter with poles at +-z and complex conjugate zeros at +-omega.
struct used for the JUCE pop-up menu of tests (see the test files)
void testBlockDownsizer()
Test a block resizer by running a random gliss with a huge block size.
Square oscillator class (non-band-limited)
Allpass Filter with a pole and a zero at equal frequency and straddling the unit circle. Allows all freqs to pass through but messes with phases.
void testMultiTap()
Play noise bursts into multi-tap delay line.
void testBlockUpsizer()
Test a block resizer by running a random gliss with a small block size.
void testDynamicVoice()
Test dynamic BP filter on a sound file.
float fRandM(float minV, float maxV)
min - max (min/max)
General-purpose Biquad IIR (2nd order recursive) filter. This is simplified and optimized, but doesn't support dynamic or scalable controls. It uses inst vars rather than arrays for the coefficients. NB: peak gain (dB) is used only for the peak and shelf types)
float fRandB(float base, float range)
b +- r (base)
void setPosition(UnitGenerator &pan)
Operations.
void testStereoverb()
Play noise bursts into reverb.
void testClipper()
Clip some sound.
void setRoomSize(float size)
CSL port of the public domain Freeverb reverberator.
ADSR = 4-segment attack/decay/sustain/release envelope class.
std::vector< UnitGenerator * > UGenVector
Splitter class – a de-multiplexer for multi-channel signals.
void testNDynamicFilters()
Pan and mix many sines.
void testReverb()
Play noise bursts into reverb.
void runTest(UnitGenerator &vox, double dur)
MulOp – A BinaryOp that multiplies two UnitGenerators or fixed constants together, sample-by-sample.
void scaleInput(UnitGenerator &inp, float val)
set the scale of an input
void setFrequency(UnitGenerator &frequency)
set the receiver's frequency to a UGen or a float
RingBufferTap is a reader that loops over a buffer.
RandEnvelope envelope class – makes random control signals using a single line segment.
Butterworth IIR (2nd order recursive) filter.
void setFrequency(UnitGenerator &frequency)
Setter accessors.
void setRoot(UnitGenerator &root)
set/clear my graph root generator
Buffer – the multi-channel sample buffer class (passed around between generators and IO guys)...
Mixer – The n-input m-channel mixer class.
void testSplitJoin1()
Test a Split/Join with a cross-over filter pair LPF to left, HPF to the right.
Joiner class – a multiplexer for multi-channel signals.
AR = 3-segment attack/release envelope class.
The CSL mono-to-stereo L/R panner class.
void testFanMix2()
Test a real fan-out + mixer.
void addInput(UnitGenerator &inp)
void testDynamicMixer()
Mix a few sources, adding/dropping graphs.
float fRand1(void)
-1 - 1 (one)
SAFliter(UnitGenerator &in, float coeff=0.5f)
void setScale(UnitGenerator &scale)
set the receiver's scale member to a UGen or a float
A fan-out generator for DSP graphs with loops.
Pink noise – equal power per octave.
Base class of CSL exceptions (written upper-case). Has a string message.
static std::string dataFolder()
the default directory for test data