Sound problem on Raspbian 12 and PiArm Robothat with RaspberryPI4

Dear People,
I have bought 5 kits from PiArm and installed Raspbian with RaspberryPi4. The robot works all is great but I don’t get sound on the hat:

This is the error:

Warning: Xing stream size off by more than 1%, fuzzy seeking may be even more fuzzy than by design!
Traceback (most recent call last):
  File "/home/pi/piarm/examples/sound_effect.py", line 36, in <module>
    sound()
  File "/home/pi/piarm/examples/sound_effect.py", line 10, in sound
    m.sound_play(song)
  File "/usr/local/lib/python3.11/dist-packages/robot_hat-1.1.0-py3.11.egg/robot_hat/music.py", line 98, in sound_play
    self.pygame.mixer.music.load(file_name)
pygame.error: Unknown WAVE format

I know I could install your OS EZ Os, but I would really like to make it to work now with the current system. Any ideas?
Thank you
greetings
Attila

You can use the EzBlock app to control the robotic arm.
You need to install the EzBlock OS image system:
https://ezblock.cc/download/v31.html
Install the EzBlock Studio app on your mobile phone or tablet.
For details on how to connect and operate, please refer to the tutorial:
https://docs.sunfounder.com/projects/ezblock3/en/latest/quick_guide_3.2/connect_product_ezblock.html
When using Python to control the system, what operating system have you installed? Please let us know so that we can help reproduce and troubleshoot the issue.

Thank you for your answer. I have used Raspbian12 as the title says and installed it on 5 Pis so if you could have liked in to this issue would help me a lot thank you

The issue has been fixed, please update the robot_hat library and the piarm program:
cd ~/robot_hat
git pull
sudo python3 setup.py install
Then go run the example script and check the working status.
If running the sound effect example, the robot hat’s speaker is not making any sound, it is recommended that you re-run the i2samp.sh command and reboot the Raspberry Pi.
cd ~/piarm
sudo bash i2samp.sh

Thank you for the help unfortunately it is still not working getting this error when running i2samp.sh

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
Playback open error: -524,Unknown error 524

Did you test this on a RaspberryPI 4? There are 2 HDMI outputs.
I suppose the wrong card is being selected. With aplay -l output

pi@bakudeku:~/piarm $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 3: MAX98357A [MAX98357A], device 0: fe203000.i2s-HiFi HiFi-0 [fe203000.i2s-HiFi HiFi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

If I understand right you are using the adafruit MAX98357. I have tried their stepps on their webpage using the new python installer from this page: Raspberry Pi Setup | Adafruit MAX98357 I2S Class-D Mono Amp | Adafruit Learning System. After execution I heard some clicking sound on the speaker but still no sound play.

I was also follwing the instructions for Alsa how to select the default card but with no success: ALSA - Debian Wiki

If you have any ideas would be great. I would like to order more robots for the kids but would like to stay on the OS I have now. Thank you for your help

If you have an external screen connected to your Raspberry Pi 4 and also have a speaker, when you run the audio example, the sound may be being output through the HDMI channel.
So if you know the IP address, we suggest you don’t need to connect the screen, just SSH directly to the IP, and run the audio example in the Raspberry Pi command line to see if the speaker on the robot hat can output sound normally. If not, run the following again:
cd ~/piarm
sudo bash i2samp.sh
After the successful installation, restart the Raspberry Pi and try running the audio example again to see if the speaker on the robot hat is working properly.

I dont have a monitor attached just the robot with the batteries and ssh

Are the other examples working properly, and is it only the speaker that is not functioning?
Could you record a video demonstrating the sound example for us? This will help us analyze and resolve the issue.
If the speaker is damaged, we will send you a new robot hat.