Daiki Kato / Mbed OS GR-PEACH_Audio_WAV_PwmOut Featured

Dependencies:   EasyPlayback

Fork of GR-PEACH_Audio_WAV by Renesas

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.

/media/uploads/dkato/pwm_speaker_img.png

FormatWav file (RIFF format) ".wav"
Channel1ch and 2ch
Frequencies32kHz, 44.1kHz and 48kHz
Quantization bit rate8bits 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

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];