ALSA – mehrere Audioquellen mischen auf HDMI unter Ubuntu

Inhalt

Inhalt

Beschreibung

Dieser Artikel beschreibt die Konfiguration eines einfachen Stereo Sound Ausgabedevices auf den HDMI Port, das von mehren Quellen angesteuert werden kann, ohne Meldung auf ein bereits belegtes Deive.

Hersteller OHNE
Autor(en) OHNE
Lizenz GPL / OpenSource
OS Linux – Ubuntu Studio 14.04.1 lts / KodiBuntu 14.04.1 lts
Kernel 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Funktion io
Status open

Installationsumgebung / -Voraussetzung

Getestet wurde(n) mit der/den VDR Versionen: 2.0.3
unter der/den Ubuntu Version(en): 12.10, 14.04.1 lts

Konfiguration

Feststellen welche Soundkarten verfügbar sind

aplay -l

 **** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: STAC92xx Analog [STAC92xx Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
cat /proc/asound/cards

 0 [Intel          ]: HDA-Intel - HDA Intel
                      HDA Intel at 0x53220000 irq 49

Anlegen einer systemweiten ALSA Konfiguration für das zusammen mischen der Ausgabe auf HDMI als Standarddevice

sudo vim /etc/asound.conf

pcm.snd_card {
        type hw
        card 0
        device 0
}

ctl.snd_card {
        type hw
        card 0
        device 0
}

### Alles in einer Zeile nach dem Zeichen # ist ein Kommentar, und wird von ALSA ignoriert.

# Das dmix-Plugin wird definiert.
pcm.dmixer {
    type dmix
    ipc_key 1024
    ipc_perm 0666       # Andere Benutzer können ebenfalls dmix gleichzeitig nutzen
    slave.pcm "snd_card"
    slave {
        ### buffer_size kann bei Problemen der jeweiligen Karte angepasst werden.
        period_time 0
        period_size 1024
        buffer_size 4096
        ### bei Störungen kann die Konvertierung auf die Rate 44100 eingeschaltet werden.
        # rate 44100
        ### einige Soundkarten benötigen das exakte Datenformat (zB ice1712)
        # format S32_LE
        ### Verfügbare Formate: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE U24_LE U24_BE
        ###               S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE
        ###               IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW A_LAW IMA_ADPCM MPEG GSM
        ### Anzahl channels muss mit den bindings übereinstimmen
        channels 2
    }
    bindings {
        0 0
        1 1
    }
}

# Das dsnoop-Plugin, welches es erlaubt, mehrere Programme gleichzeitig aufnehmen zu lassen.
pcm.dsnooper {
    type dsnoop
    ipc_key 2048
    ipc_perm 0666
    slave.pcm "snd_card"
    slave
    {
        period_time 0
        period_size 1024
        buffer_size 4096
        # bei Störungen kann die Konvertierung auf die Rate 44100 eingeschaltet werden.
        # rate 44100
        # einige Soundkarten benötigen das exakte Datenformat (zB ice1712)
        # format S32_LE
        ### Anzahl channels muss mit den bindings übereinstimmen
        channels 2
    }
    bindings {
        0 0
        1 1
    }
}

# Dies definiert unser Fullduplex-Plugin als Standard für alle ALSA-Programme.
pcm.duplex {
    type asym
    playback.pcm "dmixer"
    capture.pcm "dsnooper"
}

pcm.!default {
    type plug
    slave.pcm "duplex"
}

Die erfolgreiche Einrichung der neuen Sounddevices dmixer, dsnooper, duplex und default prüfen

aplay -L

null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
dmixer
dsnooper
duplex
default
sysdefault:CARD=I82801AAICH
    Intel 82801AA-ICH, Intel 82801AA-ICH
    Default Audio Device
front:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    Front speakers
surround40:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    4.0 Surround output to Front and Rear speakers
surround41:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
iec958:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    Direct sample mixing device
dsnoop:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    Direct sample snooping device
hw:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    Direct hardware device without any conversions
plughw:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    Hardware device with all software conversions

Test

Herunterladen einiger Testdateien und testen der Alsa Konfiguration durch abspielen einer Testdatei auf den verschiedenen Soundkarten.

Sounddevice Default:

cd ~/Downloads/
wget http://download.wavetlan.com/SVV/Media/HTTP/WAV/Media-Convert/Media-Convert_test3_PCM_Stereo_VBR_16SS_11025Hz.wav
wget http://www.kozco.com/tech/LRMonoPhase4.wav
aplay Media-Convert_test3_PCM_Stereo_VBR_16SS_11025Hz.wav -Dplug:dmixer aplay LRMonoPhase4.wav -Dplug:dmixer

Sounddevice dupplex:

aplay -D duplex Media-Convert_test3_PCM_Stereo_VBR_16SS_11025Hz.wav -Dplug:dmixer
aplay -D duplex LRMonoPhase4.wav -Dplug:dmixer

Sollte die Wiedergabe Frequnz nicht passen und die Wiedergabe zu schnell erfolgen, kann diese in Zeile 27 der /etc/asoaund.conf auf 44100 Hz angepasst werden

Warning: rate is not accurate (requested = 44100Hz, got = 48000Hz)
         please, try the plug plugin (-Dplug:dmix)

Quellen:

http://wiki.ubuntuusers.de/.asoundrc
http://alsa.opensrc.org/Hardware_mixing,_software_mixing
http://linuxundich.de/de/ubuntu/sounds-mit-pulseaudio-umleiten/
http://www.alsa-project.org/main/index.php/Asoundrc

 

 

 

 

Print Friendly, PDF & Email

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

*

Time limit is exhausted. Please reload the CAPTCHA.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.