Page 1 of 2

VS1053b - No luck with flac

Posted: Mon 2017-11-20 13:38
by technic

I need some help troubleshooting my vs1053b based setup.
Adafruit ATSAMD21 based arduino Feather M0 + Adafruit MusicMaker (VS1053b-based) Featherwing.

Adafruit VS1053 library, feather_player example.

This "player" work well with MP3, OGG files, but can't play FLAC files.
I've asked for help on Adafruit forum, ... 2&e=631832
they recommended me to ask you :)

My general question is - is my hardware combination able to play FLAC files?
And second quistion - how I cad debug what's wrong?

Re: VS1053b - No luck with flac

Posted: Mon 2017-11-20 16:07
by pasi
vs1053b does not natively play FLAC files. You need to upload the correct variant of the patch from the vs1053b patches package ( ... tches.html ).

I don't know which variant of the patch, if any, the default Adafruit library uses.

Re: VS1053b - No luck with flac

Posted: Mon 2017-11-20 16:31
by technic
Thanks for reply,

yes, I know about FLAC patch,

Adafruit VS1053 library have methods to load patch from file or from data array.

My post from adafruit forum:
When I tried to use function Adafruit_VS1053::loadPlugin(char *plugname), I use plugin from ... oder-chip/ ( mentioned in )

When I tried to use Adafruit_VS1053::applyPatch, I use array from
vs1053b-patches-flac.plg (from vlsi page, ... )

third way - write my own function (based on code in vs1053b-patches-flac.plg).

In any case after plugin loading decoder make software reset (I hear specific sound in earphones), mp3 decoding work well, but no luck with flac..
I think that Feather is fast enough to put data to the VS1053 chip, I don't understand what's wrong.
I've checked DREQ signal activity during MP3 and FLAC "playing".
When mp3 file played oscilloscope shown ~40 Hz signal, and no signal with FLAC.
Possible that vs1053b does not decode flac-stream (yes, flac plugin is loaded)...

Re: VS1053b - No luck with flac

Posted: Tue 2017-11-21 14:03
by pasi
Does the HDAT1 register value change when you try to play a flac file? Is DREQ always high with FLAC?

Can you send us the FLAC file you are testing with (to )?

Re: VS1053b - No luck with flac

Posted: Fri 2017-11-24 13:04
by technic
Yes, no problem, I can send files.

And yes, DREQ always high with FLAC.

About HDAT1 register - I will check, some code modification needed.

Re: VS1053b - No luck with flac

Posted: Fri 2017-11-24 13:13
by technic
I can't send second file (abou 14 mb), your server reject my mails...

Re: VS1053b - No luck with flac

Posted: Fri 2017-11-24 13:28
by pasi
Hi Andrej,

Both files seem to play with my C model and with vs1053b when vs1053b-patches-flac is loaded. HDAT1 should have 'fL', i.e. 0x664c.

vs1053b-patches-flac.plg seems to include the write to AIADDR (0x300), so it should start automatically. Do not give software reset after loading the code. Use the cancel procedure to cancel play instead of software reset. If you need a software reset, you can replace it by writing 0x300 to AIADDR, or reload the patch again.

Re: VS1053b - No luck with flac

Posted: Fri 2017-11-24 15:54
by technic
Thank you, pasi, for information.

Did I understand correctly that I should check the state of the HDAT1 register after I started playing the file?

Is it possible to check are patch loaded correctly and work?
Is there way to test SD card transfer rate?

I think that maybe SPI bus in my setup to slow for flac...

Re: VS1053b - No luck with flac

Posted: Mon 2017-11-27 13:03
by pasi
HDAT1 gives information about the currently playing format. Most formats are detected from the first dozen bytes, so after sending the first block of data, HDAT1 should tell you something.

Even if your SPI bus were too slow, you would hear something.

If you're using a tried-and-tested plugin load routine, it should work.

You can try the attached file (edit: should be jumi.ogg and not jumi10.ogg). The decoding will get stuck if the patch is not running.

Re: VS1053b - No luck with flac

Posted: Fri 2019-04-12 9:10
by drmoth
I'm in a similar position with the VS1053b and FLAC, I'm using the Adafruit Musicmaker board.
Ogg and mp3 work fine, and I appear to be loading the flac plugin correctly but I'm getting no sound and the device appears to be freezing.

I've using a particle Xenon to drive the audio, it has a 64Mhz clock.

I've tried the jumi10.ogg file linked above, and it works regardless of whether I load the patch or not. Is this normal? Is there any other way of knowing whether the plugin has correctly loaded?

I've tried reading HDAT1 and it gives me 0x4F67 for Ogg but either freezes or returns zero for flac.

Any suggestions?