Hello! I faced a problem. The MP3 player DFPlayer mini "eats" the beginning of the sound file.
MP3 player is connected to Mega2560 and powered by 5v from the Mega's connector. Mega is powered via USB, because I did not set the maximum volume on the player. Speaker 8 Ohm. On average volume, the sound is not distorted. I send commands through UART1 (pin 18,19). There are no problems with command processing.
I found an unpleasant feature - at the beginning of the track, the volume of sound increases smoothly for 50 ms. Moreover, if I play the same file several times in a row by sending commands through UART, sometimes it starts playing at once with the normal volume level, and sometimes with a smooth increase. In my device, it is required that the attack (attack length 10 ms) of the recorded signal in the file must be played at normal volume.
I tried to add silence at the beginning of file, different lengths from 50ms to 1s, it did not help. A smooth 50 millisecond rise occurs at the beginning of the actual recorded signal. I was very surprised by this behavior.
I tried to add to the beginning of the file a 50ms high-frequency signal from 16 to 20 kHz at the level of -6dB, which would not be reproduced by the speaker, so that the moment of smooth increase would fall on the high-frequency signal. It has not helped too. It still sometimes plays with a smooth increase, sometimes with a normal volume.
I tried to send a command to play after a few milliseconds pause (from 10 to 1000 ms) after the previous file was played, and tried to sent the next command to play, while the previous file was still playing.
I tried the wav and mp3 file formats. This does not affect the problem. The sampling frequency in all files is 44100Hz.
I tried all playback commands 0x03, 0x0D, 0x0F, 0x12, 0x14. This also does not affect the problem.
Link to the module https://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299
If someone encountered such a problem, tell me please, is there a solution for playback the beginning of each file at the normal volume?