10 #define USE_TEST_MAIN // use the main() function in test_support.h
25 vox.setFrequency(line);
27 logMsg(
"playing gliss sin with linear segment...");
33 vox.setFrequency(line2);
34 logMsg(
"playing gliss sin with exponential segment...");
46 logMsg(
"playing swell sin with line segment...");
55 AR a_env(2, 0.6, 1.0);
59 logMsg(
"playing AR sin...");
69 AR a_env(2, 0.2, 1.0);
71 logMsg(
"playing AR sin 2...");
81 Envelope env(3, 0, 220, 0.7, 280, 1.3, 180, 2.0, 200, 3, 100);
86 vox.setFrequency(env);
88 logMsg(
"playing sin with BP envelope on frequency");
98 Envelope env(3, 0, 100, 0.7, 180, 1.3, 180, 2.0, 200, 3, 140);
99 Envelope env2(3, 0.0, 0, 1.0, 1, 2.5, 0, 2.75, 1, 3, 0);
100 vox.setFrequency(env);
102 logMsg(
"playing sin with BP envelopes on frequency & scale");
116 float duration = 3.0;
121 ADSR adsr(duration, attack, decay, sustain, release);
124 logMsg(
"playing sharp ADSR envelope.");
129 ADSR adsr2(duration, 0.5, 0, 1, 0.5);
131 logMsg(
"playing gradual ADSR envelope.");
139 #define BASE_FREQ 440.0
143 ADSR a_env(3, 0.1, 0.1, 0.5, 1);
144 ADSR i_env(3, 1.5, 0, 1, 0.4);
154 car.setFrequency(mod);
158 logMsg(
"playing ADSR FM\n");
174 logMsg(
"playing random gliss...");
189 vox->setFrequency(*f_env);
190 vox->setScale(*a_env);
201 for (
unsigned i = 0; i < 50; i++)
204 logMsg(
"playing mix of 50 random gliss oscs...");
218 vox.setFrequency(line);
219 ADSR a_env(2, 0.6, 0.1, 0.3, 1);
221 logMsg(
"playing env as VCA...");
233 ADSR a_env(3, 0.04, 0.2, 0.5, 1);
234 ADSR i_env(3, 1.0, 0, 1, 1.0);
237 ADSR mChiffEnv(3, 0.01, 0.01, 0.0, 2);
243 mVibrato.setScale(mVibEnv);
248 car.setOffset(mChFilter);
252 mod.setOffset(mVibrato);
253 car.setFrequency(mod);
265 logMsg(
"playing Fancy FM\n");
287 logMsg(
"playing mix of 50 random SOS oscs...");
297 for (
int i = 0; i < 30; i++)
317 for (
unsigned i = 0; i < 100; i++)
319 logMsg(
"playing mix of 100 random-env SOS oscs...");
351 "Glissando test",
testGliss,
"Demonstrate a glissando function",
352 "Swell on amplitude",
testSwell,
"Make an amplitude swell",
353 "Frequency envelope",
testFrequencyEnv,
"Play a note with a frequency envelope",
354 "AR sine",
testARSin,
"Play an AR (attack/release) amplitude envelope",
356 "AM/FM envelopes",
testAMFMEnvs,
"Test AM and FM envelopes",
357 "ADSR 2",
testADSR2,
"Play an ADSR (attack/decay/sustain/release)",
358 "ADSR FM",
testADSR_FM,
"Dual-envelope FM example",
359 "Rand Freq envelope",
testRandFreqEnv,
"Play a random-walk frequency envelope",
360 "50 Rand F/A envs",
test50RandFreqEnv,
"Test 50 random frequency envelope players",
364 "Many random SOS",
testManyRandSOS,
"Layer many SumOfSines instruments with envelopes",
void dump()
reset internal time to restart envelope
void testComplexEnvelope()
Make an envelope from scratch by adding breakpoints.
void logMsg(const char *format,...)
These are the public logging messages.
#define kFrequency
Enum for SumOfSines description formats.
void testARSin2()
Do the same using the Envelope as an effect.
virtual void dump()
Pretty-printer.
virtual void trigger()
reset internal time to restart envelope
#define BASE_FREQ
FM using 2 oscs and 2 ADSRs.
void testRandFreqEnv()
test the rand env as the freq of a SOS
void setRoomSize(float size)
Setting the room size makes longer tails. The value has a range from 0 to 1.
UnitGenerator * createRandFreqEnvPatch(float dur)
Function to create and answer a RandFreqEnv UGen patch.
White noise – equal power per frequency.
struct used for the JUCE pop-up menu of tests (see the test files)
A linearly interpolated segment – this has start and end values, and a duration (in seconds)...
void test50RandFreqEnv()
set up 50 RandFreqEnv patches
float fRandM(float minV, float maxV)
min - max (min/max)
void testAMFMEnvs()
Test an envelope applied to frequency & scale.
void testFancy_FM()
FM with vibrato (with AR-envelope), attack chiff (filtered noise with AR-envelope), and random freq. drift and ampl. swell envelopes.
UnitGenerator * sosNote(float dur, float frq, float amp)
CSL port of the public domain Freeverb reverberator.
ADSR = 4-segment attack/decay/sustain/release envelope class.
void addPartial(Partial *pt)
given a SHARC spectrum
#define kLine
LineSegment flags for line interpolation.
void addBreakpoint(float startTime, float value)
void runTest(UnitGenerator &vox, double dur)
void testGliss()
Apply a glissando to a sine with a LineSegment.
void testADSR2()
Demonstrate an ADSR.
void testSwell()
test an amplitude swell
void testEnvScale()
test the use of scaling
float fRandZ(void)
A variety of useful random-number functions.
RandEnvelope envelope class – makes random control signals using a single line segment.
Butterworth IIR (2nd order recursive) filter.
void setFrequency(UnitGenerator &frequency)
Setter accessors.
Mixer – The n-input m-channel mixer class.
void testARSin()
AM and FM using the dynamic scale and frequency inputs.
AR = 3-segment attack/release envelope class.
The CSL mono-to-stereo L/R panner class.
void addInput(UnitGenerator &inp)
float fRand1(void)
-1 - 1 (one)
void setScale(UnitGenerator &scale)
set the receiver's scale member to a UGen or a float
Envelope: a collection of LineSegments; may have an input (scale) and act like a processor, or have no input and act like a control UGen. I inherit Scalable setScale, setOffset for inputs.
void testFrequencyEnv()
Test an envelope applied to frequency.