Datasheet

HH
VS1053B OGG VORBIS ENCODER VSMPG
5 Building a Streaming System
This chapter presents how to build a streaming system over the Internet, RF link or other
media.
Main
CPU
RF LINK
INTERNET
ETC
Main
CPU
buffer
RAM
SERVER CLIENT(S)
Earphone
Line out
VS1053
VS1053
Mic in
Line in
Vorbis
Ogg
Ogg Vorbis
out
Figure 5: Streaming system using VS1053b.
Figure 5 presents an example system that uses a VS1053b for both encoding and de-
coding Ogg Vorbis audio.
First the audio data is fed to the VS1053b from a microphone or line input. It is encoded
into Ogg Vorbis, which is sent by the Server’s Main CPU over the transfer medium. To
make sure Ogg Vorbis packets don’t become too long, the Main CPU has set bits 7:4 in
SCI_AICTRL3 to a sensible value prior to beginning encoding (Chapter 2.3.1).
The Main CPU on the Client end receives data and stores it into a RAM ring buffer (from
e.g. 8 to 512 KiB depending on the application). It also transmits data to the VS1053b
from the other end of the ring buffer. If the ring buffer becomes too full, the Main CPU
must carefully increase VS1053b’s playback samplerate as explained in Chapter 5.3,
Playback Speed Adjustment. Similarly, if the buffer is too empty, playback samplerate is
slightly decreased. If the changes are done slowly enough and with small enough steps,
the listener can’t notice them.
Note that VS1053b may encode at a slightly different speed from what is the nominal
samplerate as explained in Chapter 2.6. Also, clock skew and other factors may affect
the real speeds of the Server and Client(s). Thus, playback speed adjustment is a must
in any streaming system. You may use a sample counter, presented in Chapter 5.1, to
help control the end-to-end delay.
Note that Ogg Vorbis files are not designed to be resilient to bit errors. If you have a
transmission channel that may lead to bit error (e.g. RF link), you should check for them
in your transmission path and remove the packets that are broken. This will lead to
unsynchronized audio until your playback speed adjustment corrects for that.
For further information, see Chapter 5.4, Streaming Example.
Rev. 1.70c 2012-11-16
Page 34(39)