element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum DC offset on microphones and workaround.
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 8 replies
  • Subscribers 666 subscribers
  • Views 3332 views
  • Users 0 members are here
  • wolfson
  • dmic
  • audio_card
  • raspberry_pi
  • raspeberry_pi_accessories
  • dc
  • offset
Related

DC offset on microphones and workaround.

Former Member
Former Member over 11 years ago

When recording from the on-board DMICs and the microphone on my headset, I have noticed DC offset.
On my headset microphone, not so much, but on the DMICs there is a lot.
When recording silence, the signal rests at around -30dB on the positive side.

 

The easy way to remove DC offset is to apply a fairly steep high-pass filter with a low cutoff frequency, in post-production.
E.g. in Audacity you can go to Effects... -> Equalization... and apply the 100Hz Rumble EQ curve.


But perusing the WM5102 data sheet revealed that it has filters on-chip, so why not use them?

Here's my modified use case script for recording from the DMICs:

 

#!/bin/bash
# Record from onboard DMICs to RPi.
# Route through High Pass Filter to get rid of DC offset.
#
# IN2 --> LHPF --> AIF1TX
# May want to tune the gain here
# Need at least -6dB
amixer -Dhw:0 cset name='IN2L Digital Volume' 128
amixer -Dhw:0 cset name='IN2R Digital Volume' 128
# DMICs are incorrectly labeled on the board.
# DMICL is actually the right channel and vice versa,
# so we'll swap them here.
# i.e. IN2R --> LHPF1
#      IN2L --> LHPF2
# Route DMICs (IN2) to LHPFs.
amixer -Dhw:0 cset name='LHPF1 Input 1' IN2R
amixer -Dhw:0 cset name='LHPF2 Input 1' IN2L
amixer -Dhw:0 cset name='LHPF1 Mode' High-pass
amixer -Dhw:0 cset name='LHPF2 Mode' High-pass
amixer -Dhw:0 cset name='LHPF1 Coefficients' 240,3
amixer -Dhw:0 cset name='LHPF2 Coefficients' 240,3 
# Connect outputs of LHPFs to inputs of AIF1 (I2s to RPi)
amixer -Dhw:0 cset name='AIF1TX1 Input 1' LHPF1
amixer -Dhw:0 cset name='AIF1TX1 Input 1 Volume' 32
amixer -Dhw:0 cset name='AIF1TX2 Input 1' LHPF2
amixer -Dhw:0 cset name='AIF1TX2 Input 1 Volume' 32
amixer -Dhw:0 cset name='DMIC Switch' on


As can bee seen in the picture, the difference is obvious.
The top stereo track was recorded using the supplied Record_from_DMIC.sh use case script
and the bottom track with my modifications.

image

 


I have no idea about what the cut-off frequency of the filter is or how steep it is. The command

     amixer -Dhw:0 cget name='LHPF1 Coefficients'

only reveals two values, both of which are zero:

numid=85,iface=MIXER,name='LHPF1 Coefficients'
       ; type=BYTES,access=rw------,values=2
       : values=0x00,0x00

I'm guessing they represent frequency and steepness in some way, but the datasheet only has this to say about them:
"These coefficients are derived using tools provided in Wolfson’s WISCETm evaluation board control software; please contact your local Wolfson representative for more details."

My tests show, though, that voice recordings are not affected in any negative way.

 

EDIT: Added coefficients to the script as suggested by Scott

 

--

Ragnar

  • Sign in to reply
  • Cancel
Parents
  • Marki555
    Marki555 over 11 years ago

    You can "guess" the LHPF/EQ coefficients using the WISCE software - more info in this blog post Wolfson audio paths & how to use EQ and LHPF

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Marki555
    Marki555 over 11 years ago

    You can "guess" the LHPF/EQ coefficients using the WISCE software - more info in this blog post Wolfson audio paths & how to use EQ and LHPF

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube