Thanks.
First of all, we strongly recommend that you upgrade Sonic Pi. Version 3.1 is now very old, and is also an incomplete version that only partially works - it was built outside of our control by the RPi foundation. See https://sonic-pi.net/ or Releases · sonic-pi-net/sonic-pi · GitHub for the latest version.
Secondly, It’s possible you’re not using the latest release of Raspberry Pi OS, (since your output above says you’re using ‘Raspbian’), but if you do end up upgrading Buster, there are extra considerations to be aware of when using the latest version of Raspberry Pi OS, as they have switched to using the software called PulseAudio as their default sound server. There are discussions around this here: