Is there any way, in any language (C preferred) to interface the PC internal speaker directly under Windows/Linux? (no DOS) I don't want to drive it at a specficic frequency for a given duration (no beep(frq, msecs)), but I'd rather send signals directly.
I suppose it's one bit resolution, so I plan using PWM driving to play wave sounds.
On Linux, you will probably want to make a kernel driver to drive the speaker, and provide eg. a /dev entry for accessing it.
Note that there is already a driver that supports PCM in the Linux kernel, that interfaces as an ALSA driver. Check it out: http://lxr.linux.no/linux+v2.6.39/sound/drivers/pcsp/
The actual hardware interfacing appears to be done in pscp_input.c: pcspkr_do_sound(...)