I made a test program. with the volume low it is still distorted about 10% of the time. its a class D amp so current draw should be low, the next step would be to wire the Shield to a head phones jack and retest.
also I thought that the NeoPixel would continue to update with this LED driver
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
AudioPlaySdWav playWav1;
AudioOutputI2S audioOutput;
AudioConnection patchCord1(playWav1, 0, audioOutput, 0);
AudioConnection patchCord2(playWav1, 1, audioOutput, 1);
AudioControlSGTL5000 sgtl5000_1;
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14
#include <WS2812Serial.h>
const int numled = 20;
const int pin = 26;
byte drawingMemory[numled*4]; // 4 bytes per LED for RGBW
DMAMEM byte displayMemory[numled*16]; // 16 bytes per LED for RGBW
WS2812Serial leds(numled, displayMemory, drawingMemory, pin, WS2812_GRBW);
#define RED 0x00FF0000
#define GREEN 0x0000FF00
#define BLUE 0x000000FF
#define YELLOW 0x00FFD000
#define PINK 0x44F00080
#define ORANGE 0x00FF4200
#define WHITE 0xAA000000
void setup() {
AudioMemory(512);// was8
sgtl5000_1.enable();
sgtl5000_1.volume(1.0);
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
// stop here, but print a message repetitively
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}
leds.begin();
leds.setBrightness(200); // 0=off, 255=brightest
}
void playFile(const char *BOOT)
{
Serial.print("Playing file: ");
Serial.println(BOOT);
// Start playing the file. This sketch continues to
// run while the file plays.
playWav1.play(BOOT);
// A brief delay for the library read WAV info
delay(5);
// Simply wait for the file to finish playing.
while (playWav1.isPlaying()) {
// uncomment these lines if you audio shield
// has the optional volume pot soldered
//float vol = analogRead(15);
//vol = vol / 1024;
// sgtl5000_1.volume(vol);
}
}
void loop() {
// change all the LEDs in 1.5 seconds
int microsec = 500000 / leds.numPixels();
colorWipe(RED, microsec);
colorWipe(GREEN, microsec);
colorWipe(BLUE, microsec);
//colorWipe(YELLOW, microsec);
//colorWipe(PINK, microsec);
// colorWipe(ORANGE, microsec);
// colorWipe(WHITE, microsec);
playFile("BOOT.WAV");
}
void colorWipe(int color, int wait_us) {
for (int i=0; i < leds.numPixels(); i++) {
leds.setPixel(i, color);
leds.show();
delayMicroseconds(wait_us);
}
}