I'm using a DFPlayer Pro for cosplay and it's all working fine but there is an anoying delay using the playFileNum(number) function.
I'm using wav files to reduce delay, and it works well when looping a file in SINGLECYCLE, CYCLE or PLAYALL playmodes : files are playing with no delay.
But if I send the playFileNum(number) command, there is about 200-400 ms delay between the actual sound stopped and the start of the specified file.
It's like the command is creating a delay...
Is there a way to remove/reduce that delay somehow? Thank you!
Tracks are in the root directory, they are name 01.wav, 02.wav, etc.
They were stored in playing order one at the time.
They are from 200 to 3000kb wav files. There is no delay when they are shuffleling in play all or cycling playmode, just when using playFileNum() function. So it doesn't seem a buffering issue?
I'm using the DFRobot_DF1201S library, is there another one for DFPlayer pro?
I'm also using an Arduino Nano Every on Serial1 at 115200 baudrate to drive the DFPlayer Pro.
A 1k resistor is inline on the TX line to the DFPlayer Pro RX pin.
After more analysis with some output to Serial, delay is not the problem. It's quite smooth with just a few 5-10 ms delay between command and starting.
What I tough was a delay is in fact some clipping sound from stopping the playing file, and another clipping sound from starting the file. It's not constant, sometime more clipping sounds occur, sometime less.
I don't have clipping sound when files switch in automatic cycling mode or playall mode. Only if I ask to play a specific file with playFileNum() or playSpecFile().
Those clipping sounds are ruining my sound effects, it's annoying...
Ok I've been trying to send the command before the end of the playing file. I've found a sweet spot, 600ms before the end of the playing file, where I send the playFileNum() command with a little to no clipping sound. It's not perfect but acceptable.
But I loose a part of the playing file. So next thing that I'm gonna try is to edit my wav files for a little longer to be able to send the playFileNum() while the current file is playing and before 600ms of the end. Exemple : if I have a 5000ms file now, I'll will make it 6000ms, so I can send the play new file command at 5000ms. Thus the file will play the initial 5000ms and be cut by the command play function, but clipping/popping sounds should be minimum.
It seems that sending a command to play a new file near the end of the current playing file cause some clipping/popping sounds while changing file...
I have think of something! DFPlayer Pro is 3.3V logic. They say to put a 1kohms resistor on the RX/TX line if couple with an Arduino. I did that. But maybe it's not enough for protection and it's causing a voltage spike when the playing command is past?