Streaming mode causes noise in low frequency audio

Writing software for systems that use VLSI Solution's devices as slave codecs to a host microcontroller.
harrisbn
Senior User
Posts: 22
Joined: Wed 2011-03-30 21:31

Streaming mode causes noise in low frequency audio

Post by harrisbn » Mon 2011-11-14 20:59

I'm using a vs1053b, being controlled by a TI LM3S5951 microcontroller. I've loaded the newest plugins for all of the software fixes, as well as the FLAC decoder. I'm streaming USB audio from an iPod - 22 kZ, 32kZ, 44.1kZ, or 48 kHz audio. I've noticed that there is significant noise - static like - added to any lower frequencies (50 - 80 Hz range) when using streaming mode. When I disable streaming, this noise goes away. I would like to keep using the streaming mode feature since I don't want to have a buffer overrun / under-run condition, but the noise is pretty bad. Has anyone else experienced this?

User avatar
pasi
VLSI Staff
Posts: 1679
Joined: Thu 2010-07-15 16:04

Re: Streaming mode causes noise in low frequency audio

Post by pasi » Mon 2011-11-14 22:19

The streaming mode bit should not be used, it is much too coarse and only (sort-of) works for mp3 and wav only. We have removed it in vs1063a.

Instead, monitor the fill state of your FIFO, and adjust the samplerate using a) AUDATA (works for mp3, but not all other decoders, some override your changes), b) CLOCKF (lie about the XTALI to speed up / slow down playback rate) c) samplerate finetune feature of the vs1053 patches package or the vs1063 parametric_x.

Send data from your controller's FIFO in 32-byte chunks to vs1053 when DREQ is high. When you get an audio packet from iPod, check the FIFO fill state and adjust the samplerate accordingly.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

harrisbn
Senior User
Posts: 22
Joined: Wed 2011-03-30 21:31

Re: Streaming mode causes noise in low frequency audio

Post by harrisbn » Mon 2011-11-14 23:17

How can I monitor the fill state of the FIFO? As far as I know, I can only tell when it is completely full (DREQ goes low). It would be great if I could just ask the vs1053b how much buffer space was available, as sending 48kHz stereo 16 bit PCM audio is very challenging when I can only send it in 32 byte pieces over a SPI bus.

If the buffer overflows, I could detect that and maybe change something to speed up the processing of data. If the buffer underflows, I'm not sure I could detect that.

User avatar
pasi
VLSI Staff
Posts: 1679
Joined: Thu 2010-07-15 16:04

Re: Streaming mode causes noise in low frequency audio

Post by pasi » Mon 2011-11-14 23:38

harrisbn wrote:How can I monitor the fill state of the FIFO?
Do you have enough memory to have a FIFO on the controller as well?

We also have DAC-mode application which reports both the audio buffer and stream buffer fill states so you can keep low latency if you like. However, it does not have the rate fine tune, you should use the CLOCKF method.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

harrisbn
Senior User
Posts: 22
Joined: Wed 2011-03-30 21:31

Re: Streaming mode causes noise in low frequency audio

Post by harrisbn » Tue 2011-11-15 1:15

OK, I get it now. I can wait until I have enough data to fill the 2k sample FIFO on the vs1053b, as well as some more in the processor's audio buffer, then that can be monitored to keep it at a certain level.

So when I am streaming the USB PCM data, I can lie to the vs1053b when setting up the CLOCKF register and tell it XTALI is actually slower than the 12.288 MHz clock that us running it, giving some headroom if I need play faster than 48kHz, and I can use the fine tune method in the software patch to keep my FIFO at the proper level. Is this right, or do I actually need a faster clock (like a 13MHz)?

Thanks.

User avatar
pasi
VLSI Staff
Posts: 1679
Joined: Thu 2010-07-15 16:04

Re: Streaming mode causes noise in low frequency audio

Post by pasi » Tue 2011-11-15 22:39

If you need to go above 48kHz, then you would need higher than 12.288MHz XTALI. Adjusting CLOCKF just causes the calculation of the DAC control values to end up higher or lower than the correct ones. The samplerate tuning of the patches package does the same, but with higher accuracy and maybe in a more easily understandable way. The max samplerate is still 48kHz (XTALI/256) for 12.288MHz clock.

Using 13MHz xtal would give plenty of adjustment range.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

harrisbn
Senior User
Posts: 22
Joined: Wed 2011-03-30 21:31

Re: Streaming mode causes noise in low frequency audio

Post by harrisbn » Wed 2011-11-16 14:24

OK, so if I use a 12.288 MHz crystal, and tell the vs1053 that I am running slower, I still won't be able to go above 48kHz, because a slower crystal would limit the sampling frequency below 48kHz.

If I use a 13MHz crystal, I tell the vs1053 that I am using a 13MHz crystal when playing from a flash drive (non-streaming), (CLOCKF bits 10:0 set to 0x4E2, instead of 0x430 (or default of 0)).

And when streaming audio over USB, I set the CLOCKF to 0x430 (or 0), then use the fine tuning feature to reduce the sample rate by up to 5.5% +- the amount of variation I want to allow.

Did I get this right?

User avatar
pasi
VLSI Staff
Posts: 1679
Joined: Thu 2010-07-15 16:04

Re: Streaming mode causes noise in low frequency audio

Post by pasi » Wed 2011-11-16 18:52

harrisbn wrote: when streaming audio over USB, I set the CLOCKF to 0x430 (or 0), then use the fine tuning feature
Always keep the 0x4e2 in the XTALI bits of CLOCKF, and only use the sample rate fine-tuning. When you then set fine-tuning to 0, everything plays with the nominal rate.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

harrisbn
Senior User
Posts: 22
Joined: Wed 2011-03-30 21:31

Re: Streaming mode causes noise in low frequency audio

Post by harrisbn » Thu 2011-11-17 20:06

I've got an algorithm working that seems to do a decent job of fine tuning the playback rate to match the streamed data being received using the fine-tuning feature in the software patch. My only problem with it is I usually hear a small (but unacceptable) pop when the fine tuning registers are adjusted. I'm writing the registers like specified in the patches documentation, writing the 0x1E07 and 0x1E08 registers, then writing 0 to 0x5B1C, then reading and writing the AUDATA register. Is there some way to do this differently to avoid the pop? I end up adjusting the registers every second, so it is still not a very good solution.

User avatar
pasi
VLSI Staff
Posts: 1679
Joined: Thu 2010-07-15 16:04

Re: Streaming mode causes noise in low frequency audio

Post by pasi » Mon 2011-11-21 22:12

harrisbn wrote: usually hear a small (but unacceptable) pop when the fine tuning registers are adjusted.
Ok, we'll have to test it and find a better procedure. Could you help us a bit and double-check that the adjustment code itself behaves correctly? You can for example change the write to AUDATA into a read etc. to see which part of the procedure triggers the pop.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

Post Reply