Projekat

Općenito

Profil

Akcije

Podrška #13708

Zatvoren

ubuntu sound: alsa, usb, pulseaudio

Dodano od Ernad Husremović prije oko 17 godina. Izmjenjeno prije više od 16 godina.

Status:
Zatvoreno
Prioritet:
Normalan
Odgovorna osoba:
Kategorija:
-
Početak:
27.03.2008
Završetak:
% završeno:

0%

Procjena vremena:

Opis

ubuntu linux sound .. kako šta gdje da sebi napokon razjasnim


Fajlovi

pulseaudio-0.9.6-1.win32.zip (911 KB) pulseaudio-0.9.6-1.win32.zip pulseaudio win32 0.9.6 Ernad Husremović, 02.04.2008 14:31

Povezani tiketi 1 (0 otvoreno1 zatvoren)

korelira sa ubuntu - Podrška #13799: pulseaudioZatvorenoErnad Husremović02.04.2008

Akcije
Akcije #1

Izmjenjeno od Ernad Husremović prije oko 17 godina

  • Naslov promijenjeno iz ubuntu sound, usb u ubuntu sound: alsa, usb
Akcije #2

Izmjenjeno od Ernad Husremović prije oko 17 godina

Using the ALSA Sound System

This page summarises things I learned while trying to understand and use the Advanced Linux Sound Architecture (ALSA) on my Debian GNU/Linux system. I would be happy to receive suggestions to improve or extend this web page.

Akcije #3

Izmjenjeno od Ernad Husremović prije oko 17 godina

There are different groups of devices:
  • "control" (used by the system to set the volume, mute channels, etc.)
  • "playback"
  • "capture" (reading audio data into the computer)
  • "raw midi"
  • "sequencer"
  • "timer" (I don't know yet what the latter two do).
Akcije #4

Izmjenjeno od Ernad Husremović prije oko 17 godina

Tuning USB devices for minimal latencies

On linux-audio-user Christoph Eckert brought up the question about how to get better latencies out of USB audio devices, and USB guru Clemens Ladisch had a very good tip: The snd-usb-audio module accepts a module option called "nrpacks", which according to modinfo, sets the: Max. number of packets per URB. (int). Setting this to "nrpacks=1" should allow latencies in the area of 4-6 msecs.

Unfortunatly on some systems/kernels nrpacks=1 conflicts with a feature called "USB bandwidth allocation" in the kernel. Here's the way out:

  • In the kernel config ensure that both options (taken from a 2.6.10) are disabled::
    :[   ] Enforce USB bandwidth allocation (EXPERIMENTAL)
    :[   ] Dynamic USB minor allocation (EXPERIMENTAL)
    
  • Ensure to load the snd-usb-audio module with the parameter "nrpacks=1", maybe including it into one of the boot scripts::
    modprobe snd-usb-audio nrpacks=1
    
  • Or use the module configuration line (e.g. in /etc/modprobe.conf):
    options snd-usb-audio nrpacks=1
    
Akcije #5

Izmjenjeno od Ernad Husremović prije oko 17 godina

http://alsa.opensrc.org/index.php/MultipleUSBAudioDevices

hernad@nmraka-1:~$ modinfo snd-usb-audio

filename:       /lib/modules/2.6.24-12-generic/ubuntu/sound/alsa-driver/usb/snd-usb-audio.ko
license:        GPL
description:    USB Audio
author:         Takashi Iwai <tiwai@suse.de>
srcversion:     DBC90B277D513C9230BEAB2
alias:          usb:v*p*d*dc*dsc*dp*ic01isc01ip*
alias:          usb:v*p*d*dc*dsc*dp*ic01isc03ip*
alias:          usb:v7104p2202d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v4752p0011d*dc*dsc*dp*ic*isc*ip*

...

alias:          usb:v046Dp08AEd*dc*dsc*dp*ic01isc01ip*
alias:          usb:v046Dp0850d*dc*dsc*dp*ic01isc01ip*
depends:        snd-usb-lib,snd-pcm,usbcore,snd,snd-hwdep
vermagic:       2.6.24-12-generic SMP mod_unload 
parm:           index:Index value for the USB audio adapter. (array of int)
parm:           id:ID string for the USB audio adapter. (array of charp)
parm:           enable:Enable USB audio adapter. (array of bool)
parm:           vid:Vendor ID for the USB audio device. (array of int)
parm:           pid:Product ID for the USB audio device. (array of int)
parm:           nrpacks:Max. number of packets per URB. (int)
parm:           async_unlink:Use async unlink mode. (bool)
parm:           device_setup:Specific device setup (if needed). (array of int)

Akcije #6

Izmjenjeno od Ernad Husremović prije oko 17 godina

http://alsa.opensrc.org/index.php/Hotplugging_USB_audio_devices_(Howto)

...

Get Hotplug to switch setups

Hotplug has a collection of usermap files. These maps identify a specific device (by vendor id, device id, etc.) and instruct hotplug to execute a specific script that sets up the device. The usermaps can be created per device. In this example, I use /etc/hotplug/usb/extigy.usermap for the usermap and /etc/hotplug/usb/extigy for the script that it executes.
[edit] Create a usermap file

Figure out the vendor ID and product ID of your soundcard. You can either use lsusb -v or search for them on the web. For my SB Extigy, these are 041e and 3000 respectively.

The usermap file contains several fields. The first one is the name of the script, the second one is a mask that enables the match criteria. We have the produce and vendor id, so we use those:

/etc/hotplug/usb/extigy.usermap:

# usb module
# |       match_flags
# |       |       idVendor
# |       |       |       idProduct
# |       |       |       |       bcdDevice_lo
# |       |       |       |       |       bcdDevice_hi
# |       |       |       |       |       |       bDeviceClass
# |       |       |       |       |       |       |     bDeviceSubClass
# |       |       |       |       |       |       |     |     bDeviceProtocol
# |       |       |       |       |       |       |     |     |     bInterfaceClass
# |       |       |       |       |       |       |     |     |     |     bInterfaceSubClass
# |       |       |       |       |       |       |     |     |     |     |     bInterfaceProtocol
# |       |       |       |       |       |       |     |     |     |     |     |     driver_info
  extigy  0x0003  0x041e  0x3000  0x0000  0x0000  0x00  0x00  0x00  0x00  0x00  0x00  0x00000000

Now with this file, I got multiple calls of the script, presumably because the card has several subdevices. I restricted my script to apply only to the control interface (bInterfaceSubClass 1) so that I get one call only, YMMV.

/etc/hotplug/usb/extigy.usermap:

# usb module
# |       match_flags
# |       |       idVendor
# |       |       |       idProduct
# |       |       |       |       bcdDevice_lo
# |       |       |       |       |       bcdDevice_hi
# |       |       |       |       |       |       bDeviceClass
# |       |       |       |       |       |       |     bDeviceSubClass
# |       |       |       |       |       |       |     |     bDeviceProtocol
# |       |       |       |       |       |       |     |     |     bInterfaceClass
# |       |       |       |       |       |       |     |     |     |     bInterfaceSubClass
# |       |       |       |       |       |       |     |     |     |     |     bInterfaceProtocol
# |       |       |       |       |       |       |     |     |     |     |     |     driver_info
  extigy  0x0003  0x041e  0x3000  0x0000  0x0000  0x00  0x00  0x00  0x00  0x01  0x00  0x00000000

The hotplug script

This is a simple shell script. REMOVER is a variable passed to the script from hotplug which identifies the location of a script that is executed on removal. Unfortunately, the usb.agent script does not seem to work correctly. This is a known bug and you can find a workaround in the bug report.

/etc/hotplug/usb/extigy:

   #!/bin/bash
   #determine which configuration is active, note that removal does not seem to work
   echo -e "/usr/local/sbin/alsaswitch `ls -lFA /etc/asound.conf \
                                        | sed 's:.*/etc/alsa/asound.\([^ ]*\)$:\1:'`" > $REMOVER
   chmod a+x $REMOVER
   /usr/local/sbin/alsaswitch extigy;

Now all you need is to plug in your device. If you have coldplugging installed, this also works at boot time.

Akcije #7

Izmjenjeno od Ernad Husremović prije oko 17 godina

http://alsa.opensrc.org/index.php/.asoundrc

We can use it as follows:

pcm.nvidia {
type hw
card 0
device 0
}

pcm_slave.sl3 {
pcm nvidia
format S16_LE
channels 1
rate 16000
}
pcm.complex_convert {
type plug
slave sl3
}

By calling it with:

aplay -vD complex_convert test.wav

you can convert the samples during playing to the sample format: S16_LE, one channel and a sample-rate of 16 kHz. If you use aplay with the verbose option -v you will see the settings from the original file. For example,

aplay -v test.wav

will show the original settings of the sound file test.wav. If you add the definition "route_policy average" to the plug definition, you will make your output channel be the (arithmetic) average of your input channels.

ali ovo kod mene ne radi :(, vjerovatno jer ovdje imam pulseaudio

Akcije #8

Izmjenjeno od Ernad Husremović prije oko 17 godina

ni ovo ne radi ?!

hernad@nmraka-1:~$ aplay -D nvidia /usr/share/sounds/warning.wav

Playing WAVE '/usr/share/sounds/warning.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
aplay: set_params:906: Channels count non available

evo šta kaže pulseaudio play

hernad@nmraka-1:~$ paplay -v /usr/share/sounds/warning.wav

Using sample spec 's16le 1ch 44100Hz'
E: shm.c: shm_open() failed: Permission denied
Connection established.
Stream successfully created
Playback stream drained.
Draining connection to server.

Akcije #9

Izmjenjeno od Ernad Husremović prije oko 17 godina

hernad@nmraka-1:~$ pactl stat

E: shm.c: shm_open() failed: Permission denied
Currently in use: 2 blocks containing 1.6 MiB bytes total.
Allocated during whole lifetime: 94020 blocks containing 328.4 MiB bytes total.
Sample cache size: 1.6 MiB
User name: hernad
Host Name: nmraka-1.sigma-com.net
Server Name: pulseaudio
Server Version: 0.9.9
Default Sample Specification: s16le 2ch 44100Hz
Default Sink: alsa_output.pci_10de_55c_sound_card_0_alsa_playback_0
Default Source: alsa_input.pci_10de_55c_sound_card_0_alsa_capture_0

Akcije #10

Izmjenjeno od Ernad Husremović prije oko 17 godina

  • Naslov promijenjeno iz ubuntu sound: alsa, usb u ubuntu sound: alsa, usb, pulseaudio

Puleaudio loadable Modules

The following loadable modules are provided with the PulseAudio distribution:

Device Drivers

All device driver modules support the following parameters:

format
  • The sample format (one of u8, s16, s16le, s16le, float32, float32be, float32le, alaw, ulaw) (defaults to s16)
rate
  • The sample rate (defaults to 44100)
channels
  • Audio channels (defaults to 2)
sink_name, source_name
  • Name for the sink (resp. source). Allowed characters in the name are a-z, A-Z, numbers, period (.) and underscore (_).
channel_map
  • Channel map. A list of comma-seperated channel names. The currently defined channel names are: left, right, mono, center, front-left, front-right, front-center, rear-center, rear-left, rear-right, lfe, subwoofer, front-left-of-center, front-right-of-center, side-left, side-right, aux0, aux1 to aux15, top-center, top-front-left, top-front-right, top-front-center, top-rear-left, top-rear-right, top-rear-center, (Default depends on the number of channels and the driver)

module-pipe-sink

Provides a simple test sink that writes the audio data to a FIFO special file in the file system. The sink name defaults to pipe_output.

The following option is supported:

file
  • The name of the FIFO special file to use. (defaults to: /tmp/music.output)

module-pipe-source

Provides a simple test source that reads the audio data from a FIFO special file in the file system. The source name defaults to pipe_input.

The following option is supported:

file
  • The name of the FIFO special file to use. (defaults to: /tmp/music.input)

module-null-sink

Provides a simple null sink. All data written to this sink is silently dropped. This sink is clocked using the system time.

This module doesn't support any special parameters

module-alsa-sink

Provides a playback sink for devices supported by the Advanced Linux Sound Architecture (ALSA). The sink name defaults to alsa_output.

In addition to the general device driver options described above this module supports:

device
  • The ALSA device to use. (defaults to "hw:0,0")
fragments
  • The desired fragments when opening the device. (defaults to 12)
fragment_size
  • The desired fragment size in bytes when opening the device (defaults to 1024)

module-alsa-source

Provides a recording source for devices supported by the Advanced Linux Sound Architecture (ALSA). The source name defaults to alsa_input.
This module supports device=, fragments= and fragment_size= arguments the same way as module-alsa-sink.

Akcije #11

Izmjenjeno od Ernad Husremović prije oko 17 godina

http://www.linux-usb.org/

062a Creative Labs
  • 0000 Optical mouse
  • 0001 Notebook Optical Mouse
  • 0201 Defender Office Keyboard (K7310) S Zodiak KM-9010
  • 9003 VoIP Conference Hub (A16GH)
  • 9004 USR9602 USB Internet Mini Phone
Akcije #13

Izmjenjeno od Ernad Husremović prije oko 17 godina

http://www.cendio.com/pulseaudio

Windows Binaries for PulseAudio

Pre-built Win32 binaries for the PulseAudio sound server.

PulseAudio is an advanced Open Source sound server, designed to be a replacement for the old EsounD daemon. It is a highly modular and well designed piece of software that outperforms its competition on more or less every count.
Pulseaudio Used in ThinLinc - a Terminal Server Solution for Linux

Cendio has contributed a lot of resources to the PulseAudio project as part of our terminal server product ThinLinc.

ThinLinc has many use cases. It can be used both to publish Linux desktops and serve as a fronted to Windows Terminal Servers. It is also very good in environments where there is a need to mix Linux and Windows.

Akcije #14

Izmjenjeno od Ernad Husremović prije oko 17 godina

probao ovo na visti ali stvar ne radi

default.pa

load-module module-waveout

load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.45.0/24

C:\Users\hernad\Desktop\pulseaudio-0.9.6>pulseaudio

W: pulsecore/random.c: failed to get proper entropy. Falling back to seeding wit
h current time.
W: pulsecore/core-util.c: secure directory creation not supported on Win32.
E: pulsecore/pid.c: stale PID file, overwriting.
W: pulsecore/core.c: failed to allocate shared memory pool. Falling back to a no
rmal memory pool.
E: modules/module-waveout.c: failed to open waveIn
E: pulsecore/module.c: Failed to load  module "module-waveout" (argument: ""): i
nitialization failed.
E: daemon/main.c: Module load failed.
E: daemon/main.c: failed to initialize daemon.

Akcije #15

Izmjenjeno od Ernad Husremović prije više od 16 godina

  • Status promijenjeno iz Dodijeljeno u Zatvoreno
Akcije

Također dostupno kao Atom PDF