Skip to content

Instantly share code, notes, and snippets.

@JasonLG1979
Last active October 2, 2020 02:56
Show Gist options
  • Save JasonLG1979/cb8616862f62134790ffadbd73879cde to your computer and use it in GitHub Desktop.
Save JasonLG1979/cb8616862f62134790ffadbd73879cde to your computer and use it in GitHub Desktop.
asound.conf
defaults.pcm.card 1 # Change to the card you want to be default.
defaults.ctl.card 1 # Change to the card you want to be default.
ctl.!default {
type plug
# slave.pcm "HQstereoHardWareVol20:CARD=0,DEV=0,SUBDEV=-1,RATE=44100,FORMAT=S16_LE,RATE_CONVERTER=samplerate_linear,PERIODS=4,PERIOD_TIME=125000"
# slave.pcm "HQstereoSoftWareVol20:CARD=0,DEV=0,SUBDEV=-1,RATE=44100,FORMAT=S16_LE,RATE_CONVERTER=samplerate_linear,PERIODS=4,PERIOD_TIME=125000"
slave.pcm "HQstereoHardWareVol20:CARD=1"
}
ctl.!default {
type hw
card 1 # Change to the card you want to be default.
device 0 # Change to the device you want to be default.
subdevice -1 # Change to the subdevice you want to be default.
}
###################
pcm.rawhw {
@args [ CARD DEV SUBDEV RATE FORMAT ]
@args.CARD {
type string
default 0
}
@args.DEV {
type integer
default 0
}
@args.SUBDEV {
type integer
default -1
}
@args.RATE {
type integer
default 44100
}
@args.FORMAT {
type string
default S16_LE
}
type hw
card $CARD
device $DEV
subdevice $SUBDEV
nonblock true
channels 2
rate $RATE
format $FORMAT
}
pcm.dmixer {
@args [ CARD DEV SUBDEV RATE FORMAT RATE_CONVERTER PERIODS PERIOD_TIME ]
@args.CARD {
type string
default 0
}
@args.DEV {
type integer
default 0
}
@args.SUBDEV {
type integer
default -1
}
@args.RATE {
type integer
default 44100
}
@args.FORMAT {
type string
default S16_LE
}
@args.RATE_CONVERTER {
type string
default samplerate_linear
}
@args.PERIODS {
type integer
default 4
}
@args.PERIOD_TIME {
type integer
default 125000
}
type dmix
ipc_key 1024
ipc_perm 0660
ipc_gid audio
slowptr true
hw_ptr_alignment roundup
slave {
pcm "rawhw:CARD=$CARD,DEV=$DEV,SUBDEV=$SUBDEV,RATE=$RATE,FORMAT=$FORMAT"
channels 2
period_size 0
buffer_size 0
buffer_time 0
period_time $PERIOD_TIME
periods $PERIODS
rate $RATE
format $FORMAT
}
bindings {
0 0
1 1
}
}
pcm.softvol {
@args [ CARD DEV SUBDEV RATE FORMAT RATE_CONVERTER PERIODS PERIOD_TIME ]
@args.CARD {
type string
default 0
}
@args.DEV {
type integer
default 0
}
@args.SUBDEV {
type integer
default -1
}
@args.RATE {
type integer
default 44100
}
@args.FORMAT {
type string
default S16_LE
}
@args.RATE_CONVERTER {
type string
default samplerate_linear
}
@args.PERIODS {
type integer
default 4
}
@args.PERIOD_TIME {
type integer
default 125000
}
type softvol
min_dB -96.3
slave {
pcm "dmixer:CARD=$CARD,DEV=$DEV,SUBDEV=$SUBDEV,RATE=$RATE,FORMAT=$FORMAT,RATE_CONVERTER=$RATE_CONVERTER,PERIODS=$PERIODS,PERIOD_TIME=$PERIOD_TIME"
format $FORMAT
}
control {
name SoftVol
card $CARD
device $DEV
subdevice $SUBDEV
}
}
pcm.HQstereoSoftWareVol20 {
@args [ CARD DEV SUBDEV RATE FORMAT RATE_CONVERTER PERIODS PERIOD_TIME ]
# Card name or number.
# Defaults to the 1st card whatever that is.
@args.CARD {
type string
default 0
}
# Device number.
# Defaults to the 1st device on the card whatever that is.
@args.DEV {
type integer
default 0
}
# Subdevice number.
# Defaults to the 1st subdevice on the device whatever that is.
@args.SUBDEV {
type integer
default -1
}
# Sampling rate in kHz:
# 44100, 48000, 88200, 96000...
# Defaults to 44.1 kHz (CD Quality).
@args.RATE {
type integer
default 44100
}
# Format:
# S16_LE, S24_LE, S24_3LE, S32_LE...
# Defaults to S16_LE (CD Quality).
@args.FORMAT {
type string
default S16_LE
}
# Resampling algorithm.
# Defaults to samplerate_linear.
@args.RATE_CONVERTER {
type string
default samplerate_linear
}
# Periods per buffer.
@args.PERIODS {
type integer
default 4
}
# Period size in time.
# Defaults to 125ms (0.125 sec).
# PERIODS * PERIOD_TIME = buffer time/size
@args.PERIOD_TIME {
type integer
default 125000
}
type plug
rate_converter $RATE_CONVERTER
slave {
channels 2
rate $RATE
format $FORMAT
pcm "softvol:CARD=$CARD,DEV=$DEV,SUBDEV=$SUBDEV,RATE=$RATE,FORMAT=$FORMAT,RATE_CONVERTER=$RATE_CONVERTER,PERIODS=$PERIODS,PERIOD_TIME=$PERIOD_TIME"
}
}
pcm.HQstereoHardWareVol20 {
@args [ CARD DEV SUBDEV RATE FORMAT RATE_CONVERTER PERIODS PERIOD_TIME ]
# Card name or number.
# Defaults to the 1st card whatever that is.
@args.CARD {
type string
default 0
}
# Device number.
# Defaults to the 1st device on the card whatever that is.
@args.DEV {
type integer
default 0
}
# Subdevice number.
# Defaults to the 1st subdevice on the device whatever that is.
@args.SUBDEV {
type integer
default -1
}
# Sampling rate in kHz:
# 44100, 48000, 88200, 96000...
# Defaults to 44.1 kHz (CD Quality).
@args.RATE {
type integer
default 44100
}
# Format:
# S16_LE, S24_LE, S24_3LE, S32_LE...
# Defaults to S16_LE (CD Quality).
@args.FORMAT {
type string
default S16_LE
}
# Resampling algorithm.
# Defaults to samplerate_linear.
@args.RATE_CONVERTER {
type string
default samplerate_linear
}
# Periods per buffer.
@args.PERIODS {
type integer
default 4
}
# Period size in time.
# Defaults to 125ms (0.125 sec).
# PERIODS * PERIOD_TIME = buffer time/size
@args.PERIOD_TIME {
type integer
default 125000
}
type plug
rate_converter $RATE_CONVERTER
slave {
channels 2
rate $RATE
format $FORMAT
pcm "dmixer:CARD=$CARD,DEV=$DEV,SUBDEV=$SUBDEV,RATE=$RATE,FORMAT=$FORMAT,RATE_CONVERTER=$RATE_CONVERTER,PERIODS=$PERIODS,PERIOD_TIME=$PERIOD_TIME"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment