English
Language : 

AN3143 Datasheet, PDF (7/13 Pages) STMicroelectronics – Audio software codec for the STM8S
AN3143
Audio data encoding and storing
Another way to store audio data to the internal memory is to link audio data arrays with the
compiled code. To include raw data in a project, a binary representation of the data have to
be converted to ASCII format. Any advanced HEX editor is able to export data in this format
which is then readable by ANSI C compilers. The TxD hexa editor (see References) is an
easy-to-use software, with a free license, no restrictions for commercial use, and which can
be freely distributed.
The processing of audio data, which have to be included in a project, consists of loading
binary data into the editor and exporting them as a C source code.
Figure 3. Hexa editor export to C source code
The output of this operation is a C source file with one array:
unsigned char rawData[10340] = { ...
This declaration has to be modified, using compiler directives, into an array of constants in
the program memory. This is done for the COSMIC compiler as follows:
const @far unsigned char rawData[10340] = { ...
For the Raisonance compiler, the following directive has to be used:
fcode unsigned char rawData[10340] = { ...
For more details, see the firmware project associated with this application note on
www.st.com/mcu.
Doc ID 17011 Rev 1
7/13