We detect you are using an unsupported browser. For the best experience, please visit the site using Chrome, Firefox, Safari, or Edge. X

Digital Audio Basics


Audio Source Frequencies Popular Sampling Rates
Tones, Buzzers Usually a sinusoid of single frequency within the 3 kHz range 2–4 times the tone with the largest frequency
DTMF A weighted sum of two sinusoids at specific standard frequencies between 500 Hz and 3 kHz 7.2 kHz or greater
Alarms Usually a time-varying sweep of a range of frequencies Twice the largest frequency
Human Speech/Voice Can be viewed as a weighted sum of signals between 300 Hz to 3.3 kHz. A human voice is capable of generating these frequencies. 8 kHz, 11.02 kHz, 16 kHz
Music and Musical Instruments Can be viewed as a weighted sum of signals between 20 Hz to 20 kHz. A human ear can perceive these frequencies. 32 kHz (good enough for most instruments), 44.1 kHz (CD-quality), 48 kHz (PC soundcards)
Music and Musical Instruments Can be viewed as a weighted sum of signals between 20 Hz to 20 kHz. A human ear can perceive these frequencies. 48 kHz, 96 kHz, 196 kHz
MP3 and WMA decoder libraries for PIC32 devices support sampling rates of 8 kHz to 96 kHz and high-resolution USB solutions are available supporting up to 196 kHz.

Sampling Rate


Sampling rate is the number of samples of a signal that need to be captured or played back within a second to ensure the signal has been captured intelligently. The sampling rate should satisfy Nyquist criterion to prevent effects of aliasing. Nyquist criterion requires the sampling rate to be greater than twice the highest frequency in the band of interest.

Bit Rate


Bit rate is the product of number of bits used to record a given sample and the sampling rate. It is expressed in kilobits per second (kbps).

Audio Quality, Software Codecs and Low-Bit Rate Coding


Audio quality is directly proportional to the bit rate. However, since it can take significant memory to record an audio signal in its original form or significant time to transmit an audio signal in its original form, several software codecs such as ADPCM, G.711, G.726A and Speex have been created to compress the raw audio signal without affecting audio quality in many cases. Here’s a simple comparison:

  • One second of a speech signal recorded at 16-bit resolution at 8 kHz sampling rate requires about 128 kilobits or 16 KB of memory for storage
  • One second of the speech signal recorded at 16-bit resolution at 8 kHz sampling rate and encoded using the Speex library for dsPIC® DSCs will require 8 kilobits or 1 KB for storage, providing a 16:1 compression

See the Playback and Recording sections for further details on various algorithms and on-chip peripherals used in audio applications.

Documentation

Title Download
AN1367 - Porting the Helix MP3 Decoder onto Microchip's PIC32MX 32-bit MCUs Download
AN1152 - Achieving Higher ADC Resolution Using Oversampling Download
AN1422 - High-Quality Audio Applications Using the PIC32 Download
AN643 - Adaptive Differential Pulse Code Modulation using the PIC16/17 Download
Title Download
dsPIC33EPXXX(GP/MC/MU)806/810/814 and PIC24EPXXX(GP/GU)810/814 Data Sheet Download
dsPIC33FJXXXGPX06A/X08A/X10A Family Data Sheet Download
PIC32MX1xx/2xx 28/36/44-pin Family Data Sheet Download
PIC32MZ Embedded Connectivity with Floating Point Unit (EF) Family Data Sheet Download
PIC32MX330/350/370/430/450/470 Family Data Sheet Download
PIC32MX1xx/2xx/5xx 64/100-pin Family Data Sheet Download
PIC24FJ1024GA610/GB610 Family Data Sheet Download
PIC32MX1XX/2XX 28/44-pin XLP Family Data Sheet Download

Development Tools

Description Part Number
PIC32MX Curiosity Development Board DM320103
PIC32MM USB Curiosity Development Board DM320107
PIC32MZ Embedded Connectivity with FPU (EF) Starter Kit DM320007
PIC32MZ Embedded Graphics with Stacked DRAM (DA) Starter Kit DM320010
PIC32MZEF Curiosity Development Board DM320209
Description Part Number
BM64 Bluetooth Radio Daughter Board AC320032-3
Audio Codec Daughter Card – AK4642 AC320100
Audio Coder Daughter Card – AK7755 AC327755
PIC32 Audio DAC Daughter Card AC320032-2
Description Part Number
Explorer 16/32 Development Board
DM240001-2
MPLAB Starter Kit for dsPIC DSC
DM330011

Software Libraries

Recording and Playback Software Libraries


Audio Functions Resource Type Title and Link Supported Families
Audio and Speech Library MP3 Decoder Library for PIC32MX PIC32 MCU
Audio and Speech Library PIC32 Audio Equalizer Filter library PIC32 MCU
Bluetooth Audio Library PIC32 Bluetooth®Audio Software Suites PIC32 MCU
AAC Playback Library AAC Decoder Library for PIC32 PIC32 MCU
Streaming Audio Demo USB Audio Headset Demo PIC32MM MCU
Record and Playback, Streaming Audio Library dsPIC33E Sample Rate Conversion dsPIC33E
Record Application Note and Source Code AN1152-Achieving Higher ADC Resolution Using Oversampling dsPIC33E, dsPIC33F
Record and Playback, Voice Communications Library SW300026 dsPIC/PIC24 G.711 Speech Encoding & Decoding Library dsPIC33E, dsPIC33F
Record and Playback, Voice Communications Library SW300090-dsPIC G.726A Speech Encoding/Decoding Library dsPIC33E, dsPIC33F
Record and Playback, Voice Communications Library SW300070-Speex Speech encoding/decoding Library dsPIC33E, dsPIC33F
Record and Playback, Voice Communications Library dsPIC®DSC Equalizer Library dsPIC33E, dsPIC33F
Voice Communcations Library SW300060-Aucostic Echo Cancellation Library dsPIC33E, dsPIC33F
Voice Communcations Library SW300080-Line Echo Cancellation Library dsPIC33E, dsPIC33F
Voice Communcations Library SW300040-Noise suppression library dsPIC33E, dsPIC33F
Voice Communcations Library dsPIC DSC Automatic Gain Control Library dsPIC33E, dsPIC33F
Record and Playback, Voice Communications GUI dsPIC DSC Speech and Audio Fast Forward (SAFF) tool dsPIC33E, dsPIC33F
Record and Playback, Voice Communications GUI Digital Filter Design dsPIC33E, dsPIC33F
Record and Playback, Voice Communications GUI dsPICworks Data Analysis & DSP software (use to convert PCM to WAV and back) PIC24F, dsPIC33E, dsPIC33F