No sound playing back wav file from PiCar-X Example 16. Voice Controlled Car with Vosk

Again, the aplay command does not work as I have explained several times. It looks like the example has been changed to eliminate that part, but it did previously (until recently) have you create a wave file and play it back using aplay.

This still begs the question of why playing back a wave file using the aplay command (or VLC for that matter) does not work with the speaker on the robot hat. What special setup is needed to get those to work with the speaker on the robot hat?

Will Windham

Thank you very much for your continued patience and for running all these tests with us, and for sharing such detailed information.

First, a note about aplay: we did remove the tutorial on playing a wav file with aplay from our documentation. The reason is that the default audio output may be HDMI, so many people following it couldn’t get any sound either. To avoid unnecessary confusion, we removed that part.

As for your situation: you have already selected snd_rpi_hifiberry_dac as the output device, and you have confirmed that the speaker is not muted and the volume is turned up, but running “aplay test.wav” still produces no sound.

At this point, we don’t have a better solution on our side either. You could try reinstalling the system to see if that restores normal audio.

If there is still no sound after reinstalling the system, please contact us again and we will continue to help you troubleshoot. Thank you again for your patience and cooperation.

Now I am getting no audio output at all. Examples 13, 14, and 15, which previously worked just fine and produced audio, no longer work. I went back to the previous replacement Robot Hat that you had sent me and the audio didn’t work on it either.

I decided to try the original Robot Hat that came with the kit. I was sent a replacement for it because it had a bad right motor driver which caused the right wheel to turn continuously. In any case, the sound in examples 13, 14, and 15 worked just fine.

That very clearly says that the two replacement Robot Hats that I have been sent have a defect with the audio.

Let me know if you need for me to do anything else, but clearly I need another Robot Hat.

Will Windham

Could you try swapping the speaker from the Robot HAT in your previous kit onto this Robot HAT V4 that you said has a broken speaker, and see if it can play sound normally?

Yes, that worked. Playing sound using the speaker on the second Robot Hat I received did not work again, but when I connected the speaker from the Robot Hat which came with the kit originally to that second Robot Hat, it did produce the sound. So the problem is apparently just the speakers themselves.

I just did this with the speaker wires; I didn’t actually swap the speakers themselves. How is the speaker itself attached to the board? It didn’t come off easily and I didn’t want to damage it by applying too much force.

And just a reminder, I can’t use the original Robot Hat (which has the speaker that works) because it has a bad right motor driver.

Will Windham

Thank you so much for your patience and for testing this and letting us know the result — this information is really key, and it helped us pin down the issue completely.

The good news is: since the speaker from your old Robot HAT works perfectly when moved to the new Robot HAT, that tells us the speaker itself, the new Robot HAT, and the whole audio path are all fine — there is no hardware fault at all.

The only thing you need to take care of is how the speaker is attached:

The speaker is fixed to the Robot HAT with 3M adhesive tape. You can safely peel it off and reattach it using new double-sided tape — there’s no need to worry about damaging the speaker or the Robot HAT.

Here’s what to do:

First, peel the speaker off Robot HAT #2 (the new board), and swap in the speaker from Robot HAT #1 (the old board);
Clean off any leftover old adhesive from the back of the speaker and from the Robot HAT;
Stick a piece of new double-sided tape (3M tape or ordinary double-sided tape both work) onto the back of the speaker;
Press the speaker back onto its original position on the Robot HAT and hold it for a few seconds so it sticks firmly.
Once it’s attached, try playing test.wav again — you should hear the sound normally.

If there’s still no sound after reattaching it, please let us know and we’ll keep helping you troubleshoot.

The speaker swap went fine. Music plays again when running examples 13, 14, and 15. I was also pleasantly surprised to hear that playing wave files (like test.wav) works now. It made no sense, but previously playing wave files with aplay never worked, even when running the example programs did produce sound.

In any case, I can proceed again now. Thanks for the help.

Will Windham

Great to hear that you’ve got it working! :tada:

Thank you for your patience and thorough troubleshooting along the way. Enjoy your PiCar-X, and feel free to reach out anytime if you need anything else.

All the best!

I was just wondering if there is someplace that I can purchase those speakers, in case I have another speaker die. I looked online, but couldn’t find anything that looked like that speaker. Could you at least tell me the specs. for that speaker (watts and impedance)?

Will Windham

please contact service@sunfounder.com to buy the replacement.