Sound with PiCrawler

With the PiCrawler kit using Python on a Raspberry Pi 4, I do not succeed to have any sound (whereas the speaker is roaming during boot).
I have done a lot of “sudo bash i2samp.sh” followed by reboot butit was unsuccessful !
However the hat is working because all is normal with ezblock and the musics and texts are played normally.
How to have sound using Python ?
Thanks in advance for your answer.
JFW

1、What Raspberry Pi system are you using? If it is controlled by Python, install Raspberry Pi OS, if it is controlled by ezblock studio app, install ezblock OS.
2、When the Raspberry Pi starts up, the speaker of robot-hat makes a zipping sound, then i2samp.sh sound driver has been installed successfully, otherwise please run i2samp.sh again.
3, when running the sample code, you need to use sudo to run before there is sound
4, run in vnc, you need to close the pulseaudio before there will be sound: sudo killall pulseaudio

1 Like

Thank you very much for your answer. I use Pi OS legacy with Python. With or without VNC, no sound can be played in the program just after boot.
But the shell command “sudo killall pulseaudio” reset something and after the sound is correctly played in the program !
Do you know how it would be possible to avoid this shell command each time the system is booted ? Maybe a sound option must be disabled in the raspberry config ?
Thanks in advance for your answer.
Rgds
JFW

I don’t understand what you mean, if you use vnc to connect to spiderpad remotely, you need to execute sudo killall pulseaudio.
If you are using the putty tool to connect to Spiderpad, just add sudo before executing the python script.

In fact, I would like to avoid to type the “sudo killall pulseaudio” each time I am rebooting (I always use VNC) and I was looking for a command ora file executed automatically to avoid that at startup.

You can automate this command in the python file you need to run by adding the following to the beginning of the python file
import subprocess
subprocess.run(‘sudo killall pulseaudio’, shell=True)

It is working and fullfill my request.
Thank you very much
Rgds
JFW

1 Like