Sd cards and wav files

a couple of years ago i posted here about using sd cards and playing wav files from them, it didnt seem to be something many people have done.
I now have a fully working file system and access to an sd card from a mega128 - although very easily portable. If anyone would like it, it is stripped down and now very versatile, I’ll upload it.

I wondered though if someone could help me. I am able to read the file data of any file on the sd card, however I want to be able to read a wav file and pass it to OCR1A.

Elm chan has done it in the attached file on a at tiny, and I wondered whether a more experienced set of eyes could take a look and see what I can take/need to do to do the same. I can already read into a 512 byte buffer from the sd card, so all I need to do is get the link between reading into the buffer and passing to the OCR1A.

Btw currently it works perfectly if the sound file is stored in an array on the flash, I want to move to reading directly from the wav file.

Thanks guys
elmmain.c (7.64 KB)