Foreword
Information on this wiki page reflects the current state of sound support in FreeBSD 9-CURRENT. Most of it may also apply to FreeBSD 8-STABLE, but that is in no way guaranteed. It is our hope that this wiki page will collect and document everything that users and developers might find interesting about sound support in FreeBSD. If something is missing or wrong, please fix it. This is a wiki after all.
History
Sound support for FreeBSD began in 1993, when Jordan K. Hubbard imported version 1.0c of the generic Linux sound driver into FreeBSD, later known as the VoxWare sound drivers, written by Hannu Savolainen. This code was made available by Hannu under two different licenses, GPL for Linux, and BSD for FreeBSD and other Unix variants. Several new versions of the VoxWare drivers were imported (and modified) into the FreeBSD base system between 1993 and 1997. At this time Amancio Hasty and Jim Lowe did most of the work on sound support in FreeBSD. The VoxWare drivers eventually became what we know today as OSS, the Open Sound System, maintained by Hannu and his team at 4Front Technologies. OSS has been considered a standard in the Linux world for many years, even if the ALSA project has become the number one choice nowadays. The last version to be imported was VoxWare 3.5-alpha6. By following the history it is evident that the sound API in FreeBSD has gradually evolved from the VoxWare standard, which later become the OSS standard.
However, things changed in 1997 as more of the foundation for the sound system we have today was laid out. Luigi Rizzo was maintaining his own set of patches for FreeBSD and in 1997 his sound code was imported by John-Mark Gurney as an alternate sound driver. This driver was a complete rewrite (with the exception of soundcard.h) of the existing code (VoxWare code + modifications from Amancio). One of the most important features was support for PnP and FreeBSD 2.2.6 was the first release where it was part of the FreeBSD kernel source tree. So, for a period of time we had two sound drivers available in the FreeBSD kernel source tree:
sys/i386/isa/snd/ (new code from Luigi Rizzo, called the "pcm" driver) sys/i386/isa/sound/ (the old code, obtained from VoxWare and modified for FreeBSD)
From 1997 to 1998, Luigis code was maintained outside of the FreeBSD repository and was imported into FreeBSD whenever he cut a new release of his code.
In 1999, Cameron Grant rewrote the sound system for FreeBSD 4.0 (his new driver was referred to as "newpcm" at the time) and later on imported his work to sys/dev/pcm and announced the change on the FreeBSD current mailing list. This superceded Luigis pcm driver and it was removed from the tree a month later. Camerons newpcm code used the newbus interface and supported a great deal of hardware. Not long after the import of newpcm, the sound code was moved again. This time it ended up in sys/dev/sound, which also is the current location of all code belonging to the FreeBSD sound system. In the following years many things changed in the sound area. The amount of drivers for different hardware chips increased dramatically (especially for PCI and USB devices) and many improvements were made to the sound infrastructure, much thanks to Cameron Grant and Orion Hodson. Cameron passed away in 2005, which was a major loss for the FreeBSD community.
Ariff Abdullah took over the maintainership of the pcm code in FreeBSD in 2005 and other individuals are taking care of the sound device drivers. Since then we've seen some dramatic changes in sound support [... talk about some of the new stuff here].
Features
A big list of features and stuff we support here...
Documentation
There are bits and pieces of information scattered around the Internet about the FreeBSD sound system. The FreeBSD Projects has two primary places (this wiki page is an exception, of course) where the documentation is kept: manual pages and the FreeBSD Handbook. There are also a few other places where you might find useful information. This section tries to document these places.
Manual Pages
The number one stop for up-to-date information is the sound(4) manual page. It is always updated when a new feature is added. It has for example descriptions for all available dev.pcm and hw.snd sysctl's. You can learn a lot about the possible ways to configure sound during runtime just by reading this manual page.
The mixer(8) manual page may also come in handy. The mixer(8) utility is used to set/display sound card mixer values.
For information regarding the individual bridge device drivers, check their manual pages: snd_ad1816(4), snd_als4000(4), snd_atiixp(4), snd_audiocs(4), snd_cmi(4), snd_cs4281(4), snd_csa(4), snd_ds1(4), snd_emu10k1(4), snd_emu10kx(4), snd_envy24(4), snd_envy24ht(4), snd_es137x(4), snd_ess(4), snd_fm801(4), snd_gusc(4), snd_hda(4), snd_ich(4), snd_maestro(4), snd_maestro3(4), snd_mss(4), snd_neomagic(4), snd_sbc(4), snd_solo(4), snd_spicds(4), snd_t4dwave(4), snd_uaudio(4), snd_via8233(4), snd_via82c686(4) and snd_vibes(4).
The FreeBSD Handbook
The official FreeBSD handbook contains a dedicated section for setting up and configuring your sound card in FreeBSD. It is not always up-to-date, but most of the information available in the handbook should be correct. It is also aimed at the latest STABLE release, so information available in this wiki page and in the handbook might not always be 100% synchronized.
Other
The FreeBSD multimedia mailing list - Dedicated FreeBSD mailing list for multimedia and audio support. Bugs and similar stuff goes here.
Multimedia Forum at The FreeBSD Forums - The FreeBSD Project runs a web based forum available for anyone to join. The multimedia subforum is a good place to discuss sound issues. In order to search the archive you need to register first.
Bridge Device Drivers
How it works
A few words on what the bridge device driver are and what they do...
Notes
Documentation on individual drivers, if necessary...
snd_emu10kx
This driver now has the possibility to do multichannel recording. This is not for official use, it is only to be able to play around and develop this further until the generic parts of the soundsystem gain the possibility to handle multichannel streams.
Optional multichannel recording (32 channels on Live!, 64 channels on Audigy)
All channels are 16bit/48000Hz/mono, format is fixed. Half of them are copied from sound output, another half can be used to record any data from DSP. What should be recorded is hardcoded in DSP code. In this version it records dummy data, but can be used to record all DSP inputs, for example.
Because there are no support of more-than-stereo sound streams multichannell stream is presented as one 32(64)*48000 Hz 16bit mono stream.
Channel map
SB Live! (4.0/5.1):
offset (words) |
substream |
0x00 |
Front L |
0x01 |
Front R |
0x02 |
Digital Front L |
0x03 |
Digital Front R |
0x04 |
Digital Center |
0x05 |
Digital Sub |
0x06 |
Headphones L |
0x07 |
Headphones R |
0x08 |
Rear L |
0x09 |
Rear R |
0x0A |
ADC (multi-rate recording) L |
0x0B |
ADC (multi-rate recording) R |
0x0C |
unused |
0x0D |
unused |
0x0E |
unused |
0x0F |
unused |
0x10 |
Analog Center (Live! 5.1) / dummy (Live! 4.0) |
0x11 |
Analog Sub (Live! 5.1) / dummy (Live! 4.0) |
0x12..-0x1F |
dummy |
Audigy / Audigy 2 / Audigy 2 Value / Audigy 4:
offset (words) |
substream |
0x00 |
Digital Front L |
0x01 |
Digital Front R |
0x02 |
Digital Center |
0x03 |
Digital Sub |
0x04 |
Digital Side L (7.1 cards) / Headphones L (5.1 cards) |
0x05 |
Digital Side R (7.1 cards) / Headphones R (5.1 cards) |
0x06 |
Digital Rear L |
0x07 |
Digital Rear R |
0x08 |
Front L |
0x09 |
Front R |
0x0A |
Center |
0x0B |
Sub |
0x0C |
Side L |
0x0D |
Side R |
0x0E |
Rear L |
0x0F |
Rear R |
0x10 |
output to AC97 input L (muted) |
0x11 |
output to AC97 input R (muted) |
0x12 |
unused |
0x13 |
unused |
0x14 |
unused |
0x15 |
unused |
0x16 |
ADC (multi-rate recording) L |
0x17 |
ADC (multi-rate recording) R |
0x18 |
unused |
0x19 |
unused |
0x1A |
unused |
0x1B |
unused |
0x1C |
unused |
0x1D |
unused |
0x1E |
unused |
0x1F |
unused |
0x20..0x3F |
dummy |
snd_envy24*
Envy24-based cards are the only consumer soundcards to far, that can offer true quality. They are 'bit-perfect' (no resampling) and use high-quality I2S codecs. That is why most of them -- even not professional grade ones -- have quality and features of professional boards.
Konstantin Dimitrov is the only person that is working on the Envy24 support under FreeBSD and his free time for that is very limited, so it will be extremely slow and when you look at http://envy24.svobodno.com, in the table, you will see how much work should be done (and the table is far from being full). For example there is no code at all for DITs (Digital Interface Transceivers) and if someone write module for DITs, like 'spicds' module, it can be reused by many audio drivers, for example Creative. At least on their new boards they use the same DIT ICs like the ones on Envy24-based boards, so the work exceeds far beyond dealing with Envy24 chips. Any help by owners of Envy24 based cards is more than welcome.
From an user point of view the behavior of snd_envy24(4) and snd_envy24ht(4) (and snd_spicds(4)) is stable enough, however they are highly experimental drivers and need a serious clean-up.
Currently Konstantin is working on adding support for all chips from the VT172x family and more hardware designs. Compared to extending the existing features, this is a huge amount of work. Every Envy24-based card has an unique hardware design. For this reason adding support for an Envy24-based card requires as a first step to reverse engineer the card hardware design. This step takes a huge part of the time to support a card.
The Envy24HT (VT1724) code initially intended for use with the Envy24HT-based card "Terratec Aureon 7.1 Space" actually proved itself to work with all other VT172x chips -- Envy24PT (VT1720), Envy24MT (VT1720T), Envy24HT-S (VT1721), Envy24GT (VT1722) and Envy24DT (VT1723 aka Tremor) -- with minor or no Envy24-related changes at all. This will affect the future of snd_envy24ht(4) and it may be renamed to "snd_vt172x(4)".
Support for cards that use I2C-to-GPIO expanders wired between the control line of the codec and the Envy24 chip is upcomming. This will affect snd_envy24(4). At the moment snd_envy24(4) supports only 3 cards. The work Konstantin is doing ATM may result in support for all VT1712-based cards made by Terratec and M-Audio. Probably then snd_envy24(4) will support about 10 cards then.
snd_envy24ht(4) already has support for more than 10 cards, including all cards made by Terratec and M-Audio that are based on VT172x. Support for cards that are made by the third major manufacturer of Envy24-based cards -- ESI and their consumer division Audiotrak -- is lacking because their cards are hard to find outside Korea and Japan. Konstantin thinks they made the best Envy24-based cards out there. So if you are willing to spend such a card, feel free to him/us.
The next update to snd_envy24ht(4) will maybe support the "Philips PSC724 Ultimate Edge", "Hercules Fortissimo4" and the very new "Audiotrak Prodigy 7.1 HiFi". They all are VT172x-based cards which use the WM8766+WM8776 chips and share the same hardware design.
All of this work to support all chips from the VT172x family and all possible hardware designs takes a huge amount of work and only covers the analog playback. Other features like recording, support for all hardware mixers, MIDI and all other features the envy24 chips provide are not implemented. Adding one of those features after each other -- at least for those chips where Konstantin collected the datasheets -- should be easy. It is not that time consuming, but Konstantin can not spend time for them. Anyone interested in some of those features is encouraged to have a look at the datasheets and to send some patches.
Driver Matrix
Name |
Manual Page |
License |
Type |
Arch |
Maintainer |
snd_ad1816 |
BSD |
isa |
|
|
|
snd_ai2s |
BSD |
macio |
powerpc |
||
snd_als4000 |
BSD |
pci |
|
|
|
snd_atiixp |
BSD |
pci |
|
||
snd_audiocs |
BSD |
sbus |
sparc64 |
|
|
snd_aureal |
BSD |
pci |
|
|
|
snd_cmi |
BSD |
pci |
|
|
|
snd_cs4281 |
BSD |
pci |
|
|
|
snd_csa |
BSD + GPL |
pci |
|
|
|
snd_csapcm |
BSD + GPL |
pci |
|
|
|
snd_davbus |
BSD |
macio |
powerpc |
||
snd_ds1 |
BSD? |
pci |
|
|
|
snd_emu10k1 |
BSD + GPL |
pci |
|
|
|
snd_emu10kx |
BSD + GPL |
pci |
|
||
snd_envy24 |
BSD |
pci |
|
||
snd_envy24ht |
BSD |
pci |
|
||
snd_es137x |
BSD |
pci |
|
|
|
snd_ess |
BSD |
isa |
|
|
|
snd_fm801 |
BSD |
pci |
|
|
|
snd_gusc |
BSD |
isa |
|
|
|
snd_hda |
BSD |
pci |
|
||
snd_ich |
BSD |
pci |
|
|
|
snd_maestro |
BSD |
pci |
|
|
|
snd_maestro3 |
BSD + GPL |
pci |
|
|
|
snd_mss |
BSD |
isa |
|
|
|
snd_neomagic |
BSD |
pci |
|
|
|
snd_sb16 |
BSD |
isa |
|
|
|
snd_sb8 |
BSD |
isa |
|
|
|
snd_sbc |
BSD |
isa |
|
|
|
snd_solo |
BSD |
pci |
|
|
|
snd_spicds |
BSD |
pci |
|
||
snd_t4dwave |
BSD |
pci |
|
|
|
snd_via8233 |
BSD |
pci |
|
|
|
snd_via82c686 |
BSD |
pci |
|
|
|
snd_uaudio |
BSD |
usb |
|
|
Development
Roadmap for FreeBSD 9.0
Open Tasks & Projects
- Add Multichannel support to sound drivers. Multichannel support is already present in the sound system, so implementing it in the drivers should be trivial.
- Find out if there are things to port from OSS.
- Contact GPL license holders and ask for permission to re-license to BSD, alternatively port the missing stuff from OSS.
Subversion layout
Where the code is...
Resources
Development resources and links to interesting stuff...
- FreeBSD
- Other
Open Problem Reports
The FreeBSD bug database always has something waiting for you to work on. Anyone is encouraged to take a look at the following problem reports and fix them, if possible. If something looks odd in the problem report or if you think that the problem has been fixed, add a note with your thoughts to the problem report.
List of open problem reports affecting the sound code in FreeBSD:
Critical problems
- No problems at the moment
Serious problems
kern/63204 - [sound] /dev/mixer broken with ESS Maestro-2E (still on 5.4)
usb/75797 - [sound] [regression] 5.3-STABLE(2005 1/4) detect USB headset, But can not found play channel
kern/79905 - [sound] sis7018 sound module problem
kern/79912 - [sound] sound broken for 2 VIA chipsets: interrupt storm
usb/80040 - [sound] [hang] Use of sound mixer causes system freeze with uaudio driver
kern/81146 - [sound] Sound isn't working AT ALL for Sis7012 onboard AC97 audio chipset with snd_ich
kern/82043 - [sound] snd_emu10k1 - mixer does not work.
kern/90837 - [sound] PCM - ICH6 - device is busy, but old process doesn't exist anymore
kern/94279 - [sound] [snd_neomagic] snd_neomagic crashes on FreeBSD 5.4 and 6.0
kern/96538 - [sound] emu10k1-driver inverts channels
kern/97535 - [sound] [snd_mss] doesn't work in 6.0-RELEASE and above for Crystal soundcards
kern/98167 - [sound] [es137x] [patch] ES1370 mixer volumes incorrectly calculated
kern/98752 - [sound] Intel ich6 82801 FB - on Packard Bell A8810 laptop, no sound
kern/104626 - [sound] FreeBSD 6.2 does not support SoundBlaster Audigy SE
kern/104874 - [sound] [snd_emu10k1] kldload snd_emu10k1 hangs system
kern/107051 - [sound] only 2 channels output works for the ALC850 (on nForce 4) sound chipset
kern/107516 - [sound] [snd_emu10k1] - skips, clicks and lag after a day of heavy usage
kern/114760 - [sound] [snd_cmi] snd_cmi driver causing sporadic system hangs
kern/115666 - [sound] Microphone does not work
kern/119759 - [sound] [snd_emu10k1] [regression] Can not record anything with emu10k1 on 7.0-PRERELEASE (Invalid argument)
kern/121156 - [sound] [patch] Turn on inverted external amplifier sense flags for Gateway GZ3520/M210
kern/122086 - [sound] maestro sound driver is working, but mixer initialisation faild - no sound
kern/124319 - [sound] [snd_emu10k1] [regression] Cannot record from second card when two cards are in system
kern/132848 - [sound] [snd_emu10kx] driver problem with card init, snd_emu10k1 inits card correctly
Non-critical problems
kern/23546 - [sound] [snd_csa] [patch] csa DMA-interrupt problem
kern/37600 - [sound] [partial patch] t4dwave drive doesn't record.
kern/60677 - [sound] [patch] No reaction of volume controy key on IBM Thinkpad i1124
bin/62077 - [sound] [patch] Make it possible to abbreviate mixer(8) device names
kern/72995 - [sound] Intel ICH2 (82801BA) - sound nearly inaudible
conf/75137 - [sound] add snd_* modules support to /etc/rc.d/mixer
kern/79678 - [sound] sound works except recording from any source
kern/80632 - [sound] pcm driver missing support for CMI8738 auxillary input
kern/83697 - [sound] [snd_mss] [patch] support, docs added for full-duplex, input mixer CS4236B mss driver
kern/87782 - [sound] snd_t4dwave and pcm0:record:0: record interrupt timeout, channel dead
kern/92512 - [sound] distorted mono output with emu10k1
kern/93986 - [sound] Acer TravelMate 4652LMi pcm0 channel dead
kern/95086 - [sound] uaudio line in problem with sbdm lx
kern/97609 - [sound] Load Sound Module - VIA8233 - fails
kern/98496 - [sound] [snd_ich] some functions don't work in my sound kernel module
kern/98504 - [sound] Sound is distorted with SB Live 5.1
kern/100859 - [sound] [snd_ich] snd_ich broken on GIGABYTE 915 system
kern/101417 - [sound] 4-speakers output not possible on Asus A8V-Deluxe
kern/111767 - [sound] ATI SB450 High Definition Audio Controller sound card doesn't work
kern/113950 - [sound] [patch] [request] add per-vchan mixer support
kern/115300 - [sound] [snd_hda] [regression] snd_hda(4) fails to attach on -CURRENT
kern/119931 - [sound] No sound card detected on ASUS "K8V-X SE R2.00"
kern/119973 - [sound] [snd_maestro] [regression] snd_maestro only works after reload
kern/120780 - [sound] [snd_hda] snd_hda doesn't work on Dell Latitutude D530
kern/120857 - [sound] [snd_emu10k1] snd_emu10k1 driver issues a warning on unload
kern/121962 - [sound] [snd_emu10k1] [panic] Kernel panics with device polling and snd_emu10k1.ko enabled and network load
kern/125756 - [sound] [patch] cannot detect soft-modem on HDA bus
kern/129604 - [sound] Sound stops with error: pcm0:virtual:dsp0.vp0: play interrupt timeout, channel dead
kern/132336 - [sound] [snd_hda] Realtek ALC888 audio chipset does not work with snd_hda driver.
kern/132511 - [sound] [snd_hda] Probing ALC888 codec on ASRock K10N78-1394 fails
powerpc/133503 - [sound] Sound stutter after switching ttys
kern/134767 - [sound] [snd_hda] [regression] Sigmatel STAC9205X no sound under RELENG_7_2_0_RELEASE
Reporting Bugs
If you have found a bug, make sure that you report it. There are two preferred ways to report bugs and problems concerning the FreeBSD sound system: Either use the web interface for the send-pr utility to send in a bug report. This way it gets archived in the FreeBSD bug database. The second way is to send it directly to the FreeBSD multimedia mailing list.
The FreeBSD sound system can spit out quite a lot of debug information if you know how to access it. This is a list of things that you probably should include in a good bug report.
What version of FreeBSD are we running:
# uname -a FreeBSD foo.bar.com 8.0-BETA2 FreeBSD 8.0-BETA2 #0 r195896: Sun Jul 26 23:46:02 CEST 2009 root@foo.bar.com:/usr/obj/usr/src/sys/GENERIC i386
Status of the sound module:
# cat /dev/sndstat FreeBSD Audio Driver (newpcm: 32bit 2009061500/i386) Installed devices: pcm0: <AudioPCI ES1371-A> at io 0x2040 irq 16 kld snd_es137x [MPSAFE] (2p:1v/1r:1v channels duplex default)
Mixer values:
# mixer Mixer vol is currently set to 75:75 Mixer pcm is currently set to 75:75 Mixer line is currently set to 75:75 Mixer mic is currently set to 0:0 Mixer cd is currently set to 75:75 Mixer rec is currently set to 0:0 Mixer igain is currently set to 0:0 Mixer line1 is currently set to 75:75 Mixer phin is currently set to 0:0 Mixer video is currently set to 75:75 Recording source: mic
The hw.snd sysctl tree:
# sysctl hw.snd hw.snd.feeder_rate_quality: 1 hw.snd.feeder_rate_round: 25 hw.snd.feeder_rate_max: 2016000 hw.snd.feeder_rate_min: 1 hw.snd.feeder_rate_polyphase_max: 183040 hw.snd.feeder_rate_presets: 100:8:0.85 100:36:0.92 100:164:0.97 hw.snd.feeder_eq_exact_rate: 0 hw.snd.feeder_eq_presets: PEQ:16000,0,2500,62,0,2500:-9,9,1,0:44100,48000,88200,96000,176400,192000 hw.snd.vpc_reset: 0 hw.snd.vpc_0db: 45 hw.snd.vpc_autoreset: 1 hw.snd.latency_profile: 1 hw.snd.latency: 5 hw.snd.report_soft_matrix: 1 hw.snd.report_soft_formats: 1 hw.snd.compat_linux_mmap: 0 hw.snd.vpc_mixer_bypass: 1 hw.snd.verbose: 1 hw.snd.maxautovchans: 16 hw.snd.default_unit: 0 hw.snd.version: 2009061500/i386 hw.snd.default_auto: 0
The dev.pcm sysctl tree:
# sysctl dev.pcm dev.pcm.0.%desc: AudioPCI ES1371-A dev.pcm.0.%driver: pcm dev.pcm.0.%location: slot=2 function=0 handle=\_SB_.PCI0.P2P0.S3F0 dev.pcm.0.%pnpinfo: vendor=0x1274 device=0x1371 subvendor=0x1274 subdevice=0x1371 class=0x040100 dev.pcm.0.%parent: pci2 dev.pcm.0.play.vchans: 1 dev.pcm.0.play.vchanmode: fixed dev.pcm.0.play.vchanrate: 48000 dev.pcm.0.play.vchanformat: s16le:2.0 dev.pcm.0.rec.vchans: 1 dev.pcm.0.rec.vchanmode: fixed dev.pcm.0.rec.vchanrate: 48000 dev.pcm.0.rec.vchanformat: s16le:2.0 dev.pcm.0.buffersize: 4096 dev.pcm.0.bitperfect: 0 dev.pcm.0.latency_timer: 64 dev.pcm.0.polling: 0 dev.pcm.0.wake: 0
Verbose boot. First, reboot your machine. When the startup menu appear, choose option number 5 to boot with verbose messages turned on. When the machine has booted, use the grep utility to find startup messages related to the sound system:
# dmesg | grep 'pcm[0-9]' pcm0: <AudioPCI ES1371-A> port 0x2040-0x207f irq 16 at device 2.0 on pci2 pcm0: Reserved 0x40 bytes for rid 0x10 type 4 at 0x2040 pcm0: <Cirrus Logic CS4297A AC97 Codec (id = 0x43525913)> pcm0: Codec features 6 bit master volume, no 3D Stereo Enhancement pcm0: ac97 codec dac ready count: 0 pcm0: Mixer "vol": pcm0: Mixer "pcm": pcm0: Mixer "line": pcm0: Mixer "mic": pcm0: Mixer "cd": pcm0: Mixer "rec": pcm0: Mixer "igain": pcm0: Mixer "line1": pcm0: Mixer "phin": pcm0: Mixer "video": pcm0: [MPSAFE] pcm0: [ITHREAD] pcm0: clone manager: deadline=750ms flags=0x8000001e pcm0: sndbuf_setmap 1f3c000, 1000; 0xc473c000 -> 1f3c000 pcm0: sndbuf_setmap 1f3e000, 1000; 0xc473e000 -> 1f3e000 pcm0: sndbuf_setmap 1f40000, 1000; 0xc4740000 -> 1f40000 pcm0: <Playback: DAC1,DAC2 / Record: ADC>
Common Problems
Something goes here...