I want to understand the concept of sending wave file sound data to ATmega328P to drive a 8ohm 2W speaker.
I aware there is TMRpcm library but without understanding the WAVE format and sound concept is hard read the code and it is using Timer, which another stuff to learn.
I have extracted the .WAV PCM unsigned 8 bits data block and below is information:
filename: [helloworld.wav] filesize: [8750] id: [RIFF] size: [8742] type: [WAVE] chunk_id: [fmt ] chunk_size: [16] format: [1] channel: [1] sample_per_sec: [11025] average_bytes_per_sec: [11025] block_align: [1] bits_per_sample: [8] data_id: [data] data_size: [8706] data_block ........
QUESTIONS:
-
is the .WAV data block a RAW format data ?
-
Since the bits_per_sample is 8 bits, let's say the first byte of data block is 0x41, 01000001 in binary. If to send this 8 bits data byte 0x41 to turn ON/OFF pulse to a GPIO pin that connected to speaker, the bits order should it starts from left-to-right or right-to-left ?
left-to-right --->> ? 0 1 0 0 0 0 0 1 ----------------> ATmega328P PWM pin -------------> 8 ohm 2W speaker ? <<--- right-to-left
-
I wrote a program before to send RAW .snd speech data by turning ON/OFF the PIC port to create sound on the PC internal speaker ( during 90's ) during MSDOS day but I am unsure under Arduino platform, the .WAV PCM unsigned 8 bit mono data block is RAW format or not ?
Any guideline or reference is greatly apprieciated.
Please advise.