MP3 Encoder - Artefacts

Writing software for systems that use VLSI Solution's devices as slave codecs to a host microcontroller.
Post Reply
Posts: 16
Joined: Sun 2011-12-04 23:01

MP3 Encoder - Artefacts

Post by ottinger » Thu 2014-02-06 14:19

Dear VLSI-Team,

i am using your great VS1063 Chip for Streaming Audio over Ethernet (

Initially I only wanted to support OggVorbis-Streaming but due to demand I am also trying to support mp3 now.

Basically I am using the same code to Stream ogg and mp3 - in either cases the libshout-Library is used to stream to an IceCast2 respectively ShoutCast Server ... which basically works fine. BUT ...

Comparing ogg to mp3 - I got audible (but small) artefacts in the mp3 mode (like little glitches, hickups, bleeps) - You can download the sample files here: ... 3de2d178d3

One guess from my side is that maybe loading of the VS1063 Patches v1.60 doesn't work proper ... But I can't find an error at first sight.

It would be nice to have a second opinion from you before I start crafting some debugging tools.

best wishes, Georg

User avatar
VLSI Staff
Posts: 1199
Joined: Tue 2010-06-22 14:10

Re: MP3 Encoder - Artefacts

Post by Henrik » Fri 2014-02-07 13:04

Dear Georg,

first let me thank you for your excellent comparison files. They made it really easy to spot the differences you talk about.

What I gathered from my analysis is as follows:
1) You MP3 file starts with an Icecast header, while you Ogg Vorbis file doesn't. Everything after that header looks like proper MP3, though, so that header shouldn't make any difference.
2) Particularly when listening to a (synced) difference file between your Ogg Vorbis and MP3 files, the artifacts are easy to hear.
3) Ogg Vorbis and MP3 files stay in sync, and our reference decoder doesn't complain about the MP3 file, so technically the bitstream looks to be all in order. This pretty much removes the possibility of bitstream read errors from your part.
4) When analyzing the MP3 file with Audacity's Spectogram, I saw high-frequency oddities every few seconds (see picture below). The example picture was from at 12.8 seconds from start. These artifacts happen if the patch set is not properly active. So I think, as you suspected, that your problem probably is that the patch set is not active.
5) Also, it seems to me that you have disabled the MP3 bit-reservoir (register SCI_WRAMADDR bit 10). It shouldn't cause you this problem, but when everything is working, you'll get better audio quality if you clear this bit to allow the bit-reservoir.
OggStreamer.png (258.41 KiB) Viewed 1782 times
If you don't get your problem solved, can you share your current initialization code so that we can have a look to see if there's anything suspect there?

Kind regards,
- Henrik
Good signatures never die. They just fade away.

Posts: 16
Joined: Sun 2011-12-04 23:01

Re: MP3 Encoder - Artefacts

Post by ottinger » Sun 2014-02-23 20:54

Thanks for your elaborate response,

I am also thinking that something related to patch loading doesn't work ... but I am quite puzzled what it could be.

First I was using a more complicated System of putting the patch as a binary at a defined address in Flash and apply it only if a MagicNumber is present - To rule out this possibility I reverted back to a code as close as possible to your example from vs1063a-patches.plg.

I tried counting the written Bytes and the result is correct. - I check the Endianness (big endian in the case of my uC) and it is also correct...

If you could help me having a second look on my Source code it would be great :)

It is hosted on Sourceforge: ... ster/tree/

cmd.c is a state machine mainly responsible for managing starting / stoping of streams
vs1053.c is where the initializations is.

thanks in advance,

Posts: 16
Joined: Sun 2011-12-04 23:01

Re: MP3 Encoder - Artefacts SOLVED

Post by ottinger » Mon 2014-02-24 3:08

Well I guess I should have read the Patches PDF proper beforehand :)

I was still activating EncoderMode with Software reset like this:

Code: Select all

VS1053WriteRegister( VS1053_REG_MODE, VS1053ReadRegister(VS1053_REG_MODE) | VS1053_SM_RESET | VS1063_SM_ENCODE | VS1053_SM_LINE1 );
where it should have been instead:

Code: Select all

VS1053WriteRegister( VS1053_REG_MODE, VS1053ReadRegister(VS1053_REG_MODE) | VS1063_SM_ENCODE | VS1053_SM_LINE1 );
VS1053WriteRegister( VS1053_REG_AIADDR, 0x50 );
Thanks Henrik for your analysis.

Post Reply