Shop OBEX P1 Docs P2 Docs Learn Events
Audio clicking noise — Parallax Forums

Audio clicking noise

HED GROUPHED GROUP Posts: 15
edited 2010-02-28 10:30 in Propeller 1
HI TO THE PROPELLER EXPERS. CAN SOMEONE TELL ME HOW CAN I ELIMINATE
THE CLIKING NOISE PRODUCE AT THE BEGINING AND SOMETIMES AT THE END
OF THE SPEAKERS IN USE. EX: (FREQa OR ANY SOUND OBJECT)
I TRY ALSO THE FOLLOWING CIRCUIT AND DOES'NT FIX THE PROBLEM.
THANKS IN ADVANCE FOR YOUR HELP.
EDGARDO LOPEZ

······················ R=100
Prop Pin
/\/\/\/\
· Audio Out SPEAKER +
································· |
······························
· C=0.1uF
······························
································· |······ GND - SPEAKER -
······························
································ ----
································· --

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-02-26 00:53
    The circuit you have shown is just a simple 1st order filter just like the one that the DAC using counter duty-cycle mode needs to produce analog values. You can't expect a simple FREQ object to not produce a click since all it does is pulse on and off, just like a series of clicks. Of course if you could control the volume you could pan in and out.

    The DAC mode which produces analog voltages through an RC filter however is usually a matter of software, if your samples result in voltages centered around half supply volts and then at the end you turn it off or write a zero value then the output will see a sudden change to 0V which results in a click. A similar thing happens when you start playing samples so just make sure you don't output any sudden changes because the output will do what you ask it to do.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2010-02-26 07:34
    As Peter says, the average voltage at the output is from the duty cycle of the pulses, at 50/50 the output would be 50% of VDD. I t is the sudden leap from 0 Volts at the start of the software to the 50% level that is causing the "Click", with better low frequency responce the "Click" would be a "Thump". The same will happen, the other way around, at switch off.

    A way around this would be for the software to initially "slowly" ramp up the duty cycle from 0% to 50% before any sound output is required. Any "slow" that is sub audible, or well below the frequency responce or your equipment, would do, try 100mS as that shouldn't be too noticible as a delay. This is only required at the initial start of the software, once the 50% is established, and maintained, the "Clicks" shouldn't happen, unless they are intended to be there. The reverse will have to be done at the end of playback.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point

    Post Edited (Toby Seckshund) : 2/26/2010 8:55:47 AM GMT
  • VIRANDVIRAND Posts: 656
    edited 2010-02-28 04:58
    I had an idea that worked well for me on another chip, but let me suggest a possibly more convenient idea:

    Set the sound output to input using DIRA during silence periods and I think it will float in high impedance.

    My other solution involved using two pins, which may have been complementary, although I am not sure
    what state I put them in for clickless transition to silence, whether remaining complementary and added together
    in the filters, or else grounding both pins during silence. I assume the former, since the click is caused by
    DC BIAS change, because the average output during sound is 3.3V / 2 but during silence must be either 0 or 3.3V,
    so transitions on one pin from sound to silence or vice versa creates an impulse which sounds like a nasty
    click.

    A new solution available with the propeller is to leave an audio cog running, and output a DAC value of
    zero equivalent (which would be actually 3.3V / 2) during silent periods. Even an extreme transition between
    different sounds will tend to produce impulses otherwise, for example if you suddenly invert a sine wave
    at its peak then a very nasty impulse is likely to be heard..

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I should be typing in Spin now.
    Coming soon. My open Propeller Project Pages and favorite links index.
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2010-02-28 10:30
    The silence bit could be at any level, but as you say if the average is left at 50% (for max output before clipping) then the glitch of suddenly getting to, or from, that starting level will not happen. A slow (relative) transition up to and eventually down from that point will prevent it being heard.

    EDIT

    Thinking about it, all I have said is me assuming that the DAC output was running at a much higher rate, with PWM to form the audio. If the Prop's pin is switching up and down at the audio rate then the grounded end of the speaker could be placed at Vdd/2. At least this would balance out to the aveage, and as already said, making the pin an input would shut off any current ( I wonder if the 50% would then make the input pin dither on and off, perhaps slightly to one side of 50% would be better )

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point

    Post Edited (Toby Seckshund) : 2/28/2010 10:46:57 AM GMT
Sign In or Register to comment.