home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / HOWTO / SOUND-HO < prev    next >
Encoding:
Text File  |  1995-04-20  |  39.8 KB  |  1,212 lines

  1.   The Linux Sound HOWTO
  2.   Jeff Tranter, Jeff_Tranter@Mitel.COM
  3.   v1.10, 3 December 1994
  4.  
  5.   This document describes sound support for Linux. It lists the sup-
  6.   ported sound hardware, describes how to configure the kernel drivers,
  7.   and answers frequently asked questions. The intent is to bring new
  8.   users up to speed more quickly and reduce the amount of traffic in the
  9.   usenet news groups.
  10.  
  11.   1.  Introduction
  12.  
  13.  
  14.   This is the Linux Sound HOWTO document. It is intended as a quick
  15.   reference covering everything you need to know to install and
  16.   configure sound support under Linux. Frequently asked questions about
  17.   sound under Linux are answered, and references are given to some other
  18.   sources of information on a variety of topics related to computer
  19.   generated sound and music.
  20.  
  21.   The scope is limited to the aspects of sound cards pertaining to
  22.   Linux. See the other documents listed in the Other Sources of
  23.   Information section for more general information on sound cards and
  24.   computer sound and music generation.
  25.  
  26.  
  27.   1.1.  Acknowledgments
  28.  
  29.  
  30.   Much of this information came from the Readme files provided with the
  31.   sound driver source code, by Hannu Savolainen (hannu@voxware.pp.fi).
  32.   Thanks go to Hannu and the many other people who developed the Linux
  33.   kernel sound drivers and utilities.
  34.  
  35.   Thanks to the Linuxdoc-SGML package, this HOWTO is now available in
  36.   several formats, including HTML hypertext (Mosaic), PostScript, and
  37.   plain ASCII, all generated from a common source file.
  38.  
  39.  
  40.   1.2.  Revision History
  41.  
  42.  
  43.  
  44.      Version 1.1
  45.         first version; posted to SOUND channel of Linux activists
  46.         mailing list only
  47.  
  48.      Version 1.2
  49.         minor updates; first version available on archive sites
  50.  
  51.      Version 1.3
  52.         converted to SGML; now available in several formats using Matt
  53.         Welsh's Linuxdoc-SGML tools; appearance changed due to new
  54.         format, only minor changes to content
  55.  
  56.      Version 1.4
  57.         minor tweaking of SGML; added answer on PAS16 and Adaptec1542A
  58.         SCSI adaptor incompatibilities
  59.  
  60.      Version 1.5
  61.         2.5a sound driver is now in 1.1 kernel distribution; note on
  62.         GUS-MAX support; other minor updates
  63.  
  64.      Version 1.6
  65.         added info on "no space on device" error; added note that
  66.         Hacker's Guide is in a "hidden" directory; added question on
  67.         bidirectional mode; info on "device busy" errors; other minor
  68.         changes
  69.  
  70.      Version 1.7
  71.         added info on ASP and AWE32; VoxWare 2.9 is available; answer to
  72.         question on using IRQ2; references to Sound and SCSI HOWTOs
  73.  
  74.      Version 1.8
  75.         added question on errors under DOS; many minor things updated to
  76.         match the version 2.90 sound driver; info on DOOM; answer on
  77.         reducing noise
  78.  
  79.      Version 1.9
  80.         questions on recording and clone cards
  81.  
  82.      Version 1.10
  83.         mentioned that HOWTO is available on WWW, as printed copies, and
  84.         translations; info on DMA conflict with QIC tape driver; info on
  85.         Sound Galaxy NX Pro and Logitech BusMouse
  86.  
  87.  
  88.   1.3.  New versions of this document
  89.  
  90.  
  91.   New versions of this document will be periodically posted to
  92.   comp.os.linux.announce. They will also be uploaded to various
  93.   anonymous ftp sites that archive such information including
  94.   sunsite.unc.edu:/pub/Linux/docs/HOWTO.
  95.  
  96.   Hypertext versions of this and other Linux HOWTOs are available on
  97.   many World-Wide-Web sites. You can also buy printed copies from
  98.   several vendors.
  99.  
  100.   If your native language is not English, you may be able to obtain a
  101.   translation of this document (French and Japanese translations are in
  102.   progress).
  103.  
  104.  
  105.   1.4.  Feedback
  106.  
  107.  
  108.   If you have any suggestions, corrections, or comments on the HOWTO,
  109.   please send them to the author and I will try to incorporate them in
  110.   the next release.
  111.  
  112.   If you have sound related problems that are not answered in this
  113.   HOWTO, feel free to send me a mail message and I will try to help.
  114.  
  115.  
  116.   1.5.  Other Sources of Information
  117.  
  118.  
  119.   The Linux Sound User's Guide covers all of the user visible aspects of
  120.   using sound under Linux in much more detail (approximately 40 pages).
  121.   If you are interested in sound under Linux you should definitely get
  122.   this document. The current version is ALPHA 0.1, and is available on
  123.   tsx-11.mit.edu in the directory /pub/linux/ALPHA/LDP. I will continue
  124.   to maintain the Sound-HOWTO as a concise guide for users who want to
  125.   get sound up and running, or just find out what is required, without
  126.   having to read the full user's guide.
  127.  
  128.   If you have a sound card that supports a CD-ROM or SCSI interface, the
  129.   Linux SCSI HOWTO and the Linux CD-ROM HOWTO have additional
  130.   information that may be useful to you.
  131.  
  132.  
  133.   Hannu Savolainen has written a draft version of the Hacker's Guide to
  134.   VoxWare. The latest version is draft 2, and can be found on
  135.   nic.funet.fi in /pub/OS/linux/ALPHA/sound.
  136.  
  137.   The following FAQs are regularly posted to the usenet newsgroup
  138.   news.announce as well as being archived at the site rtfm.mit.edu in
  139.   the directory /pub/usenet/news.answers:
  140.  
  141.  
  142.   PCsoundcards/generic-faq (Generic PC Soundcard FAQ)
  143.   PCsoundcards/soundcard-faq (comp.sys.ibm.pc.soundcard FAQ)
  144.   PCsoundcards/gravis-ultrasound/faq (Gravis UltraSound FAQ)
  145.   audio-fmts/part1 (Audio file format descriptions)
  146.   audio-fmts/part2 (Audio file format descriptions)
  147.  
  148.  
  149.  
  150.   The FAQs also list several product specific mailing lists and archive
  151.   sites. The following Usenet news groups discuss sound and/or music
  152.   related issues:
  153.  
  154.  
  155.   alt.binaries.sounds.* (various groups for posting sound files)
  156.   alt.binaries.multimedia (for posting Multimedia files)
  157.   alt.sb.programmer (Soundblaster programming topics)
  158.   comp.multimedia (Multimedia topics)
  159.   comp.music (Computer music theory and research)
  160.   comp.sys.ibm.pc.soundcard.* (various IBM PC soundcard groups)
  161.  
  162.  
  163.  
  164.   The Linux Activists mailing list has a SOUND channel. To find out how
  165.   to join the mailing list, send mail to linux-activists-
  166.   request@joker.cs.hut.fi.
  167.  
  168.   The files Readme, Readme.linux, and CHANGELOG included with the kernel
  169.   sound driver source code contain useful information about the sound
  170.   card drivers. These can typically be found in the directory
  171.   /usr/src/linux/drivers/sound.
  172.  
  173.   The Linux Software Map (LSM) is an invaluable reference for locating
  174.   Linux software. Searching the LSM for keywords such as sound is a good
  175.   way to identify applications related to sound hardware. The LSM can be
  176.   found on various anonymous FTP sites, including
  177.   sunsite.unc.edu:/pub/Linux/docs/LSM.gz.
  178.  
  179.  
  180.   1.6.  Version Information
  181.  
  182.  
  183.   At time of writing the latest Linux sound driver was version 2.90-2
  184.   and was included in the Linux kernel version 1.1.50 (and should be the
  185.   same in Linux 1.2.0). This is a pre-release version of the upcoming
  186.   version 3.0 driver which has a number of new features not in previous
  187.   versions, some of which are disabled. While version 2.90 appears to be
  188.   quite reliable, if you want a more stable driver you may prefer to use
  189.   the version 2.5a sound driver provided in kernel revisions 1.1.10
  190.   through 1.1.30.
  191.  
  192.   The author of the sound driver, Hannu Savolainen, typically also makes
  193.   available newer BETA releases of the sound driver as kernel patches
  194.   before they are included as part of the standard Linux kernel
  195.   distribution.
  196.  
  197.  
  198.  
  199.   2.  Supported Sound Hardware
  200.  
  201.   2.1.  Sound Cards
  202.  
  203.  
  204.   The following sound cards are supported by the Linux kernel:
  205.  
  206.  
  207.   o  Roland MPU-401 MIDI interface
  208.  
  209.   o  AdLib
  210.  
  211.   o  SoundBlaster (version 1 and 2) and compatibles, including
  212.      ThunderBoard and ATI Stereo F/X
  213.  
  214.   o  SoundBlaster Pro (version 1 and 2)
  215.  
  216.   o  Sound Galaxy NX Pro (in its compatibility mode with SoundBlaster
  217.      Pro 2.0 and support for its special mixer)
  218.  
  219.   o  SoundBlaster 16
  220.  
  221.   o  ProAudioSpectrum 16 (and the compatible Logitech SoundMan 16)
  222.  
  223.   o  Advanced Gravis UltraSound (GUS)
  224.  
  225.   o  GUS MAX (2.9 driver and later)
  226.  
  227.   o  Microsoft Sound System (2.9 driver and later)
  228.  
  229.   o  Personal Sound System (2.9 driver and later)
  230.  
  231.   Other sound cards that are claimed to be compatible with one of the
  232.   supported sound cards may work if they are hardware (i.e. register
  233.   level) compatible. Some cards described as "100% SoundBlaster
  234.   compatible" are not register compatible.
  235.  
  236.   The Sound Galaxy NX Pro is supported as a SoundBlaster compatible.
  237.   Answer "yes" to the question "Do you want support for the mixer of SG
  238.   NX Pro" when the sound driver is configured (in versions prior to 2.9
  239.   you must manually add #define __SGNXPRO__ to the sound driver local.h
  240.   file).
  241.  
  242.   Note that if you have a Sound Galaxy NX Pro and a Logitech Busmouse,
  243.   you must configure the card (using the SGPFIG utility on the driver
  244.   diskettes) to use base address 0x240 in order to operate your mouse.
  245.   The SGNXPRO has a Covox Speech Thing compatibility mode which has its
  246.   control register at the base+0x01C which is the Logitech Busmouse
  247.   control register address when the SGNXPRO base address is set to 0x220
  248.   (thanks to Matti Aarnio (mea@utu.fi) for this information).
  249.  
  250.   The Linux kernel supports the SCSI port provided on some sound cards
  251.   (e.g. ProAudioSpectrum 16). There is also support for CD-ROM drives
  252.   attached to the Soundblaster Pro and SoundBlaster 16 CD-ROM port (see
  253.   the file /usr/src/linux/drivers/block/README.sbpcd).
  254.  
  255.   A loadable kernel module to support joystick ports, including those
  256.   provided on some sound cards, is also available.
  257.  
  258.   Note that the kernel SCSI, CD-ROM, and sound drivers are completely
  259.   independent of each other.
  260.  
  261.  
  262.  
  263.  
  264.  
  265.   2.2.  PC Speaker
  266.  
  267.  
  268.   An alternate sound driver is available that requires no additional
  269.   sound hardware; it uses the internal PC speaker. It is mostly software
  270.   compatible with the sound card driver, but, as might be expected,
  271.   provides much lower quality output and has much more CPU overhead. The
  272.   results seem to vary, being dependent on the characteristics of the
  273.   individual loudspeaker. For more information, see the documentation
  274.   provided with the release.
  275.  
  276.   The current version is 0.7, and can be found at site sunsite.unc.edu
  277.   in the file /pub/Linux/kernel/patches/console/pcsndrv-0.7.tar.gz.
  278.  
  279.  
  280.   2.3.  Parallel Port
  281.  
  282.  
  283.   Another option is to build a digital to analog converter using a
  284.   parallel printer port. This provides better sound quality but still
  285.   has a lot of CPU overhead. The PC sound driver package mentioned above
  286.   supports this, and includes instructions for building the necessary
  287.   hardware.
  288.  
  289.  
  290.   3.  Configuring Linux for Sound Support
  291.  
  292.  
  293.   Configuring Linux to support sound involves the following steps:
  294.  
  295.  
  296.   1. Installing the sound card.
  297.  
  298.   2. Configuring and building the kernel for sound support.
  299.  
  300.   3. Creating the device files.
  301.  
  302.   4. Testing the installation.
  303.  
  304.  
  305.   3.1.  Installing the Sound Card
  306.  
  307.  
  308.   To install the card, follow the instructions provided by the
  309.   manufacturer. Be sure to note down the jumper settings for IRQ, DMA
  310.   channel, etc. If you are unsure, use the factory defaults. Try to
  311.   avoid conflicts with other devices (e.g. ethernet cards, SCSI host
  312.   adaptors, serial and parallel ports) if possible.
  313.  
  314.  
  315.   3.2.  Configuring the Kernel
  316.  
  317.  
  318.   If you are using a recent kernel (0.99pl14 or later), the sound
  319.   drivers are included with the kernel release. Follow the usual
  320.   procedure for building the kernel. When you run make config, a
  321.   configuration program will ask you what sound card options you want.
  322.   Carefully read the information displayed by this program.
  323.  
  324.   If you are upgrading from an older sound driver, make sure that the
  325.   files /usr/include/sys/soundcard.h and /usr/include/sys/ultrasound.h
  326.   are symbolic links to the corresponding files in /usr/include/linux,
  327.   or that they simply contain the lines #include <linux/soundcard.h> and
  328.   #include <linux/ultrasound.h>, respectively.
  329.  
  330.  
  331.   It's good idea to read the Readme files in the kernel drivers/sound
  332.   directory since there could be some last minute information. The file
  333.   CHANGELOG contains a list of enhancements and new features since the
  334.   previous version.
  335.  
  336.   Particularly with the 2.90 sound driver, read this documentation to be
  337.   aware of potential incompatibilities with the older versions of sound
  338.   drivers.
  339.  
  340.  
  341.   3.3.  Creating the Device Files
  342.  
  343.  
  344.   The first time the kernel sound driver is configured, you need to
  345.   create the sound device files. The easiest way to do this is to cut
  346.   the short shell script from the end of the file Readme.linux (or
  347.   possibly Readme) in the directory /usr/src/linux/drivers/sound, and
  348.   run it as root.
  349.  
  350.   If your device entries already exist, you might want to ensure they
  351.   are correct, e.g. /dev/audio should have major and minor device
  352.   numbers 14 and 4. If they are not, or if you are in doubt, run the
  353.   above script and it will replace any existing entries with correct
  354.   ones.
  355.  
  356.   Some older Linux distributions provided install scripts which created
  357.   incorrect sound device files. You may also have a /dev/MAKEDEV script
  358.   for creating device files. Using the script included with the kernel
  359.   sound driver is preferred since it should always be up to date with
  360.   the latest supported sound devices.
  361.  
  362.  
  363.   3.4.  Testing the Installation
  364.  
  365.  
  366.   You can now follow these steps to verify the sound hardware and
  367.   software:
  368.  
  369.   1. Reboot with the new kernel.
  370.  
  371.   Follow your usual procedure for installing and rebooting the new
  372.   kernel (keep the old kernel around in case of problems, of course).
  373.  
  374.   2. Verify that the sound card is recognized during kernel
  375.   initialization.
  376.  
  377.   Check for a message such as the following on powerup (if they scroll
  378.   by too quickly to read, you may be able to retrieve them with the
  379.   "dmesg" command):
  380.  
  381.  
  382.  
  383.        ______________________________________________________________________
  384.        snd2 <SoundBlaster Pro 3.2> at 0x220 irq 5 drq 1
  385.        snd1 <Yamaha OPL-3 FM> at 0x388 irq 0 drq 0
  386.        ______________________________________________________________________
  387.  
  388.  
  389.  
  390.  
  391.   This should match your sound card type and jumper settings.
  392.  
  393.   The driver may also display some error messages and warnings during
  394.   boot. Watch for these when booting the first time after configuring
  395.   the sound driver.
  396.  
  397.   If no sound card is detected when booting, here are some possible
  398.   reasons:
  399.  
  400.  
  401.   o  the configuration of the driver is incorrect and the driver was not
  402.      able to detect your card in the given I/O address
  403.  
  404.   o  the sound driver was configured to be inactive or you booted with
  405.      an old kernel (a common error).
  406.  
  407.   3. Check the device file /dev/sndstat.
  408.  
  409.   Reading the sound driver status device file should provide additional
  410.   information on whether the sound card driver initialized properly.
  411.   Sample output should look something like this:
  412.  
  413.  
  414.  
  415.        ______________________________________________________________________
  416.        % cat /dev/sndstat
  417.  
  418.        Sound Driver:2.90-2 (Fri Aug 26 20:08:45 EDT 1994 root@fizzbin.ca)
  419.        Config options: 31402
  420.  
  421.        Installed drivers:
  422.        Type 1: OPL-2/OPL-3 FM
  423.        Type 2: SoundBlaster
  424.  
  425.        Card config:
  426.        SoundBlaster at 0x220 irq 5 drq 1
  427.        OPL-2/OPL-3 FM at 0x388 irq 0 drq 0
  428.  
  429.        PCM devices:
  430.        0: SoundBlaster Pro 3.2
  431.  
  432.        Synth devices:
  433.        0: Yamaha OPL-3
  434.  
  435.        Midi devices:
  436.  
  437.        MIDI Timers:
  438.        0: System Timer
  439.  
  440.        1 mixer(s) installed
  441.        ______________________________________________________________________
  442.  
  443.  
  444.  
  445.  
  446.   If the cat command displays "No such device", the sound driver is not
  447.   active in the kernel. Make sure that you booted with the newly
  448.   compiled kernel.
  449.  
  450.   If the output contains no devices (PCM, Synth or MIDI), your soundcard
  451.   was not detected. Verify that the "HW config" section contains correct
  452.   information.
  453.  
  454.   4. Play a simple sound file.
  455.  
  456.   Get hold of a sample sound file, and send it to the sound device as a
  457.   basic check of sound output, e.g.
  458.  
  459.  
  460.  
  461.  
  462.  
  463.   ______________________________________________________________________
  464.   % cat endoftheworld >/dev/dsp
  465.   % cat crash.au >/dev/audio
  466.   ______________________________________________________________________
  467.  
  468.  
  469.  
  470.  
  471.   (Make sure you don't omit the ">" in the commands above).
  472.  
  473.   Some sample sound files can be obtained from the file snd-
  474.   data-0.1.tar.Z.
  475.  
  476.   5. Verify sound recording.
  477.  
  478.   If you have sound input capability, you can do a quick test of this
  479.   using commands such as the following:
  480.  
  481.  
  482.  
  483.        ______________________________________________________________________
  484.        # record 4 seconds of audio from microphone
  485.        % dd bs=8k count=4 </dev/audio >sample.au
  486.        # play back sound
  487.        % cat sample.au >/dev/audio
  488.        ______________________________________________________________________
  489.  
  490.  
  491.  
  492.  
  493.   If these tests pass, you can be reasonably confident that the sound
  494.   hardware and software are working. If you experience problems, read
  495.   the FAQ section of this document.
  496.  
  497.  
  498.   4.  Applications Supporting Sound
  499.  
  500.  
  501.   Because The Linux Sound User's Guide describes the available Linux
  502.   applications in detail, I will only give here a sample of the types of
  503.   applications that you likely want if you have a sound card under
  504.   Linux.
  505.  
  506.   As a minimum, you will likely want to obtain the following sound
  507.   applications:
  508.  
  509.  
  510.   o  audio file format conversion utility (e.g. Sox)
  511.  
  512.   o  mixer utility (e.g. aumix or xmix)
  513.  
  514.   o  digitized file player/recorder (e.g. play or wavplay)
  515.  
  516.   o  MOD file player (e.g. tracker)
  517.  
  518.   o  MIDI file player (e.g. mp)
  519.  
  520.   There are text-based as well as GUI-based versions of most of these
  521.   tools. There are also some more esoteric applications (e.g. speech
  522.   synthesis) that you may wish to try.
  523.  
  524.  
  525.   5.  Answers To Frequently Asked Questions
  526.  
  527.  
  528.  
  529.   This section answers some of the questions that have been commonly
  530.   asked on the Usenet news groups and mailing lists.
  531.  
  532.  
  533.   5.1.  What are the various sound device files?
  534.  
  535.  
  536.   These are the most "standard" device file names, some Linux
  537.   distributions may use slightly different names.
  538.  
  539.  
  540.      /dev/audio
  541.         Sun workstation compatible audio device (only a partial
  542.         implementation, does not support Sun ioctl interface, just u-law
  543.         encoding)
  544.  
  545.      /dev/dsp
  546.         digital sampling device
  547.  
  548.      /dev/mixer
  549.         sound mixer
  550.  
  551.      /dev/mixer1
  552.         second sound mixer
  553.  
  554.      /dev/patmgr0
  555.         Patch Manager (not implemented)
  556.  
  557.      /dev/patmgr1
  558.         Patch Manager (not implemented)
  559.  
  560.      /dev/sequencer
  561.         low level MIDI, FM, and GUS access
  562.  
  563.      /dev/sequencer2
  564.         high level sequencer interface (partially implemented)
  565.  
  566.      /dev/midi00
  567.         1st raw MIDI port
  568.  
  569.      /dev/midi01
  570.         2nd raw MIDI port
  571.  
  572.      /dev/midi02
  573.         3rd raw MIDI port
  574.  
  575.      /dev/midi03
  576.         4th raw MIDI port
  577.  
  578.      /dev/sndstat
  579.         displays sound driver status when read
  580.  
  581.      /dev/audio1
  582.         for second sound card
  583.  
  584.      /dev/dsp1
  585.         for second sound card
  586.  
  587.   The PC speaker driver provides the following devices:
  588.  
  589.  
  590.      /dev/pcaudio
  591.         equivalent to /dev/audio
  592.  
  593.      /dev/pcsp
  594.         equivalent to /dev/dsp
  595.      /dev/pcmixer
  596.         equivalent to /dev/mixer
  597.  
  598.  
  599.   5.2.  How can I play a sound sample?
  600.  
  601.  
  602.   Sun workstation (.au) sound files can be played by sending them to the
  603.   /dev/audio device. Raw samples can be sent to /dev/dsp. Using a
  604.   program such as play is preferable, as it will recognize most file
  605.   types and set the sound card to the correct sampling rate, etc.
  606.  
  607.  
  608.   5.3.  How can I record a sample?
  609.  
  610.  
  611.   Reading /dev/audio or /dev/dsp will return sampled data that can be
  612.   redirected to a file. A program such as vrec makes it easier to
  613.   control the sampling rate, duration, etc. You may also need a mixer
  614.   program to select the appropriate input device.
  615.  
  616.  
  617.   5.4.  Can I have more than one sound card?
  618.  
  619.  
  620.   Up to two sound cards is supported. It's possible to install a Gravis
  621.   UltraSound or MPU-401 with a SoundBlaster, SoundBlaster Pro,
  622.   SoundBlaster16 or ProAudioSpectrum16. It's not possible to have a
  623.   ProAudioSpectrum16 and SoundBlaster at the same time (the PAS16 has an
  624.   SB emulator in it). It's also not possible to have more than one card
  625.   of the same type at the same time -- for example, a GUS + GUS
  626.   combination is not possible.
  627.  
  628.   You can change the sound card configuration parameters at boot time
  629.   using command line options from a boot loader such as LILO. See the
  630.   kernel sound driver file Readme.linux for details.
  631.  
  632.  
  633.   5.5.  Error: No such file or directory for sound devices
  634.  
  635.  
  636.   You need to create the sound driver device files. See the section on
  637.   creating device files. If you do have the device files, ensure that
  638.   they have the correct major and minor device numbers (some older CD-
  639.   ROM distributions of Linux may not create the correct device files
  640.   during installation).
  641.  
  642.  
  643.   5.6.  Error: No such device for sound devices
  644.  
  645.  
  646.   You have not booted with a kernel containing the sound driver or the
  647.   I/O address configuration doesn't match your hardware. Check that you
  648.   are running the newly compiled kernel and verify that the settings
  649.   entered when configuring the sound driver match your hardware setup.
  650.  
  651.  
  652.   5.7.  Error: No space left on device for sound devices
  653.  
  654.  
  655.   This can happen if you tried to record data to /dev/audio or /dev/dsp
  656.   without creating the necessary device file. The sound device is now a
  657.   regular file, and has filled up your disk partition. You need to run
  658.   the script described in the Creating the Device Files section of this
  659.   document.
  660.  
  661.   5.8.  Error: device busy for sound devices
  662.  
  663.  
  664.   Only one process can open a given sound device at one time. Most
  665.   likely some other process is using the device in question. One way to
  666.   determine this is to use the fuser command:
  667.  
  668.  
  669.  
  670.        ______________________________________________________________________
  671.        % fuser -v /dev/dsp
  672.        /dev/dsp:             USER       PID ACCESS COMMAND
  673.                              tranter    265 f....  tracker
  674.        ______________________________________________________________________
  675.  
  676.  
  677.  
  678.  
  679.   In the above example, the fuser command showed that process 265 had
  680.   the device open. Waiting for the process to complete or killing it
  681.   will allow the sound device to be accessed once again.
  682.  
  683.  
  684.   5.9.  I still get device busy errors!
  685.  
  686.  
  687.   According to Brian Gough, for the SoundBlaster cards which use DMA
  688.   channel 1 there is a potential conflict with the QIC-02 tape driver,
  689.   which also uses DMA 1, causing "device busy" errors. If you are using
  690.   FTAPE, you may have this driver enabled. According to the FTAPE-HOWTO
  691.   the QIC-02 driver is not essential for the use of FTAPE; only the
  692.   QIC-117 driver is required. Reconfiguring the kernel to use QIC-117
  693.   but not QIC-02 allows FTAPE and the sound-driver to coexist.
  694.  
  695.   (the following explanation was supplied by Harald Albrecht
  696.   albrecht@igpm.rwth-aachen.de)
  697.  
  698.   Some soundcards support using DMA channel 0. The sound driver
  699.   configuration program allows this, and the kernel compiles properly,
  700.   but accessing the sound device results in a "device busy" error
  701.   message.
  702.  
  703.   The reason is that the Linux kernel reserves DMA channel 0 for DRAM
  704.   refresh. This is no longer true for modern 386/486 boards which use
  705.   their own refresh logic. You can correct it by changing this line in
  706.   the file /usr/src/linux/kernel/dma.c:
  707.  
  708.  
  709.  
  710.        ______________________________________________________________________
  711.        static volatile unsigned int dma_chan_busy[MAX_DMA_CHANNELS] = {
  712.                        1, 0, 0, 0, 1, 0, 0, 0
  713.        };
  714.        ______________________________________________________________________
  715.  
  716.  
  717.  
  718.  
  719.   Replace the first 1 with a 0; this enables DMA channel 0. Don't do the
  720.   same with DMA channel 4 as this is cascade and won't work! The code
  721.   should now look like this:
  722.  
  723.  
  724.  
  725.  
  726.  
  727.   ______________________________________________________________________
  728.   static volatile unsigned int dma_chan_busy[MAX_DMA_CHANNELS] = {
  729.                   0, 0, 0, 0, 1, 0, 0, 0
  730.   };
  731.   ______________________________________________________________________
  732.  
  733.  
  734.  
  735.  
  736.   Recompile and reboot with the new kernel.
  737.  
  738.  
  739.   5.10.  Partial playback of digitized sound file
  740.  
  741.  
  742.   The symptom is usually that a sound sample plays for about a second
  743.   and then stops completely or reports an error message about "missing
  744.   IRQ" or "DMA timeout". Most likely you have incorrect IRQ or DMA
  745.   channel settings. Verify that the kernel configuration matches the
  746.   sound card jumper settings and that they do not conflict with some
  747.   other card.
  748.  
  749.   Another symptom is sound samples that "loop". This is usually caused
  750.   by an IRQ conflict.
  751.  
  752.  
  753.   5.11.  There are pauses when playing MOD files
  754.  
  755.  
  756.   Playing MOD files requires considerable CPU power. You may have too
  757.   many processes running or your computer may be too slow to play in
  758.   real time. Your options are to:
  759.  
  760.  
  761.   o  try playing with a lower sampling rate or in mono mode
  762.  
  763.   o  eliminate other processes
  764.  
  765.   o  buy a faster computer
  766.  
  767.   o  buy a more powerful sound card (e.g. Gravis UltraSound)
  768.  
  769.   If you have a Gravis UltraSound card, you should use one of the mod
  770.   file players written specifically for the GUS (e.g. gmod).
  771.  
  772.  
  773.   5.12.  Compile errors when compiling sound applications
  774.  
  775.  
  776.   The version 1.0c and earlier sound driver used a different and
  777.   incompatible ioctl() scheme. Obtain newer source code or make the
  778.   necessary changes to adapt it to the new sound driver. See the sound
  779.   driver Readme file for details.
  780.  
  781.   Also ensure that you have used the latest version of soundcard.h and
  782.   ultrasound.h when compiling the application. See the installation
  783.   instructions at beginning of this text.
  784.  
  785.  
  786.   5.13.  SEGV when running sound binaries that worked previously
  787.  
  788.  
  789.   This is probably the same problem described in the previous question.
  790.  
  791.  
  792.  
  793.   5.14.  What known bugs or limitations are there in the sound driver?
  794.  
  795.  
  796.   See the Readme and CHANGELOG files included with the sound driver
  797.   kernel source.
  798.  
  799.  
  800.   5.15.  What version of the sound driver I should use?
  801.  
  802.  
  803.   If you are using version 1.0c or earlier, you definitely need to
  804.   upgrade. Version 1.0c is not compatible with the applications written
  805.   for version 2.0 or later.
  806.  
  807.   There have been no significant changes after version 2.0, so if you
  808.   don't have problems and that particular version fulfills your
  809.   requirements, there are no compelling reasons to move to a more recent
  810.   version (this should be true at least until September 1994).
  811.  
  812.   The latest official version is in the latest Linux kernel
  813.   distribution. There may also be some test and prototype versions lying
  814.   around. If the version number is smaller than 2.9, the version should
  815.   be quite safe. Any driver release having a version number of the form
  816.   2.99.XX is an incompletely implemented and experimental test release.
  817.  
  818.   If you run DOOM under Linux, see the related question later in this
  819.   document.
  820.  
  821.   If you are interested in development of the sound driver, join the
  822.   linux activists SOUND channel.
  823.  
  824.  
  825.   5.16.  What do all the sound driver configuration options mean?
  826.  
  827.  
  828.   During configuration of the sound driver, a configure program is
  829.   compiled and executed. This program asks you some questions and then
  830.   generates the header file local.h that defines the sound card
  831.   configuration.
  832.  
  833.   The configuration file defines (or undefines) the following symbols:
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.   Symbol                  Meaning
  860.   ======                  =======
  861.   KERNEL_SOUNDCARD        enable/disable sound driver
  862.   EXCLUDE_PAS             ProAudioSpectrum support
  863.   EXCLUDE_SB              SoundBlaster support
  864.   EXCLUDE_ADLIB           AdLib support
  865.   EXCLUDE_GUS             Gravis UltraSound support
  866.   EXCLUDE_MPU401          MPU-401 MIDI interface support
  867.   EXCLUDE_UART6850        6850 MIDI UART support
  868.   EXCLUDE_PSS             Professional Sound System support
  869.   EXCLUDE_GUS16           Gravis UltraSound support
  870.   EXCLUDE_GUSMAX          Gravis UltraSound Max support
  871.   EXCLUDE_MSS             Microsoft Sound System support
  872.   EXCLUDE_SBPRO           SoundBlaster Pro support
  873.   EXCLUDE_SB16            SoundBlaster 16 support
  874.   EXCLUDE_AUDIO           Digitized voice support
  875.   EXCLUDE_MIDI            MIDI interface support
  876.   EXCLUDE_YM3812          FM synthesizer (YM3812/OPL-3) support
  877.   EXCLUDE_SEQUENCER       MIDI sequencer support
  878.   EXCLUDE_PRO_MIDI        SoundBlaster Pro MIDI support
  879.   EXCLUDE_CHIP_MIDI       MIDI on CHIP support
  880.   SBC_BASE 0x220          SoundBlaster I/O base address
  881.   SBC_IRQ                 SoundBlaster IRQ number
  882.   SBC_DMA                 SoundBlaster DMA channel
  883.   SB16_DMA                SoundBlaster 16 DMA channel
  884.   SB16_MIDI_BASE          base address of SoundBlaster 16 MIDI port
  885.   PAS_IRQ                 ProAudioSpectrum IRQ number
  886.   PAS_DMA                 ProAudioSpectrum DMA channel
  887.   GUS_IRQ                 Gravis UltraSound IRQ number
  888.   GUS_DMA                 Gravis UltraSound DMA channel
  889.   GUS_BASE                base address of Gravis UltraSound
  890.   MPU_IRQ                 MPU-401 IRQ number
  891.   MPU_BASE                base address of MPU-401 port
  892.   DSP_BUFFSIZE            DMA buffer size
  893.  
  894.  
  895.  
  896.   Several other defines are also created, setting such things as the
  897.   sound driver revision level and the time and date when configure was
  898.   run.
  899.  
  900.   There are other parameters that are not set by the configure program.
  901.   If you need to change these, edit the file sound_config.h.
  902.  
  903.   To disable the sound driver, run make config and answer "no" to the
  904.   "Sound card support?" question.
  905.  
  906.  
  907.   5.17.  What future enhancements are planned for the sound driver?
  908.  
  909.  
  910.   The sound driver is not just for Linux, it also supports several other
  911.   Intel-based Unix operating systems. The package is now called
  912.   "VoxWare". Some of the enhancements being considered are:
  913.  
  914.  
  915.   o  implementing full MIDI support
  916.  
  917.   o  patch manager support
  918.  
  919.   o  document sound card driver (Hacker's Guide)
  920.  
  921.   o  support for new sound cards
  922.  
  923.   o  miscellaneous bug fixes
  924.  
  925.   5.18.  Where are the sound driver ioctls() etc. documented?
  926.  
  927.  
  928.   These are documented in the Hacker's Guide to VoxWare, currently
  929.   available in draft form. The latest version is draft 2, and can be
  930.   found on nic.funet.fi in /pub/OS/linux/ALPHA/sound. Note that this
  931.   directory is "hidden" and will not appear in directory listings. If
  932.   you "cd" to the directory and use the FTP "dir" command, the files are
  933.   there.
  934.  
  935.  
  936.   5.19.  What CPU resources are needed to play or record without pauses?
  937.  
  938.  
  939.   There is no easy answer to this question, as it depends on:
  940.  
  941.  
  942.   o  whether using PCM sampling or FM synthesis
  943.  
  944.   o  sampling rate and sample size
  945.  
  946.   o  which application is used to play or record
  947.  
  948.   o  Sound Card hardware
  949.  
  950.   o  disk I/O rate, CPU clock speed, cache size, etc.
  951.  
  952.   In general, any 386 machine should be able to play samples or FM
  953.   synthesized music on an 8 bit soundcard with ease.
  954.  
  955.   Playing MOD files, however, requires considerable CPU resources. Some
  956.   experimental measurements have shown that playing at 44kHz requires
  957.   more than 40% of the speed of a 486/50 and a 386/25 can hardly play
  958.   faster than 22 kHz (these are with an 8 bit card sound such as a
  959.   SoundBlaster). A card such as the Gravis UltraSound card performs more
  960.   functions in hardware, and will require less CPU resources.
  961.  
  962.   These statements assume the computer is not performing any other CPU
  963.   intensive tasks.
  964.  
  965.   Converting sound files or adding effects using a utility such as Sox
  966.   is also much faster if you have a math coprocessor. The kernel driver
  967.   itself does not do any floating point calculations, though.
  968.  
  969.  
  970.   5.20.  Problems with a PAS16 and an Adaptec 1542 SCSI host adaptor
  971.  
  972.  
  973.   (the following explanation was supplied by seeker@indirect.com)
  974.  
  975.   Linux only recognizes the 1542 at address 330 (default) or 333, and
  976.   the PAS only allows the MPU-401 emulation at 330.  Even when you
  977.   disable the MPU-401 under software, something still wants to conflict
  978.   with the 1542 if it's at its preferred default address.  Moving the
  979.   1542 to 333 makes everyone happy.
  980.  
  981.  
  982.   Additionally, both the 1542 and the PAS-16 do 16-bit DMA, so if you
  983.   sample at 16-bit 44KHz stereo and save the file to a SCSI drive hung
  984.   on the 1542, you're about to have trouble.  The DMAs overlap and there
  985.   isn't enough time for RAM refresh, so you get the dread ``PARITY ERROR
  986.   - SYSTEM HALTED'' message, with no clue to what caused it.  It's made
  987.   worse because a few second-party vendors with QIC-117 tape drives
  988.   recommend setting the bus on/off times such that the 1542 is on even
  989.   longer than normal.  Get the SCSISEL.EXE program from Adaptec's BBS or
  990.   several places on the internet, and reduce the BUS ON time or increase
  991.   the BUS OFF time until the problem goes away, then move it one notch
  992.   or more further.  SCSISEL changes the EEPROM settings, so it's more
  993.   permanent than a patch to the DOS driver line in CONFIG.SYS, and will
  994.   work if you boot right into Linux (unlike the DOS patch).  Next
  995.   problem solved.
  996.  
  997.  
  998.   Last problem - the older Symphony chipsets drastically reduced the
  999.   timing of the I/O cycles to speed up bus accesses.  None of various
  1000.   boards I've played with had any problem with the reduced timing except
  1001.   for the PAS-16.  Media Vision's BBS has SYMPFIX.EXE that's supposed to
  1002.   cure the problem by twiddling a diagnostic bit in Symphony's bus
  1003.   controller, but it's not a hard guarantee.  You may need to:
  1004.  
  1005.  
  1006.   o  get the motherboard distributor to replace the older version bus
  1007.      chip,
  1008.  
  1009.   o  replace the motherboard, or
  1010.  
  1011.   o  buy a different brand of sound card.
  1012.  
  1013.   Young Microsystems will upgrade the boards they import for around $30
  1014.   (US); other vendors may be similar if you can figure out who made or
  1015.   imported the motherboard (good luck).  The problem is in ProAudio's
  1016.   bus interface chip as far as I'm concerned; nobody buys a $120 sound
  1017.   card and sticks it in a 6MHz AT.  Most of them wind up in 25-40MHz
  1018.   386/486 boxes, and should be able to handle at least 12MHz bus rates
  1019.   if the chips are designed right. Exit soapbox (stage left).
  1020.  
  1021.  
  1022.   The first problem depends on the chipset used on your motherboard,
  1023.   what bus speed and other BIOS settings, and the phase of the moon.
  1024.   The second problem depends on your refresh option setting (hidden or
  1025.   synchronous), the 1542 DMA rate and (possibly) the bus I/O rate.  The
  1026.   third can be determined by calling Media Vision and asking which
  1027.   flavor of Symphony chip is incompatible with their slow design.  Be
  1028.   warned, though - 3 of 4 techs I talked to were brain damaged.  I would
  1029.   be very leery of trusting anything they said about someone else's
  1030.   hardware, since they didn't even know their own very well.
  1031.  
  1032.  
  1033.  
  1034.   5.21.  Problems with the FM synthesizer on a SoundBlaster Pro 1
  1035.  
  1036.  
  1037.   The newer SB Pro has an OPL-3 FM chip, but the older version 1 used
  1038.   the OPL-2. The sound driver assumed the presence of an OPL-3. Version
  1039.   2.5 of the sound driver corrects this problem.
  1040.  
  1041.  
  1042.   5.22.  Is the GUS-MAX supported?
  1043.  
  1044.  
  1045.   With the 2.5a sound driver the GUS-MAX is not explicitly supported but
  1046.   it will work partially. The driver does not know about the additions
  1047.   such as the mixer or 16 bit sampling. Booting your system and
  1048.   initializing the card under MS-DOS and then booting Linux (using ctrl-
  1049.   alt-del) should allow it to work.
  1050.  
  1051.   There is support for the GUS-MAX starting with the 2.9 sound driver.
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.   5.23.  What if my sound card is not supported?
  1058.  
  1059.  
  1060.   First, make sure you really have an unsupported sound card. A few
  1061.   cards are compatible with supported cards (e.g. Logitech SoundMan 16
  1062.   is compatible with ProAudioSpectrum 16). Post your question to the net
  1063.   or the Linux activists SOUND channel.
  1064.  
  1065.   If your card truly is not supported, here are some options:
  1066.  
  1067.   o  replace it with a supported sound card
  1068.  
  1069.   o  write the driver yourself
  1070.  
  1071.   o  ask Hannu Savolainen to add support to the sound driver
  1072.  
  1073.   The Hacker's Guide to Voxware has some comments on which sound cards
  1074.   may be supported in future.
  1075.  
  1076.  
  1077.   5.24.  Is it possible to read and write samples simultaneously?
  1078.  
  1079.  
  1080.   Due to hardware limitations, this is not possible with most sound
  1081.   cards. The only supported card that can do this is the
  1082.   ProAudioSpectrum16. See the section on "bidirectional mode" in the
  1083.   Hacker's Guide to Voxware for more information.
  1084.  
  1085.  
  1086.   5.25.  My SB16 is set to IRQ 2, but configure does not allow this
  1087.   value.
  1088.  
  1089.  
  1090.   On '286 and later machines, the IRQ 2 interrupt is cascaded to the
  1091.   second interrupt controller. It is equivalent to IRQ 9.
  1092.  
  1093.  
  1094.   5.26.  Are the SoundBlaster AWE32 or SoundBlaster16 ASP supported?
  1095.  
  1096.  
  1097.   Creative Labs is not willing to release programming information for
  1098.   the ASP and Emu chips used in these cards. Unless they change their
  1099.   policy, there will be no support for this under Linux.
  1100.  
  1101.   The Gravis UltraSound card has capabilities similar to the AWE32, and
  1102.   is supported under Linux.  Cards based on other DSPs such as the
  1103.   Analog Devices ADSP-21xx may be supported in the future.
  1104.  
  1105.  
  1106.   5.27.  If I run Linux, then boot DOS, I get errors and/or sound appli-
  1107.   cations do not work properly.
  1108.  
  1109.  
  1110.   This happens after a soft reboot to DOS.  Sometimes the error message
  1111.   misleadingly refers to a bad CONFIG.SYS file.
  1112.  
  1113.   Most of the current sound cards have software programmable IRQ and DMA
  1114.   settings. If you use different settings between Linux and MS-
  1115.   DOS/Windows, this may cause problems. Some sound cards don't accept
  1116.   new parameters without a complete reset (i.e. cycle the power or use
  1117.   the hardware reset button).
  1118.  
  1119.   The quick solution to this problem it to perform a full reboot using
  1120.   the reset button or power cycle rather than a soft reboot (e.g. Ctrl-
  1121.   Alt-Del).
  1122.  
  1123.   The correct solution is to ensure that you use the same IRQ and DMA
  1124.   settings with MS-DOS and Linux (or not to use DOS :-).
  1125.  
  1126.  
  1127.   5.28.  You say I need to configure and build a kernel - how do I do
  1128.   that?
  1129.  
  1130.  
  1131.   This is not the kernel HOWTO (any volunteers?). Until one is written,
  1132.   try reading the file /usr/src/linux/README; it is reasonably complete.
  1133.  
  1134.   If you really don't want to compile a kernel, you may be able to find
  1135.   a precompiled kernel that has the drivers you need as part of a Linux
  1136.   distribution (e.g. the Slackware "q" series of disks).
  1137.  
  1138.  
  1139.   5.29.  Problems running DOOM under Linux
  1140.  
  1141.  
  1142.   Users of the recently released port of ID software's game DOOM for
  1143.   Linux may be interested in these notes.
  1144.  
  1145.   For correct sound output you need version 2.90 or later of the sound
  1146.   driver; it has support for the new the real-time "DOOM mode".
  1147.  
  1148.   The sound samples are 16-bit. If you have an 8-bit sound card there is
  1149.   a program called sndcvt available that converts the data from 16 to 8
  1150.   bits on the fly. You also have to patch the DOOM sound server; the
  1151.   details are explained in the README file.
  1152.  
  1153.   If performance of DOOM is poor on your system, disabling sound (by
  1154.   renaming the file sndserver) may improve it.
  1155.  
  1156.   At least at time of writing, DOOM for Linux does not have any
  1157.   background music.
  1158.  
  1159.  
  1160.   5.30.  How can I reduce noise picked up by my soundcard?
  1161.  
  1162.  
  1163.   Using good quality shielded cables and trying the sound card in
  1164.   different slots may help reduce noise. If the sound card has a volume
  1165.   control, you can try different settings (maximum is probably best).
  1166.  
  1167.   Using a mixer program you can make sure that undesired inputs (e.g.
  1168.   microphone) are set to zero gain.
  1169.  
  1170.   Some sound cards are simply not designed with good shielding and
  1171.   grounding and are prone to noise pickup.
  1172.  
  1173.   Finally, on my system I found that the kernel command line option no-
  1174.   hlt reduces the noise level. This tells the kernel not to use the halt
  1175.   instruction when running the idle process loop. You can try this
  1176.   manually when booting, or set it up using the command append = "no-
  1177.   hlt" in your LILO configuration file.
  1178.  
  1179.  
  1180.   5.31.  I can play sounds, but not record.
  1181.  
  1182.  
  1183.   If you can play sound but not record, try these steps:
  1184.  
  1185.  
  1186.   o  use a mixer program to select the appropriate device (e.g.
  1187.      microphone)
  1188.  
  1189.   o  use the mixer to set the input gains to maximum
  1190.  
  1191.   o  If you can, try to test sound card recording under MS-DOS to
  1192.      determine if there is a hardware problem
  1193.  
  1194.  
  1195.   5.32.  My "compatible" sound card only works if I first initialize
  1196.   under MS-DOS.
  1197.  
  1198.  
  1199.   Some sound card clones are not 100% register compatible with the real
  1200.   thing; they sometimes contain extra circuitry such as mixers. You may
  1201.   be able to use these under Linux if you first initialize under MS-DOS,
  1202.   then soft boot Linux (i.e. Ctrl-Alt-Delete).
  1203.  
  1204.   One user also reported that he had better results if he used LOADLIN
  1205.   rather than LILO to boot Linux after initializing his sound card under
  1206.   MS-DOS (this was with a Diamond sound card).,
  1207.  
  1208.   They may or may not function reliably. The real solution is to find
  1209.   out from the manufacturer what the differences are and have the
  1210.   support added to the sound driver. This has been done, for example,
  1211.   for the Sound Galaxy NX Pro.
  1212.