Hi congratulations on your 1000th post
So tried recording and it doesn't play at all, just comes up with an error
I am guessing its because i am not writing to the whole 4 bytes
Heres a link to the file through my onedrivehttps://1drv.ms/u/s!Ank4msXJY_jqgbdQcAGODBXVIZ3Z1Q
Heres my modified code

Your header+data+datalength in RECORD1.WAV is still only 508 bytes long while it should be 512. I have corrected the file for you and attached to this message. (It seems to only contain some background noise at around -35 dB level.)

I will show you the difference. Your file is 5628 bytes while it should be 5632 bytes (5632 is divisable with 512, and the software takes pains to make the file match with 512-byte block boundaries). Notice that because my file is different size, so are also the size fields and fact's number-of-samples field.

Notice that I had to regenerate bytes 0x200-0x203. They should be the first four bytes of the first 256-byte IMA ADPCM compression block, but you had overwritten them with size data in your file.

Kind regards,
- Henrik

PS. This is my 1003rd message to this forum, and very fittingly with the subject of VS1003, a truly classic IC! It took what we had in VS1002 and added WMA and MIDI playback. As a first it also added an internal clock multiplier PLL that allowed for a higher internal frequency clock.

Quick update
If i use line in input, it records sorta, file size is pretty big for how long it records, also only windows media will play it sorta of, groove music just gives up on it.
I am guessing my file headers are still kinda off a bit

UPDATE again
so i if i change the header to sound sample rate, 8khz,groove music will play it

Oh and when i have the header set to 16khz, it is played very fast, guessing i am a bit off the 16khz speed

your headers are now fine - except for the sample rate which obviously still needs some work.

What do you have in SCI_CLOCKF? The formula for the sample rate is:
INTERNAL_CLOCK_SPEED / (256 * SCI_AICTRL0)

As for the issues with Groove Music: The original official sample rate for IMA ADPCM was 8 kHz, so it may be that some software (for no good reason) refuse to play IMA ADPCM files that have a different sample rate. If this bothers you, please contact the software developers and ask them to remove this artificial limitation.

Kind regards,
- Henrik

PS. This is my 1006th message. There is no VS1006 so I'll have to stop this "PS" series for the time being. Sigh.

Henrik wrote:your headers are now fine - except for the sample rate which obviously still needs some work.

What do you have in SCI_CLOCKF? The formula for the sample rate is:
INTERNAL_CLOCK_SPEED / (256 * SCI_AICTRL0)

I did some detective work, and it seems clear now that your INTERNAL_CLOCK_SPEED is 2.5*12.288 MHz, when it should be 3.0*12.288 MHz if you use SCI_AICTRL=9 and want sample rate to be 16 kHz. Because your SCI_CLOCKF is incorrect, actual sample rate is 13333 Hz instead of 16000 Hz.

So, set SCI_CLOCKF to 0x8000 before recording to get 16 kHz (I assume you have a 12.288 MHz crystal).

(Detective work part: I googled for some of the lyrics in your song, found out the artist and song name (Sigala: Easy Love), listened to it in YouTube, then tested with different potential sample rates until I got a pitch / speed match. Playing the file back at 13333 Hz gave a perfect match.)