My favorite thing is to make products with voice broadcasts, and the process of writing programs is too boring.

Some products are developed for several months, and the whole process is inevitably a little lonely to deal with cold LEDs, buzzers, buttons, and LCD screens.

Adding voice is different, recording a good girl’s voice can not only improve the pressing of the entire product, but also full of a sense of achievement.

Let’s talk about how to make products with voice today.

In actual products, there are many kinds of voice playback solutions with single-chip microcomputers, the only one is that there is no development board, because the cost does not meet the product requirements in all aspects.

In addition, add a voice chip, if the high-profit product will give priority to the use of this, a few dollars can still be accepted.

There is also soft decoding, that is, decoding the voice file into PWM and DAC data that can be recognized by the speaker, which is the most difficult technology and is a test for the engineer’s programming level.

Although it is difficult, but the cost is low, there is no need to add additional voice chips, the boss’s favorite, anyway, the engineer loses some hair and has no effect on the company.

Soft decoding was played once when I was an electronic dog 6 or 7 years ago, and the approximate principle is to merge voice files into bin files, burn them into external flash, and do a good job of address mapping for each voice.

Use a single-chip microcomputer to read the Flash data and decode it, and then convert it into PWM or DAC and output it to the speaker through the power amplifier.

This kind of general need to have a writing computer cooperation, in the past there was no tool on the market to merge voice files into bin files, now it seems to have.

The time is too long, many details are not clear, if you can still find the information in the future, I will share it with you.

Today, Infinity MCU programming will tell you about a method I did later:

With a voice chip

Here are some introductions to voice chips:

What we need to pay attention to is that this chip’s support for voice length is 55s, 25s, and 85s, respectively, if the product has less voice, it is quite appropriate.

If this chip has less voice, it directly uses the Flash inside the chip, and if there is more voice, it needs to be plugged in to store voice data.

Generally, the voice of each product is different, so how to play the voice we want through this voice chip?

To achieve this function, there are several steps:

There are many similar software to convert voice copy into MP3 format voice files through software, such as iFLYTEK.

Provide the voice file to the chip side and let them customize it for you.

After getting the sample, it is soldered to its own board, and then the control timing program is written according to the chip specifications, each voice corresponds to an address, as long as the address data is written to the chip, the chip will automatically play the specified voice.

Isn’t the whole process very simple?

In addition to the voice playback function, there are some additional functions, such as mute, volume adjustment, loop playback, and so on.

Let’s take a look at the pinout definition of the chip

Generally, 3 wires are used to communicate with the single-chip microcomputer.


Data cable


Clock line


Busy line, when there is a voice announcement, this pin is low.

The control timing of the chip is as follows:

It is not difficult to find that before the data starts, the SCL needs to generate a 5ms low-level sync bit, and then the data is read on the rising edge of the SCL line, a total of 8 bits, that is, 1 byte.

It doesn’t matter if you can’t write this timing, the chip factory has provided routines.

You might also enjoy: