%Copyright (C) 2007-2015  Brian Langenberger
%This work is licensed under the
%Creative Commons Attribution-Share Alike 3.0 United States License.
%To view a copy of this license, visit
%http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to
%Creative Commons,
%171 Second Street, Suite 300,
%San Francisco, California, 94105, USA.

\chapter{Ogg Speex}
Ogg Speex is Speex audio in an Ogg container.
Speex is a lossy audio codec optimized for speech.
All of the fields within Ogg Speex are little-endian.

How Ogg containers break up data packets into segments and pages
has already been explained in the Ogg Vorbis section on page \pageref{vorbis}.
Therefore, I shall move directly to the Ogg Speex packets themselves.

\section{the Header Packet}

The first packet within a Speex stream is the Header packet.
It contains the number of channels and sampling rate.
Like Vorbis, the number of bits per sample is generated during
decoding and the total number of samples is pulled from the
\VAR{Granule Position} field in the Ogg stream.

\begin{figure}[h]
\includegraphics{figures/speex_header.pdf}
\end{figure}

\section{the Comment Packet}

The second packet within a Speex stream is the Comment packet.
This is identical to the comments used by Ogg Vorbis which is
detailed on page \pageref{vorbiscomment}.
