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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • 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
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • 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 Better Documentation
  • 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
  • State Not Answered
  • Replies 7 replies
  • Subscribers 683 subscribers
  • Views 1471 views
  • Users 0 members are here
  • wolfson
  • documentation
  • raspberry_pi
  • raspeberry_pi_accessories
Related

Better Documentation

lleibovici
lleibovici over 12 years ago

I have the board working and I'm very happy with the performance.

However I'm struggling with the documentation. I am unfamiliar with ALSA and am struggling to understand the "Use Case" scripts.

Just trying to work out how to change the volume on the headset while it is running has so far failed me. All I seem able to do is mute the channel.

Can you give us some guidance on how to identify what names to use in an amixer command for example.

What are HPOUT1L and HPOUT2L for example?

What is the difference between "Digital Volume" and "Volume"? What are the value ranges for these commands?

 

Is there some good reading available on an "Idiots guide to ALSA"?

 

Is this the right place to ask these questions?

 

Leo

  • Sign in to reply
  • Cancel
Parents
  • ctgreybeard
    0 ctgreybeard over 11 years ago

    I think I can help a little. Although this is the halt leading the blind I think.

     

    I am able to change the volume on Line Out (which is where my speakers are plugged) which is HPOUT2. Headset, I believe is HPOUT1 so you can adapt this as needed.

     

    I wrote a zsh function. I suspect a similar thing is available for bash if that's your pleasure.

     

    #!/bin/zsh

     

    function vol() {

     

    defvol=90

        if [[ -n $1 ]] {

            vol=$1

        } else {

            vol=$defvol

        }

     

        (( ivol = $vol * 20 / 90 ))

        print "Setting volume to: $vol/$ivol"

     

        CARD="hw:0"

        BEQUIET=" -q "

        BEQUIET=""

     

    # Route LineIn input to HPOUT2s.

     

     

    # Set volume on HPOUT2s to a sane level.

    #amixer ${BEQUIET} -D${CARD} cset name='HPOUT2 Digital Volume' 128

        amixer ${BEQUIET} -D${CARD} cset name='HPOUT2 Digital Volume' $vol

        amixer ${BEQUIET} -D${CARD} cset name='HPOUT2L Input 1 Volume' $ivol

        amixer ${BEQUIET} -D${CARD} cset name='HPOUT2R Input 1 Volume' $ivol

    }

     

     

    I scaled the input volume against the 90 that was in the original Listen script. I have since learned the limits on these numbers:

     

    `--> vol 135

    Setting volume to: 135/30

    numid=156,iface=MIXER,name='HPOUT2 Digital Volume'

      ; type=INTEGER,access=rw---R--,values=2,min=0,max=191,step=0

      : values=135,135

      | dBscale-min=-64.00dB,step=0.50dB,mute=0

    numid=120,iface=MIXER,name='HPOUT2L Input 1 Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=48,step=0

      : values=30

      | dBscale-min=-32.00dB,step=1.00dB,mute=0

    numid=124,iface=MIXER,name='HPOUT2R Input 1 Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=48,step=0

      : values=30

      | dBscale-min=-32.00dB,step=1.00dB,mute=0

     

     

    So the scaling could/should be done better.

     

    I would like to know what the difference is between Digital Volume and Input n Volume and why the scripts set the both. I have experimented with just setting Digital Volume and that seems to control the result correctly.  Hmmm, I just noticed that Digital Volume carries 2 values. Can I assume that these are Left and Right channels??

     

    Maybe I'll just set the Input Volume to the midpoint and adjust the Digital Volume. I could make it in a range of, say, 0 to 11 then I could have an amp that GOES TO 11! ...sorry... geek reference

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to ctgreybeard

    The difference between "Volume" and "Digital Volume"?

    All interfaces that have inputs have four inputs. In the Farnell/Wolfson supplied scripts only Input 1 is ever used.

    But, you can use all four to mix several different sources together.

    Like I do in my Record_from_All.sh script, where I connect the DMICs to Input 1, Headset mic to Input 2, Line In to Input 3 and S/PDIF to Input 4 of AIF1TX{1,2} - the interface to the RPi.

     

    #!/bin/bash
    CARD="hw:0"
    BEQUIET=" -q "
    # Record from onboard DMICs to RPi
    
    # May want to tune the gain here
    # Need at least -6dB
    amixer ${BEQUIET} -D${CARD} cset name='IN2L Digital Volume' 128
    amixer ${BEQUIET} -D${CARD} 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 ${BEQUIET} -D${CARD} cset name='LHPF1 Input 1' IN2R
    amixer ${BEQUIET} -D${CARD} cset name='LHPF2 Input 1' IN2L
    amixer ${BEQUIET} -D${CARD} cset name='LHPF1 Mode' High-pass
    amixer ${BEQUIET} -D${CARD} cset name='LHPF2 Mode' High-pass
    amixer ${BEQUIET} -D${CARD} cset name='LHPF1 Coefficients' 240 3
    amixer ${BEQUIET} -D${CARD} cset name='LHPF2 Coefficients' 240 3
    
    # Connect outputs of LHPFs to inputs of AIF1 (I2s to RPi)
    amixer ${BEQUIET} -D${CARD} cset name='AIF1TX1 Input 1' LHPF1
    amixer ${BEQUIET} -D${CARD} cset name='AIF1TX1 Input 1 Volume' 32
    amixer ${BEQUIET} -D${CARD} cset name='AIF1TX2 Input 1' LHPF2
    amixer ${BEQUIET} -D${CARD} cset name='AIF1TX2 Input 1 Volume' 32
    
    amixer ${BEQUIET} -D${CARD} cset name='DMIC Switch' on
    
    # Record from Headset to RPi
    amixer -Dhw:0 cset name='IN1R Volume' 20
    amixer -Dhw:0 cset name='IN1 Digital Switch' on
    
    # Route HeadsetMic (IN1) to LHPF.
    amixer ${BEQUIET} -D${CARD} cset name='LHPF3 Input 1' IN1R
    amixer ${BEQUIET} -D${CARD} cset name='LHPF3 Mode' High-pass
    amixer ${BEQUIET} -D${CARD} cset name='LHPF3 Coefficients' 240 3
    
    amixer -Dhw:0 cset name='AIF1TX1 Input 2' LHPF3
    amixer -Dhw:0 cset name='AIF1TX1 Input 2 Volume' 32
    amixer -Dhw:0 cset name='AIF1TX2 Input 2' LHPF3
    amixer -Dhw:0 cset name='AIF1TX2 Input 2 Volume' 32
    amixer -Dhw:0 cset name='Headset Mic Switch' on
    # This is set up as a dual mono record.
    
    # Record from onboard Line Input to RPi
    
    # +9dB input PGA gain
    amixer -Dhw:0 cset name='IN3L Volume' 8
    amixer -Dhw:0 cset name='IN3R Volume' 8
    
    # better THD in normal mode vs lower noise floor in high performance
    amixer -Dhw:0 cset name='IN3 High Performance Switch' on
    
    amixer -Dhw:0 cset name='IN3L Digital Volume' 128
    amixer -Dhw:0 cset name='IN3R Digital Volume' 128
    
    amixer -Dhw:0 cset name='AIF1TX1 Input 3' IN3L
    amixer -Dhw:0 cset name='AIF1TX1 Input 3 Volume' 32
    amixer -Dhw:0 cset name='AIF1TX2 Input 3' IN3R
    amixer -Dhw:0 cset name='AIF1TX2 Input 3 Volume' 32
    
    # Record from SPDIF in
    
    #SPDIF Record:
    amixer -Dhw:0 cset name='SPDIF in Switch' on
    # switch off SPDIF TX in case already active as
    # WM8804 must run at RX rate if enabled
    
    amixer -Dhw:0 cset name='TX Playback Switch' off
    amixer -Dhw:0 cset name='RX Playback Switch' on
    amixer -Dhw:0 cset name='AIF Playback Switch' on
    amixer -Dhw:0 cset name='AIF1TX1 Input 4' AIF2RX1
    amixer -Dhw:0 cset name='AIF1TX1 Input 4 Volume' 10
    amixer -Dhw:0 cset name='AIF1TX2 Input 4' AIF2RX2
    amixer -Dhw:0 cset name='AIF1TX2 Input 4 Volume' 10

    You use the four individual "Volume" controls of the Inputs to set the gain structure - the balance between the four Inputs.

    The "Digital Volume" controls an amplifier that affects all four Inputs in unison, like a kind of Master volume.

     

    And why the value 128 for the "Digital Volume" in all the scripts?

    Looking at the details of a Digital Volume control

    $ amixer ${BEQUIET} -D${CARD} cget name='HPOUT2 Digital Volume'

    numid=156,iface=MIXER,name='HPOUT2 Digital Volume'

      ; type=INTEGER,access=rw---R--,values=2,min=0,max=191,step=0

      : values=128,128

      | dBscale-min=-64.00dB,step=0.50dB,mute=0

    we see that it can be adjusted in 192 steps of 0.5dB each, from -64 to +32.

    -64db + 128 * 0.5dB = 0dB, i.e the value 128 results in unity gain - the signal is neither amplified nor attenuated.

    --

    Ragnar

     

    P.S.

    I have one of these. Note how far the Phones volume control goes image Yup, I'm a geek too...

    image

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • ctgreybeard
    0 ctgreybeard over 11 years ago in reply to Former Member

    Thank you very much for the explanation. I have one follow-up question.

     

    I see that the Digital Volume has two values but is set in the examples using only one. That would be natural for balanced channels and is most likely what you would want. But what is the syntax for setting the two values if, for whatever reason, you didn't want them equal?  Would it be as simple as using "120,130" to set th channels differently? And, if that is the case, in what order do they appear?

     

    Bill W

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • ctgreybeard
    0 ctgreybeard over 11 years ago in reply to Former Member

    Thank you very much for the explanation. I have one follow-up question.

     

    I see that the Digital Volume has two values but is set in the examples using only one. That would be natural for balanced channels and is most likely what you would want. But what is the syntax for setting the two values if, for whatever reason, you didn't want them equal?  Would it be as simple as using "120,130" to set th channels differently? And, if that is the case, in what order do they appear?

     

    Bill W

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • Former Member
    0 Former Member over 11 years ago in reply to ctgreybeard

    Not all "Digital Volumes" can take two arguments, I think it's only outputs that do.

    But, yes, it's that simple. Give it one argument and both stereo channels change.

    Given two arguments (comma-separated), the first adjusts the left channel and the second adjusts the right.

    --

    Ragnar

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • ctgreybeard
    0 ctgreybeard over 11 years ago in reply to Former Member

    Thank you again. All is getting clearer.

     

    A related thing though, and I don't know where else to post this, is that in investigating the whole thing I was using the 'amixer controls' command and found this:

     

    numid=36,iface=MIXER,name='EQ1 Coefficeints'

    numid=37,iface=MIXER,name='EQ2 Coefficeints'

    numid=38,iface=MIXER,name='EQ3 Coefficeints'

    numid=39,iface=MIXER,name='EQ4 Coefficeints'

     

    but, later on:

     

    numid=85,iface=MIXER,name='LHPF1 Coefficients'

    numid=86,iface=MIXER,name='LHPF2 Coefficients'

    numid=87,iface=MIXER,name='LHPF3 Coefficients'

    numid=88,iface=MIXER,name='LHPF4 Coefficients'

     

    Do you have any idea where I can report the misspelling? Not that I think I'll be messing with equalizer coefficeints any time soon!image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to ctgreybeard

    A couple of months ago I browsed around in Wolfson's open source repository and noticed that it's already fixed.

    opensource.wolfsonmicro.com Git - linux-2.6-asoc.git/commitdiff

     

    But I don't know how to report bugs.

    If you do a search for "opensource.wolfsonmicro.com" in the repository you'll find a couple of names and e-mail adresses.

    http://opensource.wolfsonmicro.com/cgi-bin/gitweb.cgi?p=linux-2.6-asoc.git&a=search&h=455c6fdbd219161bd09b1165f11699d6d73de11c&st=commit&s=opensource.wolfsonmicro.com

    --

    Ragnar

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
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 © 2026 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