Skip to main content

GR-CITRUS Special Project: Play MP3, WAV Files with Embedded ROM

Overview

Play MP3 and WAV format files saved on embedded ROM. Unlike the SD card version, there is no need to prepare a Micro SD card, but be aware that the size of music files is quite limited. Only WAV files can be played on boards consisting of 16-bit microcomputers such as GR-COTTON and GR-KURUMI. As a result, only game sound effects and simple greetings such as "Good morning!" can be played

Preparation

A piezoelectric sounder can be used if small sound is acceptable for testing.

piezoelectric-sounder

However, because the sound is small with a piezoelectric sounder, the recommended configuration is to use a stereo mini jack sold by Akizuki Denshi, and connect a speaker with an amplifier or an earphone.

stereo-mini-jack

GR-SAKURA, GR-CITRUS & GR-COTTON

Connect a piezoelectric sounder or stereo jack as follows. The board side pin numbers are described in the Web Compiler project readme, but are as follows.

  • GR-SAKURA: Pin 6, 7
  • GR-CITRUS: Pin 0
  • GR-COTTON: Pins 3, 5

As mentioned, for the piezoelectric sounder: Connection is simple but the sound is small.

piezoelectric-sounder-preparation

For stereo jacks: Connect the jacks to the breadboard and connect them to the board using wires.

play-music-prepare-jack-2

Create a Project with the Web Compiler

There is a template for playing back sound from ROM in the Web compiler, just select a template for the board to be used, create a project, build it, and write a bin file.

rom-music-web-compiler

Change or Add Songs

When changing songs, upload an mp3 or wav file to the project, and match the file name in the arguments of the play method. After the build, Perl will run an mp3/wav search and the song data will be linked automatically. If you delete a file from the project, the song data will be deleted automatically.

The songs posted on the web compiler are written in the Readme, but they were downloaded from the Joker Sounds site. There are various sound effects to try.

rom-music-web-compiler