Greetings -
A little test program produces nice string sounds from K-S strings at the beginning and end of the loop,
but no sound while looping through an array of K-S strings.
I would be delighted to receive your comments and advices.
Kind regards.
A little test program produces nice string sounds from K-S strings at the beginning and end of the loop,
but no sound while looping through an array of K-S strings.
I would be delighted to receive your comments and advices.
Kind regards.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
//#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthKarplusStrong string15; //xy=91.99999618530273,716.6000127792358
AudioSynthKarplusStrong string14; //xy=96,676.2000112533569
AudioSynthKarplusStrong string16; //xy=96.99999237060547,759.6000070571899
AudioSynthKarplusStrong string13; //xy=99,630.2000122070312
AudioSynthKarplusStrong string11; //xy=99.99999618530273,544.0000066757202
AudioSynthKarplusStrong string19; //xy=99.99999618530273,899.6000127792358
AudioSynthKarplusStrong string10; //xy=104,503.6000051498413
AudioSynthKarplusStrong string12; //xy=104.99999237060547,587.0000009536743
AudioSynthKarplusStrong string7; //xy=106.00000381469727,352.0000057220459
AudioSynthKarplusStrong string18; //xy=104,859.2000112533569
AudioSynthKarplusStrong string20; //xy=104.99999237060547,942.6000070571899
AudioSynthKarplusStrong string9; //xy=107,457.6000061035156
AudioSynthKarplusStrong string17; //xy=107,813.2000122070312
AudioSynthKarplusStrong string6; //xy=110.00000762939453,311.600004196167
AudioSynthKarplusStrong string23; //xy=107.99999618530273,1081.1999883651733
AudioSynthKarplusStrong string8; //xy=111,395
AudioSynthKarplusStrong string5; //xy=113.00000762939453,265.6000051498413
AudioSynthKarplusStrong string1; //xy=115.00000762939453,31.600004196166992
AudioSynthKarplusStrong string22; //xy=112,1040.7999868392944
AudioSynthKarplusStrong string24; //xy=112.99999237060547,1124.1999826431274
AudioSynthKarplusStrong string21; //xy=115,994.7999877929688
AudioSynthKarplusStrong string4; //xy=119.00000762939453,154.600004196167
AudioSynthKarplusStrong string2; //xy=121.00000762939453,73.60000705718994
AudioSynthKarplusStrong string3; //xy=123.00000762939453,111.60000228881836
AudioPlayMemory playMem1; //xy=123.00000762939453,1213.0000648498535
AudioMixer4 mixer1; //xy=256.0000305175781,93.60000610351562
AudioMixer4 mixer4; //xy=257.99999618530273,693.2000112533569
AudioMixer4 mixer3; //xy=265.99999618530273,520.6000051498413
AudioMixer4 mixer5; //xy=265.99999618530273,876.2000112533569
AudioMixer4 mixer2; //xy=272.00000381469727,328.600004196167
AudioMixer4 mixer6; //xy=273.99999618530273,1057.7999868392944
AudioMixer4 mixer7; //xy=496,427
AudioMixer4 mixer8; //xy=509.00000762939453,1070.8000602722168
AudioMixer4 mixer9; //xy=691,846.7999877929688
AudioOutputI2S i2s1; //xy=879.0000610351562,855.5999851226807
AudioConnection patchCord1(string15, 0, mixer4, 2);
AudioConnection patchCord2(string14, 0, mixer4, 1);
AudioConnection patchCord3(string16, 0, mixer4, 3);
AudioConnection patchCord4(string13, 0, mixer4, 0);
AudioConnection patchCord5(string11, 0, mixer3, 2);
AudioConnection patchCord6(string19, 0, mixer5, 2);
AudioConnection patchCord7(string10, 0, mixer3, 1);
AudioConnection patchCord8(string12, 0, mixer3, 3);
AudioConnection patchCord9(string7, 0, mixer2, 2);
AudioConnection patchCord10(string18, 0, mixer5, 1);
AudioConnection patchCord11(string20, 0, mixer5, 3);
AudioConnection patchCord12(string9, 0, mixer3, 0);
AudioConnection patchCord13(string17, 0, mixer5, 0);
AudioConnection patchCord14(string6, 0, mixer2, 1);
AudioConnection patchCord15(string23, 0, mixer6, 2);
AudioConnection patchCord16(string8, 0, mixer2, 3);
AudioConnection patchCord17(string5, 0, mixer2, 0);
AudioConnection patchCord18(string1, 0, mixer1, 0);
AudioConnection patchCord19(string22, 0, mixer6, 1);
AudioConnection patchCord20(string24, 0, mixer6, 3);
AudioConnection patchCord21(string21, 0, mixer6, 0);
AudioConnection patchCord22(string4, 0, mixer1, 3);
AudioConnection patchCord23(string2, 0, mixer1, 1);
AudioConnection patchCord24(string3, 0, mixer1, 2);
AudioConnection patchCord25(playMem1, 0, mixer8, 2);
AudioConnection patchCord26(mixer1, 0, mixer7, 0);
AudioConnection patchCord27(mixer4, 0, mixer7, 3);
AudioConnection patchCord28(mixer3, 0, mixer7, 2);
AudioConnection patchCord29(mixer5, 0, mixer8, 0);
AudioConnection patchCord30(mixer2, 0, mixer7, 1);
AudioConnection patchCord31(mixer6, 0, mixer8, 1);
AudioConnection patchCord32(mixer7, 0, mixer9, 0);
AudioConnection patchCord33(mixer8, 0, mixer9, 1);
AudioConnection patchCord34(mixer9, 0, i2s1, 0);
AudioConnection patchCord35(mixer9, 0, i2s1, 1);
// GUItool: end automatically generated code
// Special thanks to Matthew Rahtz - http://amid.fish/karplus-strong/
AudioSynthKarplusStrong ksStrings[] = { string1, string2, string3, string4,
string5, string6, string7, string8,
string9, string10, string11, string12,
string13,string14, string15, string16,
string17,string18, string19, string20,
string21,string22, string23, string24};
void setup() {
// put your setup code here, to run once:
AudioMemory(10);
mixer1.gain(0, 0.2);
mixer1.gain(1, 0.2);
mixer1.gain(2, 0.2);
mixer1.gain(3, 0.2);
mixer2.gain(0, 0.2);
mixer2.gain(1, 0.2);
mixer2.gain(2, 0.2);
mixer2.gain(3, 0.2);
mixer3.gain(0, 0.2);
mixer3.gain(1, 0.2);
mixer3.gain(2, 0.2);
mixer3.gain(3, 0.2);
mixer4.gain(0, 0.2);
mixer4.gain(1, 0.2);
mixer4.gain(2, 0.2);
mixer4.gain(3, 0.2);
mixer5.gain(0, 0.2);
mixer5.gain(1, 0.2);
mixer5.gain(2, 0.2);
mixer5.gain(3, 0.2);
mixer6.gain(0, 0.2);
mixer6.gain(1, 0.2);
mixer6.gain(2, 0.2);
mixer6.gain(3, 0.2);
mixer7.gain(0, 1.0);
mixer7.gain(1, 1.0);
mixer7.gain(2, 1.0);
mixer7.gain(3, 1.0);
mixer8.gain(0, 1.0);
mixer8.gain(1, 1.0);
mixer8.gain(2, 0.1);
mixer8.gain(3, 0.0);
mixer9.gain(0, 1.0);
mixer9.gain(1, 1.0);
mixer9.gain(2, 0.0);
mixer9.gain(3, 0.0);
Serial.print(F("Audio memory usage = ")); Serial.println(AudioMemoryUsageMax());
}
void loop() {
// put your main code here, to run repeatedly:
string1.noteOn(220.0,0.9);
delay(300);
string1.noteOff(0.9);
for(int testvoice = 0; testvoice < 24; ++ testvoice){
ksStrings[testvoice].noteOn(440.0,0.9);
delay(300);
ksStrings[testvoice].noteOff(0.9);
delay(300);
Serial.println(testvoice);
}
string24.noteOn(440.0,0.9);
delay(300);
string24.noteOff(0.9);
}