This is my first AVR based hobby project and the most successful one compared to my all previous stuff. I am 100% satisfied with this work. Few months ago, I tried to make a wav player using a PIC16F877A. It worked anyway, but the audio quality was not so good for higher sampling rate because that chip doens’t have enough ram and thus I couldn’t implement a good data buffer. But when I bought an atmega32 microcontroller, the first thing came to my mind is to make a good wav player…Now, I have completed my work and the audio quality is really amazing… NOW I can say that, my wav player IS ABLE TO PLAY 8 BIT MONO/STEREO with maximum bitrate of 1300kbps for mono and 1600kbps for stereo … ie it can play an 8 bit mono wav of sampling frequency upto 160KHz and stereo upto 96KHz without any noise or trouble!!!!! (at OSC 16.450MHz).
(updated the complete source code + makefile + hex + asm + .out files on bitbucket repository) link is provided below the source code.
[The full range of human hearing is between 20 Hz and 20 kHz. The minimum sampling rate that satisfies the sampling theorem for this full bandwidth is 40 kHz. The 44.1 kHz sampling rate used for Compact Disc was chosen for this and other technical reasons. High-end audio equipment, such as in SACD or DVD-Audio players or studio equipment, can reach as high as 192 kHz.]
Now I believe this is a perfect 8 bit stereo wav player. Because I compared the same converted files played in my PC and in my player, but I couldn’t find any difference in the playback quality. You can see it on the video (it is taken through my mobile phone, so the recorded audio may not be as good as the real one). Any way, since the PWM have some limitations, I also tried the R2R ladder DAC… But I couldn’t find any more improvement because it is already at it’s top quality. Also, I think since I converted MP3 to WAV, so even if I increase the sampling rate in the conversion process, just for testing the maximum capacity of the player, but that couldn’t help me to find the difference of PWM and R2R because the original audio is having a sampling rate of only 44.1KHz… So I am not going for an R2R dac and instead I am using the PWM itself…
Another interesting feature of my player is that, it could be controlled with a Philips TV remote (RC5 protocol). Also I had implemented few functions on the remote control, ie NEXT SONG, PREVIOUS SONG, PAUSE, PLAY, FORWARD 15 SECONDS, and some funny effects like PLAY SPEED INCREMENT and DECREMENT. Also I am still trying to include more features on the remote… The player is now a beta_version ;-)….
Also, I didn’t used any external FAT libraries for the low level MMC accessing. Instead I had written my own code for that… So you may not be able to find any standard ‘C’ FILE operations on my source code.