Results 1 to 1 of 1
- 04-20-2010, 05:37 AM #1Senior Member
- Join Date
- Jan 2009
- Rep Power
Details using javax.sound.sampled
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?
- By vinothkumarrvk in forum Web FrameworksReplies: 2Last Post: 03-05-2010, 03:58 PM
- By rob in forum Advanced JavaReplies: 8Last Post: 03-03-2009, 03:33 PM
- By carderne in forum New To JavaReplies: 5Last Post: 02-28-2009, 11:12 PM
- By ahtiven in forum New To JavaReplies: 3Last Post: 01-13-2009, 03:54 PM
- By email@example.com in forum Advanced JavaReplies: 0Last Post: 07-25-2008, 10:51 AM