Disclaimer : Please do not attack devices you don't own or don't have legal right to attack. Educational purpose discussion only here.
The question sent me on a bit of a rabbit hole trying to find the solution and learnt a lot along the way. I never bothered with bluetooth part of wireless penetration testing but I am glad I did it.
Bluetooth its seems is still very unsecure and prone to many types of attacks including denial of service attack which interrupts the speaker.
Easiest was a Raspberry Pi (had a spare Pi4 which I used). Booted to a Kali instance and could scan and ping it.
A script can launch a DOS attack on a bluetooth speaker. Bluetooth uses Frequency hopping spread spectrum (FHSS) to rapidly switch frequencies to prevent conflict in busy 2.4Ghz band. Which makes it a challenge to sniff and attack but it is possible.
Another attack would be Deauth attack which would kick all paired devices out. So if you run a Deauth then a DOS attack the speaker can become unavailable.
Lots of papers on these types of attacks.
I managed to scan and ping attack my own speaker from a raspberry pi. A cheap Chinese speaker to test it out.
Another concept I learnt about was BLE (Bluetooth Low Energy). So many devices are using this and transmitting all the time. You can scan and sniff packets in BLE to id equipment and check details of the same. Example apple air tags, phones, speakers, IOT devices.
Another type of bluetooth attack would be to attack older Android phones which are unpatched to act as HID and launch a HID attack. It was patched but older Android devices are still vulnerable.
So to answer the question, yes its possible to attack Bluetooth speakers with a raspberry pi.