Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

Basics on playing WAV with Arduino

Sometimes you may want to ad sound to your projects, but adding additional hardware (like MP3 decoder) doesn’t seem worth efforts and expenses. Beep tones also seem to be not acceptable. What you are left with is simple WAV player, which can be played directly from microcontroller pin using PWM modulation. How hard can it be to set up a simple WAV player on Arduino? Kathy Yang has shared great guide on building simple WAV player on Freaduino UNO. He vent through all steps how to get your results. First of all he goes through audio basics where he analyzes sampling and quantization. This is a point where you need to decide your sound quality. Then follows to getting audio data from WAV files because file consists of data part (head) and audio data that can be played.


The rest is to store audio data in to RAM. OF course with limited RAM you can play couple seconds of audio. If you are looking for more space, you can use external storage like SD card, EEPROM, flash, etc. Audio data is sampled with timer in PWM mode. Simple RC low-filter before phones filters PWM signal to get smooth output. If you chose larger Arduino you should have no problem playing several short messages and tones to get great feel.

[..Source link..]

Bookmark the permalink.

Comments are closed.