another pure data question #1447
-
Hello, I'm using arduino-audio-tools ( cloned with git ) i'm trying to merge 2 mono FileLoops, copy the stereo stream to puredata, and output from pd to I2S. the puredata patch used is the same as in the stream example, 2 in 2 outs, nothing else. Am I exceeding the audiokit or sdcard capabilities ? here's the code I came up with: #include <SPI.h>
#include <SD.h>
#include "AudioTools.h"
#include "AudioLibs/AudioBoardStream.h"
#include "AudioLibs/FileLoop.h"
#include "Heavy_fileLoopPd.hpp"
#include "AudioLibs/PureDataStream.h"
const int chipSelect = PIN_AUDIO_KIT_SD_CARD_CS;
AudioInfo info(44100, 2, 16);
InputMerge<int16_t> merge;
Heavy_fileLoopPd pd_test(44100);
PureDataStream pd(pd_test);
AudioBoardStream i2s(AudioKitEs8388V1); // final output of decoded stream
FileLoop loopingFile;
FileLoop loopingFile2;
EncodedAudioStream decoder(&loopingFile, new WAVDecoder());
EncodedAudioStream decoder2(&loopingFile2, new WAVDecoder());
StreamCopy copierToPd(pd, merge,256);
StreamCopy copierFromPd(i2s, pd,256);
void setup() {
Serial.begin(115200);
AudioLogger::instance().begin(Serial, AudioLogger::Warning);
auto config = i2s.defaultConfig(TX_MODE);
config.copyFrom(info);
config.sd_active = true;
i2s.begin(config);
SD.begin(chipSelect);
loopingFile.setFile(SD.open("/seanMono.wav"));
loopingFile2.setFile(SD.open("/pianoMono.wav"));
loopingFile.begin();
loopingFile2.begin();
merge.add(loopingFile);
merge.add(loopingFile2);
merge.begin(info);
decoder.begin();
decoder2.begin();
pd.begin();
}
void loop() {
copierToPd.copy();
copierFromPd.copy();
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Difficult to say: I suggest that you try to test the different pieces separately before you integrate them into PD: e.g. input only & copy to i2s, input merge & copy to I2S A couple of additional thoughts:
|
Beta Was this translation helpful? Give feedback.
-
I changed the PureDataStream to avoid any arrays on the stack. With the updated version it should be possible to increase the copy size e.g. to 1024 |
Beta Was this translation helpful? Give feedback.
Difficult to say: I suggest that you try to test the different pieces separately before you integrate them into PD: e.g. input only & copy to i2s, input merge & copy to I2S
A couple of additional thoughts: