
Some parts of this message have been removed.
Learn more about Nabble's
security policy.
Hi,
The click is probably coming from the fact that your sine wave is not
coming back to zero (or 128, in this case) at the end of your buffer.
In this case, when you switch buffers (or loop the single buffer), you
start the sine wave back at zero. This jump in amplitude produces the
click you're hearing.
I agree this is the cause of clicking.
To fix this, you have to ensure the buffer length is proportional to
the frequency of the sine wave, so the amplitude goes back to zero at
the end of each buffer.This means that every time I change the frequency of the waveform I'll have to change buffersize, which is not less than a pain in the neck as complex sounds will be just different frequency waves overlaid on each other.
I personally think that it can be solved by using two buffers, as I have done. When one buffer ends the other start playing from the point where previous ended. For now, I have no idea what so ever how I will do this. Any suggestions!!!
By the way, instead of hand-coding the sine wave yourself, you can make
use of ALUT, which has a method to create waveforms (sine, square,
sawtooth, white noise, and impulse).Yes it is a good way of generating a waveform but I am not sure it will deal with low or high pass filters. Also I have tried this... The buffer doesn't automatically stops when the content in it is finished it stops after the duartion which is specified in the function. Thats what I think. Above all this also produces the same clicking problem. If you are interested I can send you the code.
Thank you in advance for the help.
Cheers.
A
Date: Mon, 9 Mar 2009 20:13:16 -0400
From:
jdaly@...To:
hkgi@...CC:
openal-devel@...Subject: Re: [Openal-devel] Need help with clicking sound.
Alfred Hawk wrote:
Dear All,
I have just started to use openal for sound synthesis and I guess that
is what it is made for.
Actually, OpenAL is not intended for sound synthesis applications.
It's primarily intended to create 3D audio soundscapes for games and
simulations. You can probably do rudimentary sound synthesis with it,
but it won't make it easy for you.
I have made a simple program using two buffers, in which a
sine wave is generated, in other words a single frequency sound. Now if
I change the frequency I hear a clicking sound that is due to the fact
when the second buffer is played, it starts playing the waveform from
the beginning. I have tried using a single buffer and AL_LOOP function
but of no vain. Please see the code below. Is there any way or function
in openal that can remove this clicking sound. I have tried changing
Sampling frequency but of no vain.
I am not sure whether it makes any sense or I am going in right
direction but I need to remove this clicking sound in order to proceed
with sound synthesis.
The click is probably coming from the fact that your sine wave is not
coming back to zero (or 128, in this case) at the end of your buffer.
In this case, when you switch buffers (or loop the single buffer), you
start the sine wave back at zero. This jump in amplitude produces the
click you're hearing.
To fix this, you have to ensure the buffer length is proportional to
the frequency of the sine wave, so the amplitude goes back to zero at
the end of each buffer.
By the way, instead of hand-coding the sine wave yourself, you can make
use of ALUT, which has a method to create waveforms (sine, square,
sawtooth, white noise, and impulse).
The call looks something like this:
buffer = alutCreateBufferWaveform(ALUT_WAVEFORM_SINE, frequency,
phase, duration);
Best of all, the duration will be automatically rounded up to avoid
clicks. See the ALUT spec at
http://tinyurl.com/azzl69 for more
details.
--"J"
Share your photos with Windows Live Photos – Free.
Try it Now!
_______________________________________________
Openal-devel mailing list
Openal-devel@...
http://opensource.creative.com/mailman/listinfo/openal-devel