Shop OBEX P1 Docs P2 Docs Learn Events
Removing background noise from ADC mic input. — Parallax Forums

Removing background noise from ADC mic input.

KyeKye Posts: 2,200
edited 2010-02-07 10:55 in Propeller 1
I just finished working on·some really nice audio input and output drivers for the prop chip that both simplify playing and recording audio.

Attached are both the drivers in pretty muh their final form. I have the·audio output driver (DAC Engine) working very nicely and when playing back high quality·wave files on the prop no one has been able to tell the difference between it and·a regular computer.

I also have the audio input driver attached (ADC Engine) which uses the sigma delta ADC on the prop chip's pin inputs to sample audio. The quality at high sample rates for it is also very good. At·16000 - 88200 Hz your voice comes through clearly without any distortion.

---

I'm posting this here because I would like feedback on the·quality of the audio transfer and I would like to see if anyone has any ideas on how to make the audio input driver cut out all the low level noise static produced when a microphone is hooked up.

Right now my audio input driver does no averaging or any other·special tricks. I was quite pleased to find that the algorithm used by it to scale·samples from the sigma delta ADC·into bit into 16 bit or 8 bit chunks gets rid of alot of noise from the sigma delta ADC.

I'm looking·for something·SIMPLE I can do to remove background noise etc.

Thanks,

---

You will need to open the ADC and DAC engine and make sure you have the hardware attached to the pins specified in the files attached to the propeller chip so that you can test out this driver.

I have it setup to run on the demoboard configuration right now.


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,

Comments

  • VIRANDVIRAND Posts: 656
    edited 2010-02-05 22:35
    This sounds very interesting and I would like to try it ASAP but I believe someone is interfering with my internet connection.

    Do you have a problem with...
    --RFI, radio static noise from Propeller or other nearby sources?
    (Would be helped by averaging or lowpass filter or RF shield or choke)
    --Quantization error noise?
    (The microphone and preamp needs clean power
    and ADC needs as many bits as possible, 12 should be good at high sample rates.
    Serial or SAR ADCs might tend to have intrinsic quantization noise for audio. Do you have a "flash type ADC"?
    I've been considering designing and using a Graycode flash ADC, may have minimum possible Quant noise)
    I don't know how to help improve the simplified mic-headphones obex sigma delta adc on the demoboard;
    averaging is included I think.
    Quant noise can be visualized by plotting the lower 7 or 8 bits after clipping the waveform to that range,
    and it is maximally reduced if the plot is a straight line with the microphone off.
    --Real background sounds, like people in the room, vehicles outside?
    (Would be helped by a special microphone that is desensitized to low sounds, OR
    by techniques that separate sound from stereo or multiple microphones based on their relative location,
    similar to those which separate vocals from music, plus delays, dsp techniques.)

    A simple example: (rough pseudo code) for stereo sound separations without dsp filters
    L=left channel
    R=right channel
    novocals=L-R
    That is only a little oversimplified, some adjustment of volume is needed, and it does not take too many
    more similar steps to get back stereo novocals or stereo onlyvocals tracks.
    To eliminate or enhance sound from a particular location is possible especially with more mics,
    using delays and volume adjustments (maybe called weights, volume is adjusted by multiplying and
    then perhaps a right shift to rescale it to the normalization (normal "dynamic" range of volume).

    Someone recently asked about stereo delay processing and I forgot to mention the obex stereospatializer.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I should be typing in Spin now.
  • KyeKye Posts: 2,200
    edited 2010-02-06 05:14
    @VIRAND

    I actually have something here that's alot better than what the parallax library currently offers. I was·doing the same microphone to headphones demo but on my setup at least the sound is alot cleaner and richer compared to Chip's microphone to headphones demo.

    When you can download the file you'll see I have alot of new features implemented.

    I'm just posting this to see if anyone (who can test out my posted demo code) has any ideas on how to remove SLIGHT background noise. The noise is not really bad but I want to see if I can get rid of it all. Most of the noise however I would say comes from background noise in the enviorment. But background noise isn't really wanted so I want to see if I can tune that out.

    So, I need a purely software ASM approach to remove the noise.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2010-02-06 05:58
    "Most of the noise however I would say comes from background noise in the environment" - If a single unidirectional microphone would not do the trick I would consider two unidirectional microphones at slightly different angles aimed at the same target. The additive difference of the two should substantially increase your signal to noise ratio and suppress most if not all of your background noise.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-02-06 12:38
    Beau, I disagree that this is simply background (audio) noise. The switching threshold of the input buffer is hovering in a no-man's land that would normally be in a noise margin between a guaranteed high or low. Normally this voltage region would be avoided due to the unstable conditions that would exist. The slightest variation in on-chip supply voltage due to some other cog or process drawing varying amounts of power plus the normal CMOS switching noise would destabilize the teetering switching threshold.

    Also there is noise directly injected from the supply through the top capacitor as this ironically acts as a high-pass letting all the noise through to the input pin as well as being the filter cap for the feedback loop. A very tight design with good decoupling on all the pins and a solid ground plane along with regulators mounted as close to the chip as possible would help a lot. Of course, the input buffer is not designed to hover around this point with any guaranteed mode of operation anyway.

    If we had a comparator fast enough we could feed the input into that and then the comparator to the Prop's input pin and because the comparator would obviously have a stable reference voltage then the input would be relatively stable. There would always be the minor "hunting" noise as the feedback tries to balance the pin around the threshold as there is no way this type of circuit could operate otherwise. It's a bit like a switch-mode regulator's ripple which can be removed with a post-filter but not at the feedback point.

    But this is just my opinion, I'm interested in some input from the many experienced and knowledgeable forum members as well.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2010-02-06 15:36
    Peter, you are probably correct, I was just going on Kye's statement "Most of the noise ... come from background noise in the environment" and assumed this was background audio noise he was dealing with.

    Other than digital filtering in software I'm not sure how to reduce the Sigma-conversion noise. If you know the specific frequency you want to reduce you can compare the data buffer against a previous data location of itself in time that correlates to half the period of the frequency you want to 'notch'. This works best at high frequencies and can cause unwanted effects with lower frequencies. If you simply want a low-pass filter then averaging can be done to effectively remove high frequency components. high-pass filtering is a little tricky because it's derived from subtracting the low-pass filter result from the original sample.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • KyeKye Posts: 2,200
    edited 2010-02-06 18:21
    So I just tested out my driver using 8 bits instead of 16 bits and the amount of noise went up dramatically.

    At 16 bits the noise is low valued and does not make up a significant portition of the audio stream. However at 8 bits the noise overpowers the signal and everything becomes sorrounded in a layer of static.

    It seems I need a high pass filter to remove it at 16 bits and a low pass filter to remove it at 8 bits.

    So, how would I do this in ASM?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,

    Post Edited (Kye) : 2/7/2010 4:12:40 PM GMT
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2010-02-07 03:34
    @Kye

    RE:background noise

    Let us see what it looks like on your PropScope smilewinkgrin.gif
  • KyeKye Posts: 2,200
    edited 2010-02-07 05:50
    I don't have a prop scope.

    Sorry. cry.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • cgraceycgracey Posts: 14,256
    edited 2010-02-07 06:38
    Peter Jakacki said...
    ...The slightest variation in on-chip supply voltage due to some other cog or process drawing varying amounts of power plus the normal CMOS switching noise would destabilize the teetering switching threshold.


    This is true, but...

    Also there is noise directly injected from the supply through the top capacitor as this ironically acts as a high-pass letting all the noise through to the input pin as well as being the filter cap for the feedback loop....

    ...the idea of·the top cap (in addition to the bottom cap) is to·create a super-fast capacitive voltage divider which keeps the integrator voltage at a constant ratio of VDD to VSS, since the logic·threshold voltage is a function of the same. NOT having the top cap actually·"injects" VDD noise by not cancelling it. This can be verified by removing the top cap (or the bottom cap)·and hearing the difference.
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-02-07 08:40
    Ahhh, good. I hadn't investigated it but I do know that in analog circuits this happens. However, hearing the difference is not totally conclusive either. I do believe that it is canceling one type of noise, and "possibly" injecting another. Believing though is one thing and I wanted some "feedback" on this, thanks, although I will probably check it out for my peace of mind (and curiosity).

    Chip, do you have any thoughts on the capacitor dielectric's effect on noise. Could hysteresis be a factor? How will the Prop II improve on the input circuit?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • cgraceycgracey Posts: 14,256
    edited 2010-02-07 10:55
    Peter Jakacki said...
    Ahhh, good. I hadn't investigated it but I do know that in analog circuits this happens. However, hearing the difference is not totally conclusive either. I do believe that it is canceling one type of noise, and "possibly" injecting another. Believing though is one thing and I wanted some "feedback" on this, thanks, although I will probably check it out for my peace of mind (and curiosity).
    That top cap injects the same VDD noise that exists on the input decider right onto the input signal, itself,·making them more common-mode. It makes a big net improvement. You need to inject both VSS and VDD (bottom and top caps) to get lower noise.
    Chip, do you have any thoughts on the capacitor dielectric's effect on noise. Could hysteresis be a factor? How will the Prop II improve on the input circuit?
    Different caps might make somewhat of a difference, but I·believe that active noise sources play a much higher role. I remember hearing an audio guy say once that metallized polystyrene caps were some of the best to use, but I don't know.·Anything with low ESR and short leads (low L) should be pretty good.The next Propeller will have an internal integrator on each pin, along with local reclocking, for much better performance (better than 13-bit, according to SPICE simulation).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
Sign In or Register to comment.