In this project, we will use the onboard SD card slot as well as the onboard microphone to demonstrate how to play and record .wav files on the SD card.
As RTL8722DM MINI has a built-in microphone on the board, there is no need for any external microphone. Copy a sample wav file into the MicroSD card for demo. (In this example, the sample name is “Test_Audio_48khz_16bit_stereo.wav”. ) Then insert the MicroSD card into the adapter at the back of the board.
2
Example 01 PlaybackWavFile
Open the example, “Files” -> “Examples” -> “AmebaAudioCodec” -> “PlaybackWavFile”.
Upload the code and press the reset button on Ameba once the upload is finished. Insert earphones/speakers into the onboard jack for playing the sample sound.
3
Example 02 RecordWavFile
Open the example, “Files” -> “Examples” -> “AmebaAudioCodec” -> “RecordWavFile”.
Define a GPIO/button(Input high to active) for “RECORDBTN”. Define the “filename[]” for the name of the storge wav file. In this example, the name is “Test_Recording_48khz_16bit_mono.wav”. Upload the code and press the reset button on Ameba once the upload is finished. Input high to “RECORDBTN”, then record voice by the onboard mic. When the input is low the record stops. The recorded voice will be stored in “Test_Recording_48khz_16bit_mono.wav” located on a MicroSD card.