AudioZero and SdFat

Does anyone have any examples of code where I can use SdFat to query the SD card and play one of the files on the card using an Arduino Zero? I'm using SdFat so I can get long filenames instead of 8.3 file names. The construct of a "File" is ambiguous when using SdFat so I'm not sure what to pass which requires a type "File".

Even understanding if its possible to use SdFat and SD at the same time would help my problem. If SdFat is in the equation File is ambiguous . And it looks like I need a type File to pass to

The construct of a "File" is ambiguous when using SdFat

Hmmm. No, it isn't. It is quite straightforward. If you have having problems, POST YOUR CODE!

#include <SD.h>
#include <AudioZero.h>

#include <LiquidCrystal_I2C.h>

#include <FreeStack.h>
#include <SdFat.h>
SdFat sdfat;
SdFile file;
SdFile dirFile;

// Number of files found.
uint16_t n = 0;

// Max of ten files since files are selected with a single digit.
const uint16_t nMax = 10;

// Position of file’s directory entry.
uint16_t dirIndex[nMax];
String fullnames[200];
String smallnames[200];
#define I2C_ADDR 0x3F
LiquidCrystal_I2C lcd(I2C_ADDR, 2, 1, 0, 4, 5, 6, 7);

void setup() {
lcd.begin(16, 2);//16 columns 2 rows for 1602A
lcd.setBacklightPin(3, POSITIVE);
//lcd.setBacklight(HIGH); // NOTE: You can turn the backlight off by setting it to LOW instead of HIGH
lcd.clear(); // clean screen and sets cursor to (0,0)

while (!Serial) {}

if (!sdfat.begin(4, SD_SCK_HZ(F_CPU/3))) {

// List files in root directory.
if (!"/", O_READ)) {
sdfat.errorHalt(“open root failed”);
char fbuffer[13];
while (n < nMax && file.openNext(&dirFile, O_READ)) {

// Skip directories and hidden files.
if (!file.isSubDir() && !file.isHidden()) {

// Save dirIndex of file in directory.

dirIndex[n] = file.dirIndex();
String strName = getFilename(file);
fullnames[n] = strName;



// so AudioZero.Play is expecting a type File which fails while SdFat is loaded

File myFile =“s-basic.wav”);;

What I’d like to do is pass in the Sdfat file filename to but how do I do that?; ???

lcd.setCursor(0, 0);
lcd.setCursor(0, 1);


What I'd like to do is pass in the Sdfat file filename to but how do I do that?

You made an array of all the names.[7]); // Play the 8th file...

You cannot use[7]) because play() is expecting type "File" not type "String" hence my problem. This produces no matching function for call to 'AudioZeroClass::play(String&)'

      File fileEight =[7].c_str());;

Nope, that's the other problem. If include Sdfat I cannot delcare a type File. I get an error saying File is ambiguous as per my original message at the beginning of this post.

You haven’t posted your compiler errors verbatim - that’s the first step.

The SdFat library doesn't have a File type. It has a FatFile type. You'd need to modify the AudioZero class to take a FatFile. That might be trivial, or it might not.

I think I have a plan... and I'm half way through it.. will share on github when finished.

So this is my cunning plan. I created an external library using SdFat to pass back the longnames to a String Array > Then in the main ino file I used SD.h to create an array of the 8.3 file names. So that means I have the fullname but can also declare a type File for AudioZero to use with the 8.3 names....booommmm..

So far I have both SdFat and SD.h creating those 2 arrays..

Years later and a little wiser I fixed this without having a convoluted method. I changed the AudioZero Library to support SdFat