hey guys!
i am working on a project with arduino mkr zero. i am trying to play a song with the library AudioZero from an SD Card, but the audio is greatly noisy, can anyone tell me please whats wrong with the code or am supposed to add filters with the loud speaker.
i used a an amplifiar kemo m033n and a visaton fr 8 wp 4 ohm loud speaker
and the programe :
#include <SD.h>
#include <SPI.h>
#include <AudioZero.h>
void setup()
{
Serial.begin(9600);
while(!Serial);
Serial.println("Initializing SD card...");
Serial.println(SD.begin());
Serial.println(" done.");
// 44100kHz stereo => 88200 sample rate
AudioZero.begin(2*44100);
}
void loop()
{
int count = 0;
// open wave file from sdcard
File myFile = SD.open("/test.wav");
if (!myFile) {
// if the file didn't open, print an error and stop
Serial.println("error opening test.wav");
while (true);
}
Serial.print("Playing");
// until the file is not finished
analogWrite(A0, 125);
AudioZero.play(myFile);
Serial.println("End of file. Thank you for listening!");
while (true) ;
}