unsigned long a = millis(); unsigned long b = millis(); uint16_t sample_rate=44100; uint8_t channels = 1; // channels set at 1 GeneratorFromArray waveSR1(arraysine256,0,false); GeneratedSoundStream sndSR1(waveSR1); // Stream generated from array1 GeneratorFromArray waveSR2(arraysine256,0,false); GeneratedSoundStream sndSR2(waveSR2); // Stream generated from array2 I2SStream I2S; // AnalogAudioStream I2S; // For internal DAC pins 25 & 26 VolumeStream volume1(sndSR1); // volume control of inputs VolumeStream volume2(sndSR2); ResampleStream resample1(volume1); // resample the inputs ResampleStream resample2(volume2); InputMixer mixer; // mix the resampled StreamCopy copier1(I2S, mixer); // copies mixer sound out to output I2S direct.... // Arduino Setup void setup(void) { //Serial.begin(115200); //while(!Serial); // AudioLogger::instance().begin(Serial, AudioLogger::Info); mixer.add(resample1); mixer.add(resample2); mixer.setWeight(0, 1); mixer.setWeight(1, 1); // Serial.println("running setup"); // define resample1 auto rcfg1 = resample1.defaultConfig(); rcfg1.step_size = 0.6875; // 0.25 x freqf Frequency low rcfg1.channels = channels; resample1.begin(rcfg1); // define resample2 auto rcfg2 = resample2.defaultConfig(); rcfg2.step_size = 1.0; // 1.0 Frequency setting wave2 default rcfg2.channels = channels; resample2.begin(rcfg2); // start I2S internal / external DAC config auto config = I2S.defaultConfig(TX_MODE); config.sample_rate = sample_rate; config.channels = channels; config.bits_per_sample = 16; // for external I2S below...pins used ESP32 PICO KIT..... config.pin_bck = 4; // 4 ... 23 config.pin_ws = 5; // 5 ... 19 config.pin_data = 19; // 19 ... 22 config.i2s_format = I2S_LSB_FORMAT; // for PT8211 DAC ext I2S.begin(config); // set initial volume volume1.setVolume(0.3); volume1.begin(config); // we need to provide the bits_per_sample and channels volume2.setVolume(0.3); volume2.begin(config); // we need to provide the bits_per_sample and channels // Setup sine wave auto cfg1 = waveSR1.defaultConfig(); auto cfg2 = waveSR2.defaultConfig(); cfg1.channels = channels; cfg1.sample_rate = sample_rate; cfg2.channels = channels; cfg2.sample_rate = sample_rate; waveSR1.begin(cfg1); waveSR2.begin(cfg2); resample1.setStepSize(freqd); // change stepsize to change freq wave1 ... this sketch it stays constant resample2.setStepSize(freqf); // change stepsize to change freq wave2 ... this sketch it is varied in playlist // Serial.println("setup end"); } // Arduino loop - copy sound to out void loop() { copier1.copy(); // Serial.println("running loop"); playlist(); } void playlist(void) { b = millis(); if (listp >= 9) listp=0; if ((b - a) >= 1000) { // Serial.println("running playlist"); resample2.setStepSize(NoteArray[listp]*freqf); // change freq wave 2 volume1.setVolume(0.5+listp*0.01); // volume change with a variable .... calc is just to see it changing volume2.setVolume(0.3+listp*0.07); // change each with different values a = millis(); listp++; } }