A lot of the YouTube videos that claim to be PC Speaker music sound far too good quality to me, like 16-bit Amiga music instead.
This Pirates of the Caribbean version sounds pretty accurate to what PC beeper could do (but it sounds better in today's headphones): https://www.youtube.com/watch?v=GdJyt5wdWCM
I'm convinced there was a MOD file player that could output to the PC beeper and would run on an IBM XT / compatible in the very early 1990s, and I seem to remember it was called 'brain' but Google can't find anything about it. Apparently Scream Tracker 2, FastTracker II, could play to the PC speaker, not sure if they ran on an XT, I can't really remember that long ago but think brain was UI-less just a command line player.
The hardware controlling the PC speaker was only designed for playing a single tone at a time. But there was software that could do something like PWM and get much better quality. Linux still has a snd_pcsp module for this.
Back when "the family computer" was a concept, my brother and I installed Sim City 2000 on our 486 which didn't have a sound card, so all the music played on the PC Speaker. My cousin had a Pentium machine with a Sound Blaster and he got to enjoy proper sounds, not to mention better frame rates, but I still have fond memories of PC Speaker music.
The PC speaker is fundamentally a cheap piezo element or a real-er magnetic speaker attached to a GPIO attached to a timer. The most simple thing you could do with it was program the timer to output a square wave. But it was also possible to control it directly as an on/off output, and do various waveforms (including PWM), but it would occupy the whole CPU.