LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-18-2011, 08:32 AM   #1
dimm0k
Member
 
Registered: May 2008
Location: Brooklyn ZOO
Distribution: Slackware64 14.2
Posts: 564

Rep: Reputation: 56
asoundrc works for HDMI/analog, but need help boosting volume


I've currently pieced together a ~/.asoundrc that gives me audio via HDMI and analog so I am able to get sound both on my externally connected monitor via HDMI and my notebook's speakers. Problem is, the analog output through the notebook's speakers/headphone jack is much much lower than it can be. In Windows 7 the volume is higher at the same level. I've read http://www.linuxquestions.org/questi...laptop-808663/ and http://alien.slackbook.org/blog/addi...-sound-levels/, which both suggest the following bit of code:

Code:
pcm.!default {
      type plug
      slave.pcm "softvol"
  }

  pcm.softvol {
      type softvol
      slave {
          pcm "dmix"
      }
      control {
          name "Pre-Amp"
          card 0
      }
      min_dB -5.0
      max_dB 20.0
      resolution 6
  }
The problem is, I'm not sure where to stick these in my code, which is as follows:
Code:
# ~/.asoundrc or /etc/asound.conf
# ALSA configuration file from http://forum.xbmc.org/showpost.php?p=513810&postcount=4

##### USAGE #####
# Save this file as "~/.asoundrc" (for user-specific sound configuration) or
# "/etc/asound.conf" (for system-wide sound configuration) and specify ALSA
# device names ad described in the next section.


##### DEVICE NAMES #####
# This configuration file defines four devices for use by the user.  Those
# devices are "analog", "mixed-analog", "digital", and "mixed-digital".  The
# user may also re-define "default" to be identical to one of the above-named
# devices (i.e. to send all sound output to the digital output unless otherwise
# specified).  Use the device names as described below:
#  - "analog" outputs to the analog output directly and (at least on software
#  sound cards) blocks other audio output.  After playback completes, "queued"
#  sounds are output in sequence.
#  - "mixed-analog" mixes audio output from multiple programs into the analog
#  output (so you can hear beeps, alerts, and other noises while playing back
#  an audio stream).
#  - "digital" outputs to the digital output directly.  Since most (all?)
#  digital outputs expect 48kHz PCM audio, this may not work for some playback
#  (i.e. CD's--which are 44.1kHz PCM audio--or 32kHz audio streams from TV
#  recordings, etc.).
#  - "mixed-digital"

# All other devices created within this file are used only by the configuration
# file itself and should /not/ be used directly.  In other words, do not use
# the devices "analog-hw", "dmix-analog", "digital-hw", or "dmix-digital".


##### IMPORTANT #####
# To make this ALSA configuration file work with your sound card, you will need
# to define the appropriate card and device information for the "analog-hw" and
# "digital-hw" devices below.  You can find the card and device information
# using "aplay -l".

# Alias for (converted) analog output on the card
# - This is identical to the device named "default"--which always exists and
# refers to hw:0,0 (unless overridden)
# - Therefore, we can specify "hw:0,0", "default", or "analog" to access analog
# output on the card
# - Note that as of ALSA 1.0.9, "software" sound card definitions redefine
# "default" to do mixing, meaning this device is different from "default" and
# allows playback while blocking other sound sources (until playback
# completes).
pcm.analog {
  type plug
  slave.pcm "analog-hw"

  hint {
    show on
    description "Analog Output - Use analog outputs, converting samples, format, and rate as necessary."
  }
}

# Control device (mixer, etc.) for the card
ctl.analog {
  type hw
  card 0
  device 0
}

# Alias for (converted) mixed analog output on the card
# - This will accept audio input--regardless of rate--and convert to the rate
# required for the dmix plugin (in this case 48000Hz)
# - Note that as of ALSA 1.0.9, "software" sound card definitions redefine
# "default" to do mixing, meaning this device is identical to "default" for
# "software" sound cards.
pcm.mixed-analog {
  type plug
  slave.pcm "dmix-analog"
  hint {
    show on
    description "Mixed Analog Output - Use analog outputs, converting samples, format, and rate as necessary. Allows mixing wit
h system sounds."
  }
}

# Control device (mixer, etc.) for the card
ctl.mixed-analog {
  type hw
  card 0
  device 0
}

# Alias for (converted) digital (HDMI) output on the card
pcm.digital {
  type plug
  slave.pcm "digital-hw"
  hint {
    show on
    description "Digital Output - Use digital outputs, converting samples, format, and rate as necessary."
  }
}

# Control device (mixer, etc.) for the card
ctl.digital {
  type hw
  card 1
  device 3
}

# Alias for mixed (converted) digital (HDMI) output on the card

pcm.mixed-digital {
  type plug
  slave.pcm "dmix-digital"
  hint {
    show on
    description "Mixed Digital Output - Use digital outputs, converting samples, format, and rate as necessary. Allows mixing w
ith system sounds."
  }
}

# Control device (mixer, etc.) for the card
ctl.mixed-digital {
  type hw
  card 1
  device 3
}

# The following devices are not useful by themselves.  They require specific
# rates, channels, and formats.  Therefore, you probably do not want to use
# them directly.  Instead use of of the devices defined above.

# Alias for analog output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.analog-hw {
  type hw
  card 0
  device 0
}

# Control device (mixer, etc.) for the card
ctl.analog-hw {
  type hw
  card 0
  device 0
}

# Alias for digital (HDMI) output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.digital-hw {
  type hw
  card 1
  device 3
}

# Control device (mixer, etc.) for the card

ctl.digital-hw {
  type hw
  card 1
  device 3
}

# Direct software mixing plugin for analog output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.dmix-analog {
  type dmix
  ipc_key 1234
  slave {
    pcm "analog-hw"
    period_time 0
    period_size 1024
#    buffer_size 4096
    buffer_size 8192
    rate 48000
  }
}

# Control device (mixer, etc.) for the card
ctl.dmix-analog {
  type hw
  card 0
  device 0
}

# Direct software mixing plugin for digital (S/PDIF) output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.dmix-digital {
  type dmix
  ipc_key 1235
  slave {
    pcm "digital-hw"
    period_time 0
    period_size 1024
#    buffer_size 4096
    buffer_size 8192
    rate 48000
  }
}

# Control device (mixer, etc.) for the card
ctl.dmix-digital {
  type hw
  card 1
  device 3
}

# Make joint analog/HDMI the default
pcm.!default {
  type plug
  slave {
    pcm multi
    rate 48000
  }
  ttable.0.0 1.0;
  ttable.1.1 1.0;
  ttable.0.2 1.0;  # front left
  ttable.1.3 1.0;  # front right
  hint {
    show on
    description "Default - output using Mixed Analog AND Mixed Digital"
  }
}

# Control device (mixer, etc.) for the card
ctl.!default {
  type hw
  card 0
}

pcm.multi {
  type multi
#  slaves.a.pcm "analog-hw"
  slaves.a.pcm "dmix-analog"
  slaves.a.channels 2
#  slaves.b.pcm "digital-hw"
  slaves.b.pcm "dmix-digital"
  slaves.b.channels 2
  bindings.0.slave a;
  bindings.0.channel 0;
  bindings.1.slave a;
  bindings.1.channel 1;

  bindings.2.slave b;
  bindings.2.channel 0;
  bindings.3.slave b;
  bindings.3.channel 1;
}

ctl.multi {
  type hw
  card 0
}
Suggestions welcome!
 
Old 06-18-2011, 09:46 AM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

This post from So you want to be a Slacker! What do I do next? may help.
 
Old 06-18-2011, 05:34 PM   #3
dimm0k
Member
 
Registered: May 2008
Location: Brooklyn ZOO
Distribution: Slackware64 14.2
Posts: 564

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by onebuck View Post
Thanks, but I was looking more for where to actually stick those lines in my asoundrc file since I've already defined my analog system and that's the system I want to boost the audio on... just not exactly sure where to stick'em.

EDIT: Ok I believe I found the location of where it should be and while I see Pre-Amp in alsamixer, moving it up and done does not change the volume at all! What am I missing?

Last edited by dimm0k; 06-18-2011 at 10:26 PM.
 
Old 06-19-2011, 12:10 PM   #4
dimm0k
Member
 
Registered: May 2008
Location: Brooklyn ZOO
Distribution: Slackware64 14.2
Posts: 564

Original Poster
Rep: Reputation: 56
Looks like I figured it out! All it needed was a minor change towards the bottom so pcm.multi uses softvol instead of dmix-analog. softvol then passes the audio down to dmix-analog and voila!

Code:
# ~/.asoundrc or /etc/asound.conf
# ALSA configuration file from http://forum.xbmc.org/showpost.php?p=513810&postcount=4

##### USAGE #####
# Save this file as "~/.asoundrc" (for user-specific sound configuration) or
# "/etc/asound.conf" (for system-wide sound configuration) and specify ALSA
# device names ad described in the next section.


##### DEVICE NAMES #####
# This configuration file defines four devices for use by the user.  Those
# devices are "analog", "mixed-analog", "digital", and "mixed-digital".  The
# user may also re-define "default" to be identical to one of the above-named
# devices (i.e. to send all sound output to the digital output unless otherwise
# specified).  Use the device names as described below:
#  - "analog" outputs to the analog output directly and (at least on software
#  sound cards) blocks other audio output.  After playback completes, "queued"
#  sounds are output in sequence.
#  - "mixed-analog" mixes audio output from multiple programs into the analog
#  output (so you can hear beeps, alerts, and other noises while playing back
#  an audio stream).
#  - "digital" outputs to the digital output directly.  Since most (all?)
#  digital outputs expect 48kHz PCM audio, this may not work for some playback
#  (i.e. CD's--which are 44.1kHz PCM audio--or 32kHz audio streams from TV
#  recordings, etc.).
#  - "mixed-digital"

# All other devices created within this file are used only by the configuration
# file itself and should /not/ be used directly.  In other words, do not use
# the devices "analog-hw", "dmix-analog", "digital-hw", or "dmix-digital".


##### IMPORTANT #####
# To make this ALSA configuration file work with your sound card, you will need
# to define the appropriate card and device information for the "analog-hw" and
# "digital-hw" devices below.  You can find the card and device information
# using "aplay -l".

# Alias for (converted) analog output on the card
# - This is identical to the device named "default"--which always exists and
# refers to hw:0,0 (unless overridden)
# - Therefore, we can specify "hw:0,0", "default", or "analog" to access analog
# output on the card
# - Note that as of ALSA 1.0.9, "software" sound card definitions redefine
# "default" to do mixing, meaning this device is different from "default" and
# allows playback while blocking other sound sources (until playback
# completes).
pcm.analog {
  type plug
  slave.pcm "analog-hw"

  hint {
    show on
    description "Analog Output - Use analog outputs, converting samples, format, and rate as necessary."
  }
}

# Control device (mixer, etc.) for the card
ctl.analog {
  type hw
  card 0
  device 0
}

# Alias for (converted) mixed analog output on the card
# - This will accept audio input--regardless of rate--and convert to the rate
# required for the dmix plugin (in this case 48000Hz)
# - Note that as of ALSA 1.0.9, "software" sound card definitions redefine
# "default" to do mixing, meaning this device is identical to "default" for
# "software" sound cards.
pcm.mixed-analog {
  type plug
  slave.pcm "dmix-analog"
  hint {
    show on
    description "Mixed Analog Output - Use analog outputs, converting samples, format, and rate as necessary. Allows mixing wit
h system sounds."
  }
}

# Control device (mixer, etc.) for the card
ctl.mixed-analog {
  type hw
  card 0
  device 0
}

# Alias for (converted) digital (HDMI) output on the card
pcm.digital {
  type plug
  slave.pcm "digital-hw"
  hint {
    show on
    description "Digital Output - Use digital outputs, converting samples, format, and rate as necessary."
  }
}

# Control device (mixer, etc.) for the card
ctl.digital {
  type hw
  card 1
  device 3
}

# Alias for mixed (converted) digital (HDMI) output on the card

pcm.mixed-digital {
  type plug
  slave.pcm "dmix-digital"
  hint {
    show on
    description "Mixed Digital Output - Use digital outputs, converting samples, format, and rate as necessary. Allows mixing w
ith system sounds."
  }
}

# Control device (mixer, etc.) for the card
ctl.mixed-digital {
  type hw
  card 1
  device 3
}

# The following devices are not useful by themselves.  They require specific
# rates, channels, and formats.  Therefore, you probably do not want to use
# them directly.  Instead use of of the devices defined above.

# Alias for analog output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.analog-hw {
  type hw
  card 0
  device 0
}

# Control device (mixer, etc.) for the card
ctl.analog-hw {
  type hw
  card 0
  device 0
}

# Alias for digital (HDMI) output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.digital-hw {
  type hw
  card 1
  device 3
}

# Control device (mixer, etc.) for the card

ctl.digital-hw {
  type hw
  card 1
  device 3
}

# Direct software mixing plugin for analog output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.dmix-analog {
  type dmix
  ipc_key 1234
  slave {
    pcm "analog-hw"
    period_time 0
    period_size 1024
#    buffer_size 4096
    buffer_size 8192
    rate 48000
  }
}

# Control device (mixer, etc.) for the card
ctl.dmix-analog {
  type hw
  card 0
  device 0
}

# Direct software mixing plugin for digital (S/PDIF) output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.dmix-digital {
  type dmix
  ipc_key 1235
  slave {
    pcm "digital-hw"
    period_time 0
    period_size 1024
#    buffer_size 4096
    buffer_size 8192
    rate 48000
  }
}

# Control device (mixer, etc.) for the card
ctl.dmix-digital {
  type hw
  card 1
  device 3
}

# Make joint analog/HDMI the default
pcm.!default {
  type plug
  slave {
    pcm multi
    rate 48000
  }
  ttable.0.0 1.0;
  ttable.1.1 1.0;
  ttable.0.2 1.0;  # front left
  ttable.1.3 1.0;  # front right
  hint {
    show on
    description "Default - output using Mixed Analog AND Mixed Digital"
  }
}

# Control device (mixer, etc.) for the card
ctl.!default {
  type hw
  card 0
}

pcm.multi {
  type multi
  slaves.a.pcm "softvol"
  slaves.a.channels 2
  slaves.b.pcm "dmix-digital"
  slaves.b.channels 2
  bindings.0.slave a;
  bindings.0.channel 0;
  bindings.1.slave a;
  bindings.1.channel 1;

  bindings.2.slave b;
  bindings.2.channel 0;
  bindings.3.slave b;
  bindings.3.channel 1;
}

ctl.multi {
  type hw
  card 0
}

pcm.softvol { 
  type softvol
  slave {  
    pcm "dmix-analog"
  }
  control {
    name "Pre-Amp"
    card 0
  }
  min_dB -5.0
  max_dB 10.0
  resolution 6
}

Last edited by dimm0k; 06-19-2011 at 12:12 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ATI Driver Problem. Analog works but DVI doesn't Jay750 Linux - Newbie 3 09-27-2008 10:09 PM
No Volume groups found in CentOS-5 boot-up but works in USB caddie but not in PC robrich Linux - Newbie 0 01-08-2008 08:51 AM
VIA Audio in RH9 - Works but Volume Too Low bwarbiany Red Hat 2 04-02-2007 01:56 PM
Audio works, can't adjust volume yamaduc Fedora 3 10-04-2005 08:05 PM
NO volume control but Sblive on KDE3 sound works Doomy069 Linux - Distributions 2 11-08-2002 07:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration