Shop OBEX P1 Docs P2 Docs Learn Events
Noisy audio — Parallax Forums

Noisy audio

John JenkinsJohn Jenkins Posts: 12
edited 2006-06-30 21:10 in BASIC Stamp
Whenever I use any of the sound related functions (frequout, dtmfout, etc), there is an audible click right before the tone is produced. It's not too noticeble when only one or two tones are played, but run a random bunch of them out rapidly and the clicking is very distracting. I am using the std filter on the output of the stamp (shown in the Freqout section of help) consisting of a couple of 1K resistors, a .1 and a .01 uf cap, driving an audio amp.

I'm using a BS2sx.

Does anyone have any suggestion as to how to eliminate this extraneous noise?

Thanks!

John Jenkins
www.sparkmuseum.com

Comments

  • steve_bsteve_b Posts: 1,563
    edited 2006-06-29 12:36
    an audible click....??

    sounds like the port might be set high at some point before you send out your audio. Essentially it could be putting a DC voltage on that pin and causing your speaker to 'pop'. You might have to put a LOW <pin> in before your audio out command. Just a thought.

    If you post your code, someone might pick up on it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-06-29 20:12
    John -

    Additionally, what kind of output sound device are you using: audio speaker, piezo speaker, or earphone?

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • John JenkinsJohn Jenkins Posts: 12
    edited 2006-06-30 06:18
    Here is the code. The output device is a 2" 8 ohm speaker, driven by an LM386 amplifier. As I mentioned in the previous post, the amp is capacitively coupled to the stamp using the RC filter network recommended in the HELP file.

    ' {$STAMP BS2sx}

    ·Randfreq1 VAR Word
    ·Freq1· VAR randfreq1.LOWBYTE
    ·freq2 VAR randfreq1.NIB0

    ·OUTPUT 12

    ·do
    · GOSUB play
    ·loop

    play:
    RANDOM Randfreq1
    DEBUG DEC freq1,CR
    FREQOUT 12,100,freq1
    RETURN
  • steve_bsteve_b Posts: 1,563
    edited 2006-06-30 13:48
    Is the speaker capacitively coupled to the amplifier?

    The cap should block an dc that might get to your speaker.

    If you has a scope, I'd suggest scoping the output to see if you have a DC bias at the speaker. Essentially this means that when the amp conducts, it has some dc at its output and yet your AC audio will still drive the speaker...just at the DC level (does that make sense?).

    If you had a 2Volt (peak to peak) sine wave....on a scope, you'd expect to see one half of the sine wave above ground and the other have below ground (1 Volt above and 1 Volt below)....if you have a DC bias, you'll still have the 2Volt (peak to peak) but the "ground level" will actually be the DC level...so, if you have a 3volt DC bias, you're sine wave will have an upper peak of 4 Volts (DC bias plus half your sine wave) and a lower peak of 2 Volts (DC bias minus the other half of your sine wave).....so, your speaker will be drive from this, but that sudden hit of DC voltage actually causes your speaker to 'pop'.

    Hope that helps a bit....let us know!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • John JenkinsJohn Jenkins Posts: 12
    edited 2006-06-30 18:43
    Yes, the speaker is capacitively coupled to the amp. I did put a scope on it, and there is no DC going to the speaker. The pop or click seems to be coming right at the beginning of the tone envelope. Also, the amplitude of the pop isn't affected by the gain of the amplifier. When the gain is up high, I can't here it at all, but with the gain set low, the pops are louder than the tones.

    Thanks for your help!



    JJ
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-06-30 19:56
    I've never tried the capacitive-coupled example in PBASIC Help.· I use an audio-matching transformer (1,000ohm : 8ohm) and have·decent volume and no pops.
  • steve_bsteve_b Posts: 1,563
    edited 2006-06-30 21:10
    what kind of op-amp are you using? Maybe not relative....how about an image?

    If you have a scope, then can you capture the "pop" and post that?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
Sign In or Register to comment.