Mike,

Yup, u're right. Someone else also pointed out to me that the old games used to have a variety of beep sounds so it should be possible to do it on the PC(linux). The Beep program also shows it can work.

Can you post the code you're using to play the beep? Perhaps the reason you're hearing it latter is coz there is something slow in the code. Off the top of my head, I would look at the following:
1. If you're passing all the tones you want to play in one go then the program plays them after a long delay, then the problem could be that the sound system is being initialized and that's what causes the long delay. If that's the case, u can initalize the sound system much earlier in the code and re-use it with each call to the function.
2. If you're passing all the tones you want to play in one go BUT the program delays playing EACH tone then you may need to post you're code so that we can have a better look.
3. If you're passing each tone at a go, then you may need to look for a function that allows you to pass them all at a go. If you cant find one, then post your code as well.

You've also mentioned wav. I think playing wav files is different from playing tones. A wav file stores different kind of data somtimes 0s and 1s to indicate 'peaks' and 'drops' in sound. Wav will also contain the frequency (sample rate) in which to play the WHOLE sound, so that when the machine plays the 0s and 1s in that frequency then the right sound is produced. However for tones, you define the frequency of EACH tone and the duration to play it. Perhaps you can store that in a custom file and read it as u play the tones. (AFAIK my explanation is right but feel free to google it)

Regarding the IO, what I suggested for you was for program X, not all programs. Just to clarify, does pwrap have a callback function that receives IO events for your program? I've never used pwrap but I'm thinking the principles are the same with other UI libraries.
 
 


From: Mike Muraguri <mickie.mic@gmail.com>
To: wesley kirinya <kiriinya2000@yahoo.com>; Skunkworks Mailing List <skunkworks@lists.my.co.ke>
Sent: Wednesday, September 14, 2011 5:29 PM
Subject: Re: [Skunkworks] C/C++ tone sequence / screensaver in Linux

Wesley,

This helps alot. But think of the situation where yo want to play the tone in an ordinary Linux box using C/C++ as the programming language, from there we can start moving to smaller devices. There's a project called beep as shown here which is said to solve the problem. I however haven't had a lot of success with it. Funny enough, when I try to play sounds even using some methods as described there, I hear sounds much later and cannot see how to actually play a wav equivalent continuous sound using this.

The IO idea is great, the only hitch is - how do you separate IO mean'n for program X from other IO?

Thanks alot.

--
Regards,
Mike Muraguri
Skype: mickie.mic
M: + 254 722 799445