[Openal] Sound crackling

Daniel PEACOCK dpeacock at creativelabs.com
Wed Apr 8 06:52:21 PDT 2009





If the CPU is under heavy load, then it is possible for a mixer thread to
be starved of processing time, which would cause the audio to break up.
This would be all OpenAL audio - not just an individual Source.   Normally
an audio mixing thread would be given a time-critical priority to prevent
this sort of thing from happening (as much as is possible).

Does the problem always occur when you loop play this sample - or just
sometimes?  And does the glitch occur every time the sample loops (assuming
you leave it playing for long enough)?  Perhaps this is a bug in the AL
implementation.

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 
                                       Daniel PEACOCK                      
             04/08/2009 02:32          <dpeacock at creativelabs.com>         
             PM                                                         cc 
                                       openal at opensource.creative.com      
                                                                   Subject 
                                       Re: [Openal] Sound crackling        
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




before playing ... I've recorded the output with Audio Hijack and its
obvious that some samples are missing around the loop point. Its part of a
game engine and CPU can be stressed (low framerate). Can samples/mixing
blocks be skipped, if the mixing exceed some  time limit?

On Apr 8, 2009, at 3:07 PM, Daniel PEACOCK wrote:



      Hi,

      I'm not sure if the source code to the Apple implementation is
      available - maybe someone else on the list knows.

      re : looping. Every implementation should play all of the samples
      when looping is enabled otherwise this will cause clicks & pops. Are
      you enabling looping before playing a Source or during playback?

      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

      <graycol.gif>Søren Christiansen <sc at spanning.dk>

                                                                           
                         Søren                                             
                         Christiansen                                      
                         <                                                 
                         sc at spanning. <ecblank.gif>                        
                         dk>                                            To 
                                                          <ecblank.gif>    
                                                          Daniel PEACOCK < 
                         04/08/2009                       dpeacock at creativ 
                         01:33 PM                         elabs.com>       
                                      <ecblank.gif>                        
                                                                        cc 
                                                          <ecblank.gif>    
                                                          openal at opensourc 
                                                          e.creative.com   
                                      <ecblank.gif>                        
                                                                   Subject 
                                                          <ecblank.gif>    
                                                          Re: [Openal]     
                                                          Sound crackling  
                                                                           
                                                                           
                                      <ecblank.gif>                        
                                             <ecblank.gif>                 
                                                                           
                                                                           



      Thank you so much! It makes sense and also supports my testing
      results ... decreasing the volume steps pr. frame/loop decreases the
      crackling. Is it possible to get the implementation details for the
      different AL devices somewhere (preferably apples openal impl)? I
      have a different problem, maybe related to the same as above:
      Sometimes when I loop audio, some of the the samples are simply cut
      away!. I can imagine that it has something to do with buffer
      boundaries (which differ from hw to hw)? or?

      thx again,



      On Apr 8, 2009, at 1:36 PM, Daniel PEACOCK wrote:
                  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

                  <graycol.gif>Søren Christiansen <sc at spanning.dk>
                                                                           
                                                 Søre                      
                                                 n                         
                                                 Chri                      
                                                 stia <ecblank.gif>        
                                                 nsen                   To 
                                                 <                   <ecbl 
                                                 sc at s                ank.g 
                                                 pann                if>   
                                                 ing.                opena 
                                                 dk>                 l at ope 
                                                 Sent                nsour 
                                                 by:                 ce.cr 
                                                 open                eativ 
                                                 al-b                e.com 
                                                 ounc <ecblank.gif>        
                                                 es at o                   cc 
                                                 pens                <ecbl 
                                                 ourc                ank.g 
                                                 e.cr                if>   
                                                 eati <ecblank.gif>        
                                                 ve.c              Subject 
                                                 om                  <ecbl 
                                                                     ank.g 
                                                                     if>   
                                                 04/0                [Open 
                                                 8/20                al]   
                                                 09                  Sound 
                                                 11:1                crack 
                                                 9 AM                ling  
                                                                           
                                                                           
                                                      <ecblank.gif>        
                                                         <ecblank.gif>     
                                                                           
                                                                           



                  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

      ForwardSourceID:NT0006B052

ForwardSourceID:NT0006B05E




More information about the Openal mailing list