12 #define USE_TEST_MAIN // use the main() function in test_support.h
32 vox.setFrequency(gliss);
35 logMsg(
"playing swept sin with line segment...");
46 logMsg(
"playing simple sin...");
51 logMsg(
"playing sin-as-phased...");
56 logMsg(
"playing sin-as-scaled...");
67 Sine sine(freq, ampl);
68 logMsg(
"playing computed sin...");
75 Osc wav(freq, ampl, 0.0, 0.0);
76 logMsg(
"playing wavetable sin...");
82 logMsg(
"playing sawtooth...");
88 logMsg(
"playing square...");
104 logMsg(
"playing quiet sin1 (setScale)...");
106 logMsg(
"quiet sin done.");
110 MulOp mul(sineOsc2, 0.4);
111 logMsg(
"playing quiet sin2 (MulOp)...");
114 logMsg(
"quiet sin done.");
119 MulOp mul2(sineOsc3, var);
120 logMsg(
"playing quiet sin3 (StaticVar)...");
122 logMsg(
"quiet sin done.");
128 #define TABLE_SIZE 128
132 float * ptr = & sineTable[0];
139 Buffer oscBuff(1, TABLE_SIZE);
144 logMsg(
"playing truncating wavetable...");
149 logMsg(
"playing interpolating wavetable...");
158 Osc AMmod(6, 0.3, 0.4);
162 logMsg(
"Simple AM/FM sin Examples");
164 logMsg(
"playing AM sin...");
169 Osc FMmod(4, 40, 220);
170 osc2.setFrequency(FMmod);
173 logMsg(
"playing FM sin...");
182 Osc AMmod(6, 0.2, 0.8);
183 Osc FMmod(110, 10, 110);
185 osc.setFrequency(FMmod);
186 logMsg(
"Dumping AM/FM sin...");
189 logMsg(
"Playing AM/FM sin...");
191 logMsg(
"AM/FM sin done.\n");
201 logMsg(
"Sum of sines Examples");
203 logMsg(
"playing uncached sum of sines...");
205 logMsg(
"sum of sines done.\n");
209 logMsg(
"playing cached sum of sines...");
211 logMsg(
"sum of sines done.\n");
222 logMsg(
"Sum of sines 1/f");
224 logMsg(
"sum of sines done.\n");
233 logMsg(
"playing sum of sines loop...");
234 for (
unsigned i = 3; i < 11; i++) {
239 logMsg(
"sum of sines done.");
248 1.2, 0.1, 3.0, 1.34, 0.02, 4.0);
252 logMsg(
"playing uncached sum of sines...");
254 logMsg(
"sum of sines done.");
260 SoundFile fi(CGestalt::dataFolder() +
"oo_table.aiff");
261 fi.openForRead(
true);
262 logMsg(
"Loading sound file %s = %d frames @ %d Hz", fi.path().c_str(), fi.duration(), fi.playbackRate());
264 Buffer oscBuff(1, fi.duration());
265 oscBuff.
setBuffer(0, fi.mWavetable.buffer(0));
266 oscBuff.mAreBuffersAllocated =
true;
267 oscBuff.mNumAlloc = fi.duration();
270 wav.setFrequency(440.0);
272 logMsg(
"playing wavetable from file...");
284 SHARCLibrary::loadDefault();
291 ADSR adsr(2, 0.04, 0.1, 0.6, 1.0);
293 logMsg(
"playing SHARC sum of sines...");
303 SHARCLibrary::loadDefault();
329 logMsg(
"playing SHARC vector synth (oboe, tuba, viola)...");
360 "Sweep/swell test",
testSweep,
"Test a sine with swept freq and volume swell",
362 "Standard waveforms",
testBasicWaves,
"Demonstrate the standard wave forms",
363 "Scaled sine",
testScaledSin,
"Play a scaled-quiet sine wave",
365 "AM/FM sines",
testAMFMSin,
"Play an AM and FM sine wave",
366 "Dump AM/FM sines",
dumpAMFMSin,
"Dump the graph of the AM/FM sine",
373 "SHARC SOS",
test_SHARC,
"Load/print the SHARC timbre database, play example",
374 "Vector SHARC",
test_SHARC2,
"Show vector cross-fade of SHARC spectra",
SimpleSine – The simplest CSL sine oscillator class.
void logMsg(const char *format,...)
These are the public logging messages.
#define kFrequency
Enum for SumOfSines description formats.
SineAsPhased – A sine oscillator that uses the Phased mix-in class, meaning that we inherit mFrequen...
void dump()
Prints instance info.
virtual void setBuffer(unsigned bufNum, SampleBuffer sPtr)
bool sleepMsec(float dur)
bool mAreBuffersAllocated
are the buffers allocated?
void dumpAMFMSin()
use the dumpTest call to dump the whole graph
void dumpTest(UnitGenerator &vox)
virtual void trigger()
reset internal time to restart envelope
void testScaledSin()
Scaled sine wave – 3 methods: with a MulOp and using the Sine's scale input.
Sawtooth oscillator class (non-band-limited)
SHARCSpectrum ** _spectra
void test_SHARC()
Test loading the SHARC samples.
void testSimpleSines()
Simplest sine wave tests using the tutorial example classes.
void setRoomSize(float size)
Setting the room size makes longer tails. The value has a range from 0 to 1.
void testBasicWaves()
Test/demonstrate the basic waveform oscillators.
void dump()
pretty-print the receiver
virtual void dump()
pretty-print the receiver
StaticVariable – he static external variable (plug) class. This is a kind of variable that holds ont...
struct used for the JUCE pop-up menu of tests (see the test files)
void testWaveTableFromFile()
Load an oscillator's wave table from a file – a single cycle of the vowel "oo" from the word "moon"...
SHARCInstrument * instrument_named(const char *name)
SineAsScaled – A sine oscillator that also has scale and offset as dynamic controls (from Scalable) ...
Square oscillator class (non-band-limited)
A linearly interpolated segment – this has start and end values, and a duration (in seconds)...
void testSweep()
Apply a glissando and swell to a sine oscillator with LineSegments.
static SHARCSpectrum * spectrum(const char *instr, char *note)
void test_SHARC2()
test vector SHARC - load 3 spectra into SOS oscillators and cross-fade
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
void dump()
pretty-print the receiver
#define TABLE_SIZE
Test truncating and interpolating wavetable osc with a small wavetable (these should sound different ...
void runTest(UnitGenerator &vox, double dur)
void testWavetableInterpolation()
void testAMFMSin()
AM and FM using the dynamic scale and frequency inputs.
MulOp – A BinaryOp that multiplies two UnitGenerators or fixed constants together, sample-by-sample.
void testSumOfSinesNonCached()
Now test an uncached inharmonic series constructor format 3 = list of (freq/amp/phase) for (not-neces...
Sine – oscillator class (this computes the sine fcn on the fly)
Triangle envelope class – equal attack/release times.
void setFrequency(UnitGenerator &frequency)
Setter accessors.
Buffer – the multi-channel sample buffer class (passed around between generators and IO guys)...
Mixer – The n-input m-channel mixer class.
The CSL mono-to-stereo L/R panner class.
void testSumOfSinesCached()
Play a sum of sines waveform – cached harmonic overtone series.
void testSumOfSines1F()
Play a sum of sines waveform – 1/f + noise.
void addInput(UnitGenerator &inp)
void setScale(UnitGenerator &scale)
set the receiver's scale member to a UGen or a float
void testSumOfSinesSteps()
void dump()
print the receiver for debugging