Ok, so I'm trying to write an application that generates sampled sound (plain old PCM encoding) and plays it in real time. I have no problem getting *something* to come out of the sound system. But no matter what I do, it always sounds like chirping crickets.

Specifically, I'd like to start by having a nice clean 440 Hz (an 'A' note) tone output. I'm using a SourceDataLine and I'm sure the AudioInfo is set up right, because I'm double checking everythign and printing the results out.

The odd thing is that no matter what I set the sample rate to, it is not a pure tone, and sounds the same (and is certainly not 440 Hz which I would recognize by ear immediately). I started thinking that it may have seomthign to do with the underlyign behavior of the SourceDataLine. The API states that if you try to write more than it's buffer size that it starts a new thread to handle it. I'm thinking the strategy employed in that thread is not well thought out and results in regular starting and stopping at a high enough rate that it sounds the same no matter the sample rate.

I don't mind putting together a sophisticated buffering system to ensure the pipe is always nominally filled, but I'd hate to expend the time doing that if it's a dead end. Has anyone else experienced anything like this?