Electronic Components Datasheet Search
  English  ▼

X  

AN3126 Datasheet(PDF) 19 Page - STMicroelectronics

Part # AN3126
Description  Audio and waveform generation using the DAC in STM32 microcontrollers
PDF  24 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN3126 Datasheet(HTML) 19 Page - STMicroelectronics

Back Button AN3126 Datasheet HTML 15Page - STMicroelectronics AN3126 Datasheet HTML 16Page - STMicroelectronics AN3126 Datasheet HTML 17Page - STMicroelectronics AN3126 Datasheet HTML 18Page - STMicroelectronics AN3126 Datasheet HTML 19Page - STMicroelectronics AN3126 Datasheet HTML 20Page - STMicroelectronics AN3126 Datasheet HTML 21Page - STMicroelectronics AN3126 Datasheet HTML 22Page - STMicroelectronics AN3126 Datasheet HTML 23Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 19 / 24 page
background image
Doc ID16895 Rev 2
19/24
AN3126
Application examples
23
2.2.2
Audio wave file specifications
This application assumes that the .WAV file to be played has the following format:
•
Audio Format: PCM (an uncompressed wave data format in which each value
represents the amplitude of the signal at the time of sampling)
•
Sample rate: may be 8000, 11025, 22050 or 44100 Hz
•
Bits Per Sample: 8-bit (Audio sample data values are in the range [0-255])
•
Number of Channels: 1 (Mono)
2.2.3
.WAV file format
The .WAV file format is a subset of the Resource Interchange File Format (RIFF)
specification used for the storage of multimedia files. A RIFF file starts with a file header
followed by a sequence of data chunks. A .WAV file is often just a RIFF file with a single
"WAVE" chunk consisting of two sub-chunks:
1.
a fmt chunk specifying the data format
2.
a data chunk containing the actual sample data.
The WAVE file format starts with the RIFF header: it indicates the file length.
Next, the fmt chunk describes the sample format, it contains information about: Format of
the wave audio : (PCM/...), Number of channels (mono/stereo), sample rate (number of
samples per seconds : e.g., 22050), and the sample Data size (e.g. 8bit/16bit). Finally, the
data chunk contains the sample data.
2.3
Audio wave player implementation
The Audio wave player application is based on the SPI, DMA, TIM6, and DAC peripherals.
At start up, the application first uses the SPI to interface with the MicroSD card and parses
its content, using the DOSFS file system, looking for available .wav files in the USER folder.
Once a valid .wav file is found, it is read back though the SPI, and the data are transferred
using the CPU to a buffer array located in the RAM. The DMA is used to transfer data from
RAM to DAC peripheral. TIM6 is used to trigger the DAC which will convert the Audio digital
data to an analog waveform.
Before the audio data can be played, the header of the WAV file is parsed so that the
sampling rate of the data and its length can be determined.
The task of reproducing audio is achieved by using sampled data (data contained in the
.WAV file) to update the value of the DAC output, this data is coded in 8 bits (with values
from 0 to 255),
The DAC Channel 1 is triggered by TIM6 at regular interval specified by the sample rate of
the .WAV file header.
The .WAV files are read from the MicroSD Memory using a DosFS file system.
In the Demo code, code files handling the waveplayer demo are:
waveplayer.c
waveplayer.h
The wave player demo is called using WavePlayerMenu_Start() function which has the
flowchart shown in Figure 16.



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com