Hitchhiker's Guide to Openbsd


- How do I configure my audio device?


Download 1.27 Mb.
Pdf ko'rish
bet186/258
Sana04.04.2023
Hajmi1.27 Mb.
#1328980
1   ...   182   183   184   185   186   187   188   189   ...   258
Bog'liq
obsd-faq49

13.1 - How do I configure my audio device?
The devices in OpenBSD that are related to audio are: 
/dev/audio

/dev/sound

/dev/
audioctl
and 
/dev/mixer
. For a good overview of the audio driver layer, please read the 
audio(4)
manual page. 
All supported audio drivers are already included in the GENERIC kernel so there is no need for extra 
http://www.openbsd.org/faq/faq13.html (1 of 25)9/4/2011 10:02:21 AM


13 - Multimedia
configuration or installation of drivers. To find out about options for your specific sound chip, you must 
find out which sound chip you have. Supported chips may be found on the hardware compatibility page 
for your 
platform
. When you already have OpenBSD running, look for a sound driver in the output of 
the 
dmesg(8)
command, and read its manual page to find more specific information like options and 
other details about the driver. An example of an audio chip in a dmesg output is: 
auich0 at pci0 dev 31 function 5 "Intel 82801BA AC97" rev 
0x04: irq 10, ICH2 AC97
ac97: codec id 0x41445360 (Analog Devices AD1885)
ac97: codec features headphone, Analog Devices Phat Stereo
audio0 at auich0
OpenBSD base provides two tools for monitoring and configuring audio devices. 
audioctl(1)
is used for 
the audio processing parameters, such as encoding, sample rate and number of channels, while 
mixerctl
(1)
is used for the mixing parameters, such as channel source, gain level and mute. 
The following command uses 
audioctl(1)
to display the default processing parameters of an audio 
device. 
audioctl -f /dev/audio
...
Note that 
-f /dev/audio
was used explicitly. Opening 
/dev/audio
causes the audio device to 
reset to the default parameters, which is what we wanted to see. 
audioctl(1)
is also quite useful for exploring the capabilities of an audio device. For example, to see if 
the device supports some common sample rates, you could simply try setting the playback rate: 
audioctl play.rate=48000
play.rate: -> 48000
audioctl play.rate=44100
play.rate: -> 44100
audioctl play.rate=22050
audioctl: set failed: Invalid argument
audioctl play.rate=8000
audioctl: set failed: Invalid argument
$
This device supports 48000 and 44100 Hz playback rates, but not 22050 or 8000. Note that if a sample 
rate is not supported, there is not always an error message, but the returned sample rate is not the one 
that was desired. 
http://www.openbsd.org/faq/faq13.html (2 of 25)9/4/2011 10:02:21 AM


13 - Multimedia
audioctl play.rate=48000
play.rate: -> 48000
audioctl play.rate=44100
play.rate: -> 48000
audioctl play.rate=22050
play.rate: -> 48000
audioctl play.rate=8000
play.rate: -> 48000
$
This device supports 48000 Hz playback only. 
Audio hardware is usually capable of at least some minimal mixing. Running 
mixerctl(1)
 with no 
arguments will list the device's mixer controls and current settings. 
mixerctl
...
Some devices have only a handful of controls, some have a hundred or more. Note that not every option 
of every audio chip necessarily reaches the outside world. So there may be, for example, more outputs 
listed than are physically available on a sound card or motherboard. 
There are a few controls that are common to many devices: 

outputs.master
controls the playback output level 

inputs.dac
controls the level from the DAC (digital to analog converter), used when playing 
an audio file 

record.source
controls what inputs are mixed into the ADC (analog to digital converter), 
used when recording 

record.volume
or 
record.record
controls the input level of the ADC 
The controls of an audio device may be labeled differently. For instance, there might not be an 
outputs.master
as above, but there is an 
outputs.outputs
which does the same thing. Usually 
the controls have a meaningful label, but sometimes one must simply try different settings to see what 
effect each control has. 
Some devices use what is known as EAPD, which stands for external amplifier power down. However, 
this is just another on/off switch. It is probably refered to as "power down" because it is often used for 
power saving, which means this type of control is more often found in laptops. Sometimes it is necessary 
to set controls with 
eapd
or 
extamp
in their name to 
on
to get an output signal. 
http://www.openbsd.org/faq/faq13.html (3 of 25)9/4/2011 10:02:21 AM


13 - Multimedia
As a basic example of common mixerctl usage, to set the volume of the left and right channels to 200, 
you would issue 
mixerctl outputs.master=200,200
outputs.master: 255,255 -> 207,207
Notice how the value becomes 207. The reason for this is that this audio device has an AC'97 codec, 
which uses only 5 bits for volume control, leading to only 32 possible values. Other hardware could 
have different resolution. 
To unmute the master channel, you would do 
mixerctl outputs.master.mute=off
outputs.master.mute: on -> off
To make the changes take affect on each reboot, edit /etc/mixerctl.conf, for example: 
cat /etc/mixerctl.conf
outputs.master=200,200
outputs.master.mute=off
outputs.headphones=160,160
outputs.headphones.mute=off

Download 1.27 Mb.

Do'stlaringiz bilan baham:
1   ...   182   183   184   185   186   187   188   189   ...   258




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling