[Openal] Sound crackling
Daniel PEACOCK
dpeacock at creativelabs.com
Wed Apr 8 04:36:58 PDT 2009
AL devices are all implemented differently ... but most of them will not
commit 100 volume levels per second on a Source especially the software
based ones. Most software mixers operate by mixing a block of audio at
regular intervals and use the currently set parameters at that time to
control the mixing. These blocks can be different durations but could be
of the order of 25 milliseconds in duration (meaning 40 updates per
second). Some AL devices will do parameter ramping to reduce artifacts due
to sudden changes in level from one mixing interval to the next, but some
may not (it is a performance vs quality trade-off).
The popping & clicking is possibly occurring due to large changes in volume
level. This is in part being caused by the use of a linear volume fade.
You may get better results if you use a different type of fade, eg...
// called 100 pr sec
float flInc = (PI / (2.f * 100.f)); // 100 steps from 0 to PI/2
float flFade = 0.0f;
// fade in from silence to full volume in 100 steps
void Update()
{
flFade += flInc;
alSourcef(id, AL_GAIN, 1.0f - cos(flFade));
}
Dan
Creative Labs (UK) Ltd.
Notice
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this
message by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying or distribution of the message, or
any action taken by you in reliance on it, is prohibited and may be
unlawful. If you have received this message in error, please delete it
and contact the sender immediately. Thank you.
Creative Labs UK Ltd company number 2658256 registered in England and Wales
at Belmont Road, Belmont Place, Maidenhead, Berkshire, SL6 6TB
Søren
Christiansen
<sc at spanning.dk> To
Sent by: openal at opensource.creative.com
openal-bounces at op cc
ensource.creative
.com Subject
[Openal] Sound crackling
04/08/2009 11:19
AM
Hi all,
I'm encountering crackles and pops if I change the source.volume
frequently like this (pseudo code):
// called 100 pr sec
void Update()
{
read out [volume]
alSourcef(id, AL_GAIN, [volume] + 0.01);
}
Is this expected and/or can I do something to prevent it?
Im on a intel macbook pro.
cheers,
Søren C.
_______________________________________________
Openal mailing list
Openal at opensource.creative.com
http://opensource.creative.com/mailman/listinfo/openal
ForwardSourceID:NT0006B042
More information about the Openal
mailing list