Snd usb audio linux

Matrix : Module-usb-audio

Introduction for Generic USB Audio Driver soundcard

There are two ways of getting Linux drivers to work, you can either compile them into the kernel or build them separately as modules. Read the Kernel-HOWTO for details of how to compile a kernel.

You must turn on the sound support soundcore module. This is in the kernel. Look in the sound drivers directory and it should be the first option. Most people enable the module setting. That way you can load and unload the module manually if you have multiple soundcards/​devices or if you intend to debug or use cutting edge software which may cause your drivers to halt sometimes. Of course it also means you have more control of your system.

Most modern distros come with soundcore compiled as a module. You can check this in numerous ways. The easiest way is to type:

If this command returns that you have this module, then you don’t need to recompile your kernel.

Quick installation

This explains how to build from source tarballs. See GIT_Server for instructions on getting and using the latest source from git repositories.

Type the following commands in the shell of your choice.

Make a directory to store the alsa source code in:

cd /usr/src mkdir alsa cd alsa cp /downloads/alsa-* .

Now unzip and install the alsa-driver package:

bunzip2 alsa-driver-xxx tar -xf alsa-driver-xxx cd alsa-driver-xxx ./configure --with-cards=usb-audio --with-sequencer=yes ; make ; make install

Now unzip and install the alsa-lib package:

cd .. bunzip2 alsa-lib-xxx tar -xf alsa-lib-xxx cd alsa-lib-xxx ./configure ; make ; make install

Now unzip and install the alsa-firmware package:

cd .. bunzip2 alsa-firmware-xxx tar -xf alsa-firmware-xxx cd alsa-firmware-xxx ./configure ; make ; make install

Now unzip and install the alsa-utils package:

cd .. bunzip2 alsa-utils-xxx tar -xf alsa-utils-xxx cd alsa-utils-xxx ./configure ; make ; make install

Now insert the modules into the kernel:

modprobe snd-usb-audio ; modprobe snd-pcm-oss ; modprobe snd-mixer-oss ; modprobe snd-seq-oss

Now adjust your soundcard’s volume levels. All mixer channels are muted by default. You must use a native mixer program to unmute appropriate channels, for example alsamixer from the alsa-utils package. Note that some usb-audio devices do not have internal mixer controls. Run:

You can also look at the utils/​alsasound file. This script is designed for the RedHat Linux distribution, but it can also be used with other distributions which use System V style rc init scripts. This will allow you to load your modules at boot time. If you don’t want to do this you can of course compile them into the kernel instead and save yourself the hassle of coming to terms with the rc init scripts.

Читайте также:  Linux show process and port

Setting up modprobe and kmod support

Before you send a mail complaining that «I don’t have /etc/​modules.conf, where do I find it ……» ‒ the /etc/​conf.modules has been deprecated with a few distro’s, but in your case it may still be /etc/​conf.modules. Basically they are both the same, but recent version of modutils use /etc/​modules.conf instead. Nothing to worry about as such, optionally please update to the latest version of modutils. This should solve your problem.

Here’s the example for this card. Copy and paste this to the bottom of your /etc/​modules.conf file.

Debian GNU/Linux users need to save this information into a file in the /etc/​modutils/ directory (eg. /etc/​modutils/​alsa) and run update-modules.

Note also that the kernel module soundcore has been renamed in Debian kernels >2.6.23 into snd. A workaround is to put a symlink at /lib/modules/x.x.xx/kernel/sound/soundcore.ko pointing to snd.ko

Systemd users need to save this information into a file in the /etc/​modprobe.d/ directory terminating with .conf (eg. /etc/​modprobe.d/​alsa.conf).

In case of modules auto-loading instead, the module name must be inserted in a file in the/etc/​modules-load.d/ directory terminating with .conf (eg. /etc/​modules-load.d/​alsa.conf).

# ALSA portion alias char-major-116 snd alias snd-card-0 snd-usb-audio # module options should go here # OSS/Free portion alias char-major-14 soundcore alias sound-slot-0 snd-card-0 # card #1 alias sound-service-0-0 snd-mixer-oss alias sound-service-0-1 snd-seq-oss alias sound-service-0-3 snd-pcm-oss alias sound-service-0-8 snd-seq-oss alias sound-service-0-12 snd-pcm-oss

To copy and paste the above to your /etc/​modules.conf file follow these instructions.

modules.conf

This is a short explanation of what happens in the /etc/​modules.conf file.

Native devices

After the main multiplexer is loaded, its code automatically requests the top level sound card module. String snd-card-%i is requested for native devices where %i is the sound card number, counted from zero (the first sound card) to seven (the eighth sound card). String sound-slot-%i is requested for native devices where %i is slot number for the corresponding ALSA owner (which is basically the sound card number). The options line allows you to set various configuration options before the module is loaded. String id (or snd_id) lets you set the name of the card which is then returned in the /proc/​asound/​cards file, i.e. to user space applications. Other options may be available depending on the specific card. Options for these cards are found in the INSTALL file or above.

username@hostname# pico /etc/modules.conf # ALSA portion alias snd-card-0 snd-hda-intel alias snd-card-1 snd-cmipci options snd-cmipci mpu_port=0x330 # OSS/Free portion alias sound-slot-0 snd-card-0 alias sound-slot-1 snd-card-1

For drivers older than 0.9.0rc5 use:

options snd-cmipci snd_id="first" snd_mpu_port=0x330

The «snd_» prefix has been removed from the module options to fit with the kernel standard.

Autoloading OSS/free emulation

At this point we are finished with the configuration for ALSA native devices, but you may also need autoloading for the OSS/Free emulation modules, an ALSA add-on. At this time only one module does not depend on any others, thus must be loaded separately: snd-pcm1-oss. String sound-service-%i-%i is required for OSS/Free service where the first %i is the slot number/​sound card number and the second %i is the service number.

username@hostname# pico /etc/modules.conf # OSS/Free portion - card #1 alias sound-slot-0 snd-card-0 alias sound-service-0-0 snd-mixer-oss alias sound-service-0-1 snd-seq-oss alias sound-service-0-3 snd-pcm-oss alias sound-service-0-8 snd-seq-oss alias sound-service-0-12 snd-pcm-oss # OSS/Free portion - card #2 (cmipci) alias sound-slot-1 snd-card-1 alias sound-service-1-0 snd-mixer-oss alias sound-service-1-3 snd-pcm-oss alias sound-service-1-12 snd-pcm-oss

The alias for snd-seq-oss is not necessary on the second device, because there is only one /dev/​sequencer regardless how many devices you have.

Читайте также:  Удаление лишнего linux mint

The .asoundrc file

This file allows you to have more advanced control over your card/​device. For most setups the default, system-wide configuration is sufficient. You may change this file only for special setup. The .asoundrc file consists of definitions for the various sound devices available in your system. It also provides access to the pcm plugins in alsa-lib. These allow you to do tricky things like combine your cards into one or access multiple I/O streams on your multi-channel card.

Below is the most basic definition (only example — not required to define at all).

Make a file called .asoundrc in your home and/​or root directory:

Copy and paste the following into the file, then save it:

Software volume control

If your card doesn’t have hardware volume control (e. g. Asus Xonar XD/XDG), you might want to create software Master control. Edit .asoundrc as follows.

pcm.softvol < type softvol slave < pcm "dmix" >control < name "Master" card 0 >> pcm.!default

Restart alsa, then open a music player, play a file and close the player. Then check alsamixer, as you should have a Master volume control. Note that this control doesn’t have a mute option.

  • Keep up to date with the news at M-Station
  • The most current book about Linux audio is Linux Music and Sound (September 2000)
  • Find more applications at Sound & MIDI Software For Linux SourceForge
  • For professional quality, low latency audio routing use JACK ‒ the “Jack Audio Connection Kit”.

Источник

Guide to using M-Audio Audiophile USB with ALSA and Jack¶

This document is a guide to using the M-Audio Audiophile USB ™ device with ALSA and JACK.

History¶

  • v1.4 — Thibault Le Meur (2007-07-11)
    • Added Low Endianness nature of 16bits-modes found by Hakan Lennestal
    • Modifying document structure

    Audiophile USB Specs and correct usage¶

    This part is a reminder of important facts about the functions and limitations of the device.

    The device has 4 audio interfaces, and 2 MIDI ports:

    • Analog Stereo Input (Ai)
      • This port supports 2 pairs of line-level audio inputs (1/4″ TS and RCA)
      • When the 1/4″ TS (jack) connectors are connected, the RCA connectors are disabled

      The internal DAC/ADC has the following characteristics:

      • sample depth of 16 or 24 bits
      • sample rate from 8kHz to 96kHz
      • Two interfaces can’t use different sample depths at the same time.

      Please exit any audio application running before switching between bit depths

      Due to the USB 1.1 bandwidth limitation, a limited number of interfaces can be activated at the same time depending on the audio mode selected:

      • 16-bit/48kHz ==> 4 channels in + 4 channels out
        • Ai+Ao+Di+Do
        • Ai+Ao+Do or Ai+Di+Ao or Ai+Di+Do or Di+Ao+Do
        • Ai or Ao or Di or Do

        Important facts about the Digital interface:¶

        • The Do port additionally supports surround-encoded AC-3 and DTS passthrough, though I haven’t tested it under Linux
          • Note that in this setup only the Do interface can be enabled
          • As a consequence, the Di port must be enable only if an active Digital source is connected
          • Enabling Di when no digital source is connected can result in a synchronization error (for instance sound played at an odd sample rate)

          Audiophile USB MIDI support in ALSA¶

          The Audiophile USB MIDI ports will be automatically supported once the following modules have been loaded:

          No additional setting is required.

          Audiophile USB Audio support in ALSA¶

          Audio functions of the Audiophile USB device are handled by the snd-usb-audio module. This module can work in a default mode (without any device-specific parameter), or in an «advanced» mode with the device-specific parameter called device_setup .

          Default Alsa driver mode¶

          The default behavior of the snd-usb-audio driver is to list the device capabilities at startup and activate the required mode when required by the applications: for instance if the user is recording in a 24bit-depth-mode and immediately after wants to switch to a 16bit-depth mode, the snd-usb-audio module will reconfigure the device on the fly.

          This approach has the advantage to let the driver automatically switch from sample rates/depths automatically according to the user’s needs. However, those who are using the device under windows know that this is not how the device is meant to work: under windows applications must be closed before using the m-audio control panel to switch the device working mode. Thus as we’ll see in next section, this Default Alsa driver mode can lead to device misconfigurations.

          Let’s get back to the Default Alsa driver mode for now. In this case the Audiophile interfaces are mapped to alsa pcm devices in the following way (I suppose the device’s index is 1):

          • hw:1,0 is Ao in playback and Di in capture
          • hw:1,1 is Do in playback and Ai in capture
          • hw:1,2 is Do in AC3/DTS passthrough mode

          In this mode, the device uses Big Endian byte-encoding so that supported audio format are S16_BE for 16-bit depth modes and S24_3BE for 24-bits depth mode.

          One exception is the hw:1,2 port which was reported to be Little Endian compliant (supposedly supporting S16_LE) but processes in fact only S16_BE streams. This has been fixed in kernel 2.6.23 and above and now the hw:1,2 interface is reported to be big endian in this default driver mode.

          % aplay -D hw:1,0 -c2 -t raw -r48000 -fS24_3BE test.raw
          % arecord -D hw:1,1 -c2 -t raw -r48000 -fS24_3BE test.raw

          Источник

Оцените статью
Adblock
detector