Yes, I've written a driver to play basic musical notes through headphones/speakers before.
Writing a driver from scratch like I did is not possible through TI-BASIC. You need to use Z80 Assembly.
You can download my driver from the Cemetech forums. Search for "NoteMan".
Mine is pretty useful because it's easily compatible with TI-BASIC programs.
If you want a little note to play when something happens (such as, a ball hitting a paddle), you just have to run:
That will play the note "C1" for a duration of "1".
The concept is a bit difficult. I'll explain it if you're curious to how sound drivers work.
Unless you have Z80 Assembly experience though, this will be hard to implement.
Essentially what you do is send electrical pulses to the headphone/speaker. Do this by sending electricity to the magnet, pausing for the length of the wavelength, turning the electricity off, then pausing for the length of the wavelength again. Doing this will cause the magnet inside to vibrate. The faster you single electrical pulses the higher pitch the sound. Because longer notes require more time, longer notes naturally last longer than shorter ones. This can be corrected by rearranging a simple equation:
length = loop * 2 * wavelength
I put in "* 2" because you pause for the length of the wavelength twice.
"Loop" is how many times you loop the entire note played.
"Length" is how long we want it to be.
Let's throw in some arbitrary amounts and say,
25 = loop * 2 * 1055
"1055" is a lower note. "25" is just an arbitrary number. We want this number to be constant throughout the entire program.
If we rearrange this, we will get:
loop = (25/2)/1055
That will get us a really small number, but we can multiply that by 1000 to get an integer, so basically from this equation you should get about "12".
If you throw any different frequency in there, you will get a different number of loops. Loop the note that many times and it will all play out the same length. That's how you get low notes to play at the same length as higher notes.