12 #define USE_TEST_MAIN // use the main() function in test_support.h
19 #include "Convolver.h"
31 logMsg(
"playing a panning sine...");
41 Osc lfoY(0.2, 1, 0, 0);
45 logMsg(
"playing N-channel panning sine...");
64 logMsg(
"playing mix of 4 sines...");
75 vox1.setFrequency(env1);
77 vox2.setFrequency(env2);
85 logMsg(
"playing mix of panning sins...");
97 float scale = 3.0f / (float) num;
99 for (
int i = 0; i < num; i++) {
102 vox->setFrequency(*env);
103 vox->setScale(scale);
108 logMsg(
"playing mix of %d panning sins...", num);
121 for (
unsigned i = 0; i < 50; i++) {
125 Osc * vox =
new Osc(110.0, 0.01);
126 vox->setFrequency(* freq);
130 logMsg(
"playing mix of panning sines...");
146 AR a_env(2, 0.6, 1.0);
150 logMsg(
"playing swapped sin...");
159 void testConvolver() {
160 JSoundFile fi(CGestalt::dataFolder(),
"rim3_L.aiff");
167 logMsg(
"playing sound file...");
170 logMsg(
"sound file player done.\n");
172 Convolver cv(CGestalt::dataFolder(),
"Quadraverb_large_L.aiff");
174 logMsg(
"playing convolver...");
180 logMsg(
"convolver done.\n");
183 #define IRLEN (44100 * 4) // 4 sec. IR
185 void testConvolver2() {
187 AR env(0.05, 0.0001, 0.049);
190 logMsg(
"playing noise burst...");
196 buf.allocateBuffers();
197 float * samp = buf.monoBuffer(0);
198 for (
unsigned i = 0; i < IRLEN; i += 5000)
199 samp[i] = 1 / (1 + (sqrt(i) / 5000));
203 logMsg(
"playing convolver...");
208 logMsg(
"convolver done.\n");
211 void testConvolver3() {
213 AR env(0.05, 0.0001, 0.049);
216 logMsg(
"playing noise burst...");
220 Convolver cv(CGestalt::dataFolder(),
"3.3s_LargeCathedral_mono.aiff");
222 logMsg(
"playing convolver...");
229 logMsg(
"convolver done.\n");
245 SoundFile sndfile(CGestalt::dataFolder() +
"splash_mono.aiff");
249 strcpy(folder, CGestalt::dataFolder().c_str());
250 strcat(folder,
"IRCAM_HRTF/512_DB/HRTF_1047.dat");
251 HRTFDatabase::Reload(folder);
252 HRTFDatabase::Database()->dump();
261 logMsg(
"playing HRTF-spatialized rotating sound source (horizontal plane)...");
262 theIO->setRoot(panner);
264 for (
int i = 0; i < 30; i++) {
265 source.
setPosition(
's', (
float) (i * 24), 0.0f, 2.0f);
279 SoundFile sndfile(CGestalt::dataFolder() +
"guanno_mono.aiff");
288 logMsg(
"playing HRTF-spatialized rotating sound source (vertical plane)...");
289 theIO->setRoot(panner);
290 for (
int i = 30; i > 6; i--) {
305 SoundFile sndfile(CGestalt::dataFolder() +
"triangle_mono.aiff");
306 sndfile.openForRead();
316 logMsg(
"playing HRTF-spatialized rotating sound source (medial plane)...");
317 theIO->setRoot(panner);
318 for (
int i = 30; i > 6; i--) {
319 source.
setPosition(
's', 0.0f, (
float) (i * 15), 2.0f);
332 SoundFile sndfile(CGestalt::dataFolder() +
"triangle_mono.aiff");
341 logMsg(
"playing Ambisonic-spatialized rotating sound source (horizontal plane)...");
342 theIO->setRoot(panner);
343 for (
int i = 0; i < 30; i++) {
344 source.
setPosition(
's', (
float) (i * 24), 0.0f, 2.0f);
357 SoundFile sndfile(CGestalt::dataFolder() +
"Piano_A5_mf_mono.aiff");
366 logMsg(
"playing simply spatialized rotating sound source...");
370 for (
int i = 0; i < 30; i++) {
372 source.
setPosition(
's', (
float) (i * 24.0f), 0.0f, (2.0f + (i * 0.15f)));
385 SoundFile sndfile(CGestalt::dataFolder() +
"triangle_mono.aiff");
386 sndfile.openForRead();
396 logMsg(
"playing VBAP-spatialized rotating sound source (horizontal plane)...");
397 theIO->setRoot(panner);
398 for (
int i = 0; i < 30; i++) {
399 source.
setPosition(
's', (
float) (i * 24), 0.0f, 2.0f);
434 "Stereo panner",
testPan,
"Demonstrate the stero panner",
436 "Mixer",
testSineMixer,
"Mixer with 4 sine inputs (slow sum-of-sines)",
437 "Panning mixer",
testPanMix,
"Play a panning stereo mixer",
438 "Bigger panning mixer",
testBigPanMix,
"Test a mixer with many inputs",
440 "Test convolver", testConvolver,
"Test a convolver",
441 "Test convolver 2", testConvolver2,
"Test a convolver",
442 "Test convolver 3", testConvolver3,
"Test a convolver",
444 "Osc bank",
testOscBank,
"Mix a bank of oscillators",
445 "Channel-mapped IO",
testCMapIO,
"Demonstrate channel-mapped IO",
451 "Ambisonics",
test_Ambi_horiz,
"Test the Ambisonic-based spatial panner",
452 "Simple",
test_SimpleP,
"Test the simple spatial panner",