
OpenAL generate tones at specific frequencies, and white noises
Posted Sunday, 4 December, 2011 - 20:56 by Norris inHi !
Is it possible, using OpenAL, to generate tones (or wave sines ... sorry,I don't know very well how to tell in english) with specific frequencies ?
Also, is it possible to send different sounds in each "sides" (stereo) ?
I really want to generate them, not loading .wav ou mp3 files.
Thanks.


Comments
Re: OpenAL generate tones at specific frequencies, and ...
You can generate a sine wave like this:
For stereo, the audio data has to be interleaved, i.e. first a left channel sample then a right channel sample. And you have to use one of 'Stereo*' formats in 'BufferData'. E.g. generating a different tone for each channel would look like this:
Re: OpenAL generate tones at specific frequencies, and ...
Hi Smiley80 and many thanks for your code !
I waited not for a complete code, but that's very cool from you ! No I have all I need to search and understand.
I know nothing about OpenAL and I never read the specifications (I will do for sure, I'm not here to copy/paste without understanding). But I have read some DirectSound equivalents, and the guy use two buffers; one for the left and one for the right channel. I think it's to prevent some shift in the buffer. Do you think it's for that reason ?
It seems that it's a good idea, but I really don't know why.
Many thanks. I will try this :)
heeeuuuu ... sorry for my bad english !