|
|
2 ani în urmă | |
|---|---|---|
| .. | ||
| main | 2 ani în urmă | |
| tools | 3 ani în urmă | |
| CMakeLists.txt | 3 ani în urmă | |
| README.md | 3 ani în urmă | |
| pytest_dac_audio.py | 3 ani în urmă | |
| sdkconfig.ci.async | 3 ani în urmă | |
| sdkconfig.ci.sync | 3 ani în urmă | |
| Supported Targets | ESP32 | ESP32-S2 |
|---|
(See the README.md file in the upper level 'examples' directory for more information about examples.)
This example shows how to play a piece of audio by DAC driver.
NS4150This example uses the audio that stored in a buffer, which is put in audio_example_file.h. You can also create your own audio buffer by the python script generate_audio_file.py.
Build the project and flash it to the board, then run monitor tool to view serial output:
idf.py -p PORT flash monitor
(Replace PORT with the name of the serial port to use.)
(To exit the serial monitor, type Ctrl-].)
See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
You can see the following logs on the monitor:
I (277) dac audio: DAC audio example start
I (277) dac audio: --------------------------------------
I (287) dac audio: DAC initialized success, DAC DMA is ready
I (297) dac audio: Audio size 79512 bytes, played at frequency 16000 Hz
I (5137) dac audio: Audio size 79512 bytes, played at frequency 16000 Hz
I (9967) dac audio: Audio size 79512 bytes, played at frequency 16000 Hz
...
And meanwhile, you can hear the audio played every 1 second from the speaker or earphone.