Replies: 7 comments 4 replies
-
i have moved a step further, however i am still having issues, if one file ends before the other, then it stops playing totally and makes clicking sounds
#include <SPI.h> #include "AudioTools.h" #include "AudioCodecs/CodecWAV.h" const int chipSelect=5; void setup(){ // setup file // setup i2s mixer.begin(); //copier.begin(i2s, mixer); } void loop(){ }` |
Beta Was this translation helpful? Give feedback.
-
You need to reconfigure the mixer when one file ends or make sure that you still send some (empty) data. |
Beta Was this translation helpful? Give feedback.
-
please can you suggest an example? i barely made it this far. is there a function that can detect end of file for the wav decoder? also where do i find the function to pass empty data to the copier |
Beta Was this translation helpful? Give feedback.
-
I suggest that you look what the copy() call is returning: if there is no data copied you will get 0! calling available() on the file should also work... |
Beta Was this translation helpful? Give feedback.
-
hi phil, i have tried closing the fie based on your suggestion, and playing a silent wav file genetated from audacity but still no luck `/**
#include <SPI.h> #include "AudioTools.h" #include "AudioCodecs/CodecWAV.h" const int chipSelect=5; void setup(){ // setup file // setup i2s mixer.begin(); //copier.begin(i2s, mixer); } void loop(){ if (copier1.available()>0) { else{ } if (copier2.available()>0) { else if (copier2.available()<1){
copier2.copy(); }` heres what i get on serial |
Beta Was this translation helpful? Give feedback.
-
Messing around with multiple files is way too complicated, why don't just just write an array with 0 to the destination instead? By the way to have things absolutely correct you would need to decode the wav data instead of copying the files directly, or start the file at position 44 to ignore the WAV header |
Beta Was this translation helpful? Give feedback.
-
any comment on this? |
Beta Was this translation helpful? Give feedback.
-
good day i am a noob trying to make use of your library, I have been trying to make sense of it all. i am trying to play multiple wav files simultaneously and i have tried numerous things, below is my latest failure
`/**
*/
#include "AudioTools.h"
#include "AudioLibs/AudioSourceSD.h"
const char startFilePath="/";
const char ext="wav";
AudioSourceSD source(startFilePath, ext,5);
AudioSourceSD source1("/fo", ext,5);
I2SStream i2s;
WAVDecoder decoder;
WAVDecoder decoder1;
AudioPlayer player(source, i2s, decoder);
AudioPlayer player1(source1, i2s, decoder1);
void printMetaData(MetaDataType type, const char* str, int len){
Serial.print("==> ");
Serial.print(toStr(type));
Serial.print(": ");
Serial.println(str);
}
void setup() {
Serial.begin(115200);
// AudioLogger::instance().begin(Serial, AudioLogger::Info);
// setup output
config.sample_rate = 44100;
config.bits_per_sample = 16;
config.channels = 2;
i2s.begin(config);
// setup player
//source.setFileFilter("Bob Dylan");
//player.setMetadataCallback(printMetaData);
player.begin();
player1.begin();
}
void loop() {
player.copy();
player1.copy();
}`
i was reading your documentation and you suggested an input mixer but i dont know how to implement that, can you help?
Beta Was this translation helpful? Give feedback.
All reactions