Go Down

Topic: Due Audio.Begin() speed for 44100 mono files (Read 180 times) previous topic - next topic

rickyelqasem

Please remind me the speed setting for Audio.Begin() so I can play 44100 mono wav files? I had it working a few weeks back but when set it to:

Audio.begin(44100, 100);

my wavs are playing a double speed. If I set to 22050 it plays at correct speed but it seems like I lose a bit of quality.

ard_newbie

#1
May 20, 2018, 05:47 am Last Edit: May 20, 2018, 08:32 am by ard_newbie
When I look at Audio.h library, I see that the 2 DACs are enabled (stereo). I don't think this library can be used to play .wav files in mono, only in stereo.

The header of a .wav file (first 44 bytes) provides informations on the number of bites per sample (e.g. 16) , sample rate (e.g. 44.1 Khz), whether it's a mono or stereo recording and the number of bytes to read. So "all" you have to do is open the .wav file, extract the above informations, transform 16-bit samples into 12-bit samples and program the DAC peripheral accordingly.

IMO, the way the PDC DMA for DACC is handled in this library is really weird.

rickyelqasem

But when I look at other articles I've seen people put (44100, 100) is mono.. and I've positive I had it working before. My MACbook died and I lost the code.

rickyelqasem

Ok I remembered what it is, I need 32k files not 8 bit... speed was right for 32k files. but the only way to get was to 1/2 sample rate which is while I lost quality...

Go Up