text
stringlengths
1
112
however to be able to do that you have to be able to compress the audio so that you have
time to transmit multiple copies that s done using codecs which is a portmanteau word for
coder and decoder
the coder takes in an analogue signal digitises it and compresses the digital data so that it can
be transmitted in a shorter time than the length of the original sample this me ans that it can
be transmitted multiple times before the next sample is taken if the first transmission is lost
or corrupted the following retransmission can be used in its place the decoder in the
receiving device decodes the received data expandi ng it to regenerate the original audio signal
as it takes time to perform the encoding and decoding this results in a delay between the
original signal and the reconstituted signal coming out o f the decoder
audio codecs are a relatively recent in vention the first hundred years of audio transmission
from the s phonoautograph through radio broadcasts vinyl records and magnetic tape
all worked with the original audio signal if there was interference from the weather a scratch
on a recor d or wax cylinder or stretching on a tape the sound was lost or distorted this
changed with the introduction of cds which w ere made possible by the development of pulse
code modulation pcm which converts an analogue signal to a digital signal
pcm works by sampling the audio signal at a higher frequency than we can hear times
per second for a cd converting each sample into a digital value decoding performs this
operation in reverse using a digital to audio decoder to restore the analo gue signal the more
bits in each sample the closer the output audio will be to the original input cds along with
most audio codecs use bit samples where the sampling rate and the bits per sample are
sufficiently high the human ear cant detect the difference however the file sizes for a pure
pcm digital file are large as there is no compression involved sampling at khz and
bits generates k bits every second so a five minute song in mono is around mb or
mb for stereo thats what limits a standard cd to around an hour of music
the arrival of the mp audio codec developed by the fraunhofer institute transformed the
distribution of digital music it uses a technique called perceptual coding sometimes also
section codecs and latency
called psychoacou stic modelling which compares the audio stream with a knowledge of what
a human ear can actually hear that may be a high frequency sound which is above the range
most people can hear so can be encoded with less data or a held note where an encoder ca n
indicate that you just need to repeat the previous sample or encode a difference from it by
applying these methods it is possible to significantly reduce the size of a digitised audio file
mp typically reduces the size of a digitised mu sic file by between and depending
on the content few listeners were worried about any slight loss of quality from this process
feeling that the increased convenience far outweighed any noticeable effect on the music
the reduction in the size o f music files led to the creation of music sharing services like
napster and the appearance of mp players it also fired the starting pistol for the
development of streaming services and wireless audio transmission as the reduced file sizes
meant that t here was plenty of time to retransmit the compressed audio packets helping to
cope with any interruptions to transmission
codecs and latency
one downside to the use of codecs is that they add latency to the signal this is a delay
between the arrival of the original analogue signal at a transmitter and the rendering of the
reconstituted signal at the receiver
figure the elements of latency in an audio transmission
figure shows the elements that make up that latency first the audio is sampled
perceptual coding requires a codec to look at multiple consecutive samples as a lot of the
opportunities for compression come from identifying periods of repeated sound or lack of
sound this means that most codecs need to capture sufficient successive samples to have
enough data to characterise these changes this period of sampling is called a frame different
encoding techniques use different frame lengths but its almost always a fixed duration if its
too short the limited number of samples starts to reduce the efficiency of the codec as it
doesnt have enough info rmation to apply the perceptual coding techniques which impacts
the quality on the other hand if the frame sizes grow the quality improves but the latency
increases as the codec has to wait longer to collect each frame of audio data
chapter lc latency and qos
figure the sweet spot for audio codec frame size
figure illustrates the trade off this will vary from codec to codec depending on how
they perform the compression but for a general purpose codec which can be used for both
voice and music the industry has found that there is a sweet spot for the frame length of
around ms which gives good quality at a reason able latency
there is another trade off which is the amount of processing power that you need to run the
codec which is known as the complexity as you try to squeeze more audio quality out of the
codec you need a faster processor which starts to red uce the battery life that may not be a
problem on a phone or pc but if you are encoding the microphone input of a hearing aid or
earbud its a very serious problem
returning to figure and the general principles of wireless audio transmission once the
audio frame has been encoded the radio will transmit it to the receiving device the
transmission is normally quick compared to the encoding but if the protocol contains
retransmission opportunities you need to allow for these before you start decoding the
duration between the start of transmitting the first time to the end of the last transmission
being received is called the transport delay and can range from a few milliseconds to several
tens of milliseconds you can start decoding as soon as you receive the first packet but if
you do you will need to buffer it thats because the output audio stream needs to be
reconstructed to h ave no gaps so it must be delayed until every opportunity for a
retransmission has passed to cope with the instances when a packet needs the maximum
number of retransmissions to get through otherwise packets which arrive early will be
rendered early w hile others wont
finally after the encoded audio data has been received it needs to be decoded and then
converted back to analogue form to be rendered decoding is normally quicker than encoding
and doesnt have a frame delay as the decoder expands the output frame aut omatically it
section classic bluetooth codecs their strengths and limitations
generally uses far less power than encoding as most codecs are designed for use cases where
a file is encoded once at production then decoded many times as when youre streaming
music from a central server so there is an inherent asymm etry in the design
classic bluetooth codecs their strengths and limitations
the existing bluetooth audio profiles were both developed with specific requirements for their
individual use cases with different codecs optimised for each as shown in figure the
original hfp specification was designed to use a cvsd continuous variable slope delta
modulation coding method which is a low latency codec widely used in telephony
applications
figure performance of hfp and adp profiles
cvsd was one of the first methods for digitising and compressing voice it samples rapidly
typically at samples per seco nd but only captures the difference between the current
sample and the preceding one this means that it is frameless and has a comparatively short
sampling and encoding delay similarly the output decode can be performed quickly the