Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of GR-PEACH_Audio_WAV by
This is a sample that drives a speaker with PWM. This sample will play a ".wav" file of the microSD or USB memory root folder. If the USER_BUTTON0 is pressed, the next song is played.
Format | Wav file (RIFF format) ".wav" |
Channel | 1ch and 2ch |
Frequencies | 32kHz, 44.1kHz and 48kHz |
Quantization bit rate | 8bits and 16bits |
You can adjust the volume by changing the following.
main.cpp
AudioPlayer.outputVolume(0.5); // Volume control (min:0.0 max:1.0)
The default setting of serial communication (baud rate etc.) in mbed is shown the following link.
Please refer to the link and change the settings of your PC terminal software.
The default value of baud rate in mbed is 9600, and this application uses baud rate 9600.
https://developer.mbed.org/teams/Renesas/wiki/GR-PEACH-Getting-Started#install-the-usb-serial-communication
Diff: main.cpp
- Revision:
- 8:7121197d098e
- Parent:
- 7:4b6799c255ea
- Child:
- 9:c7c0a97fdb7f
--- a/main.cpp Tue Aug 18 04:19:19 2015 +0000 +++ b/main.cpp Mon Apr 18 09:17:50 2016 +0000 @@ -21,8 +21,13 @@ #define FLD_PATH "/usb/" //4 bytes aligned! No cache memory +#if defined(__ICCARM__) +#pragma data_alignment=4 +static uint8_t audio_write_buff[AUDIO_WRITE_BUFF_NUM][AUDIO_WRITE_BUFF_SIZE]@ ".mirrorram"; +#else static uint8_t audio_write_buff[AUDIO_WRITE_BUFF_NUM][AUDIO_WRITE_BUFF_SIZE] __attribute((section("NC_BSS"),aligned(4))); +#endif //Tag buffer static uint8_t title_buf[TEXT_SIZE]; static uint8_t artist_buf[TEXT_SIZE];