I'd like to create program which sounds a tone on command, or at pre-specified times of day. Using the Arduino Due and the onboard DAC, it is putting out very nice 44100 16-bit audio track to my amp's line in.
The file it plays is stored on an ethernet shield with SD card. Ethernet is not being used. Just the SD.
I'm using SimpleAudioPlayer.
I have struck a problem. It sounds, for all the world, like the needle is being dropped on the record when Audio.begin() is executed, Audio.prepare(buffer, S, 1024) is executed, and Audio.end() is executed.
Basically, unusable.
Is this the expected behaviour of the DAC? Would the issue be the dac.h or audio.h?
I have tried:
Multiple Dues
Multiple WAV files (different bit rate, mono/stereo, etc)
Multiple ethernet shields
Code workarounds like "analogWrite(0,0);" before Audio.begin();
Any help to silently initialise and prepare the DAC would be most appreciated.
A similar problem happened in the very early days of the Teensy Audio Library. I solved it by adding code in the constructor to slowly rise the DAC from 0 to 2048 over about a quarter second.
Here's the code:
Maybe you could do something similar in setup(), before sending actual audio to the DAC.