LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   HDMI Audio with 12.2 (https://www.linuxquestions.org/questions/slackware-14/hdmi-audio-with-12-2-a-746153/)

vik 08-17-2009 03:46 PM

1) OK, then alsa.conf. No problem. If you don't see the file, then run pkgtool, view each alsa package, and find the .conf file that has a pcm.default line in it.
2) Copy your /etc/asound.conf to asound.conf.bak, and ~/.asoundrc to ~/.asoundrc.bak. We'll tweak it in /usr/share/alsa/alsa.conf instead, and you don't want your other settings to get in the way.
3) OK, your devices are different than mine. It looks like you want card 0, device 3.
4) Post your /usr/share/alsa/alsa.conf from your slackware machine that you're having trouble with and I'll show you how to fix it.
5) Also, post lsmod | grep snd.
6) try this: mplayer -ao alsa:device=hw:0.3 KDE_Startup.wav (or is it alsa:device=hw=0.3)?
if that doesn't work, try mplayer -ao alsa:device=plughw:0.3 KDE_Startup.wav
try mplayer -ao alsa:device=hdmi KDE_Startup.wav as well.

Woodsman 08-17-2009 04:29 PM

vik: I appreciate your help! However, I have to resume this conversation later --- other priorities for a while. :(

vik 08-17-2009 04:31 PM

No problem. I'll post my alsa.conf when I get home...

BTW, it took me 2 weeks to get mine working...hope to save you some of the same aggravation.

forum1793 08-17-2009 07:03 PM

Woodsman, for the configuration/installation in which you have aplay-l showing hdmi for card 0 device 3, try

mplayer -ao alsa:device=hw=0.3 yoursong

Also, I haven't tried lately but mythtv didn't work yet with kde4/qt4. Not sure if I tried after loading the optional kde3 stuff in extra subdirectory though.

vik 08-17-2009 09:43 PM

Now that I'm at my linux box, try this: mplayer -ao alsa:device=plughw=0.3 KDE_Startup.wav. If that doesn't work try mplayer -ao alsa:device=plughw=0.1 KDE_Startup.wav.

Here's my /usr/share/alsa/alsa.conf...it will be a little different than yours due to hardware differences. Look for the 2 lines I commented out--the ones below are my changes.
Code:

#
#  ALSA library configuration file
#

# pre-load the configuration files

@hooks [
        {
                func load
                files [
                        "/etc/asound.conf"
                        "~/.asoundrc"
                ]
                errors false
        }
]

# load card-specific configuration files (on request)

cards.@hooks [
        {
                func load
                files [
                        {
                                @func concat
                                strings [
                                        { @func datadir }
                                        "/cards/aliases.conf"
                                ]
                        }
                ]
        }
        {
                func load_for_all_cards
                files [
                        {
                                @func concat
                                strings [
                                        { @func datadir }
                                        "/cards/"
                                        { @func private_string }
                                        ".conf"
                                ]
                        }
                ]
                errors false
        }
]

#
# defaults
#

# show all name hints also for definitions without hint {} section
defaults.namehint.showall off
# show just basic name hints
defaults.namehint.basic on
# show extended name hints
defaults.namehint.extended off
#
defaults.ctl.card 0
defaults.pcm.card 0
#defaults.pcm.device 0
defaults.pcm.device 1
defaults.pcm.subdevice -1
defaults.pcm.nonblock 1
defaults.pcm.ipc_key 5678293
defaults.pcm.ipc_gid audio
defaults.pcm.ipc_perm 0660
defaults.pcm.dmix.max_periods 0
#defaults.pcm.dmix.rate 48000
defaults.pcm.dmix.rate 44100
defaults.pcm.dmix.format "unchanged"
defaults.pcm.dmix.card defaults.pcm.card
defaults.pcm.dmix.device defaults.pcm.device
defaults.pcm.dsnoop.card defaults.pcm.card
defaults.pcm.dsnoop.device defaults.pcm.device
defaults.pcm.front.card defaults.pcm.card
defaults.pcm.front.device defaults.pcm.device
defaults.pcm.rear.card defaults.pcm.card
defaults.pcm.rear.device defaults.pcm.device
defaults.pcm.center_lfe.card defaults.pcm.card
defaults.pcm.center_lfe.device defaults.pcm.device
defaults.pcm.side.card defaults.pcm.card
defaults.pcm.side.device defaults.pcm.device
defaults.pcm.surround40.card defaults.pcm.card
defaults.pcm.surround40.device defaults.pcm.device
defaults.pcm.surround41.card defaults.pcm.card
defaults.pcm.surround41.device defaults.pcm.device
defaults.pcm.surround50.card defaults.pcm.card
defaults.pcm.surround50.device defaults.pcm.device
defaults.pcm.surround51.card defaults.pcm.card
defaults.pcm.surround51.device defaults.pcm.device
defaults.pcm.surround71.card defaults.pcm.card
defaults.pcm.surround71.device defaults.pcm.device
defaults.pcm.iec958.card defaults.pcm.card
defaults.pcm.iec958.device defaults.pcm.device
defaults.pcm.modem.card defaults.pcm.card
defaults.pcm.modem.device defaults.pcm.device
# truncate files via file or tee PCM
defaults.pcm.file_format        "raw"
defaults.pcm.file_truncate        true
defaults.rawmidi.card 0
defaults.rawmidi.device 0
defaults.rawmidi.subdevice -1
defaults.hwdep.card 0
defaults.hwdep.device 0
defaults.timer.class 2
defaults.timer.sclass 0
defaults.timer.card 0
defaults.timer.device 0
defaults.timer.subdevice 0

#
#  PCM interface
#

# redirect to load-on-demand extended pcm definitions
pcm.cards cards.pcm

pcm.default cards.pcm.default
pcm.front cards.pcm.front
pcm.rear cards.pcm.rear
pcm.center_lfe cards.pcm.center_lfe
pcm.side cards.pcm.side
pcm.surround40 cards.pcm.surround40
pcm.surround41 cards.pcm.surround41
pcm.surround50 cards.pcm.surround50
pcm.surround51 cards.pcm.surround51
pcm.surround71 cards.pcm.surround71
pcm.iec958 cards.pcm.iec958
pcm.spdif iec958
pcm.hdmi cards.pcm.hdmi
pcm.dmix cards.pcm.dmix
pcm.dsnoop cards.pcm.dsnoop
pcm.modem cards.pcm.modem
pcm.phoneline cards.pcm.phoneline

pcm.hw {
        @args [ CARD DEV SUBDEV ]
        @args.CARD {
                type string
                default {
                        @func getenv
                        vars [
                                ALSA_PCM_CARD
                                ALSA_CARD
                        ]
                        default {
                                @func refer
                                name defaults.pcm.card
                        }
                }
        }
        @args.DEV {
                type integer
                default {
                        @func igetenv
                        vars [
                                ALSA_PCM_DEVICE
                        ]
                        default {
                                @func refer
                                name defaults.pcm.device
                        }
                }
        }
        @args.SUBDEV {
                type integer
                default {
                        @func refer
                        name defaults.pcm.subdevice
                }
        }               
        type hw
        card $CARD
        device $DEV
        subdevice $SUBDEV
        hint {
                show {
                        @func refer
                        name defaults.namehint.extended
                }
                description "Direct hardware device without any conversions"
        }
}

pcm.plughw {
        @args [ CARD DEV SUBDEV ]
        @args.CARD {
                type string
                default {
                        @func getenv
                        vars [
                                ALSA_PCM_CARD
                                ALSA_CARD
                        ]
                        default {
                                @func refer
                                name defaults.pcm.card
                        }
                }
        }
        @args.DEV {
                type integer
                default {
                        @func igetenv
                        vars [
                                ALSA_PCM_DEVICE
                        ]
                        default {
                                @func refer
                                name defaults.pcm.device
                        }
                }
        }
        @args.SUBDEV {
                type integer
                default {
                        @func refer
                        name defaults.pcm.subdevice
                }
        }               
        type plug
        slave.pcm {
                type hw
                card $CARD
                device $DEV
                subdevice $SUBDEV
        }
        hint {
                show {
                        @func refer
                        name defaults.namehint.extended
                }
                description "Hardware device with all software conversions"
        }
}

pcm.plug {
        @args [ SLAVE ]
        @args.SLAVE {
                type string
        }
        type plug
        slave.pcm $SLAVE
}

pcm.shm {
        @args [ SOCKET PCM ]
        @args.SOCKET {
                type string
        }
        @args.PCM {
                type string
        }
        type shm
        server $SOCKET
        pcm $PCM
}

pcm.tee {
        @args [ SLAVE FILE FORMAT ]
        @args.SLAVE {
                type string
        }
        @args.FILE {
                type string
        }
        @args.FORMAT {
                type string
                default {
                        @func refer
                        name defaults.pcm.file_format
                }
        }
        type file
        slave.pcm $SLAVE
        file $FILE
        format $FORMAT
        truncate {
                @func refer
                name defaults.pcm.file_truncate
        }
}

pcm.file {
        @args [ FILE FORMAT ]
        @args.FILE {
                type string
        }
        @args.FORMAT {
                type string
                default {
                        @func refer
                        name defaults.pcm.file_format
                }
        }
        type file
        slave.pcm null
        file $FILE
        format $FORMAT
        truncate {
                @func refer
                name defaults.pcm.file_truncate
        }
}

pcm.null {
        type null
        hint {
                show {
                        @func refer
                        name defaults.namehint.basic
                }
                description "Discard all samples (playback) or generate zero samples (capture)"
        }
}

#
#  Control interface
#
       
ctl.default {
        type hw
        card {
                @func getenv
                vars [
                        ALSA_CTL_CARD
                        ALSA_CARD
                ]
                default {
                        @func refer
                        name defaults.ctl.card
                }
        }
}

ctl.hw {
        @args [ CARD ]
        @args.CARD {
                type string
                default {
                        @func getenv
                        vars [
                                ALSA_CTL_CARD
                                ALSA_CARD
                        ]
                        default {
                                @func refer
                                name defaults.ctl.card
                        }
                }
        }
        type hw
        card $CARD
}

ctl.shm {
        @args [ SOCKET CTL ]
        @args.SOCKET {
                type string
        }
        @args.CTL {
                type string
        }
        type shm
        server $SOCKET
        ctl $CTL
}

#
#  RawMidi interface
#

rawmidi.default {
        type hw
        card {
                @func getenv
                vars [
                        ALSA_RAWMIDI_CARD
                        ALSA_CARD
                ]
                default {
                        @func refer
                        name defaults.rawmidi.card
                }
        }
        device {
                @func igetenv
                vars [
                        ALSA_RAWMIDI_DEVICE
                ]
                default {
                        @func refer
                        name defaults.rawmidi.device
                }
        }
}

rawmidi.hw {
        @args [ CARD DEV SUBDEV ]
        @args.CARD {
                type string
                default {
                        @func getenv
                        vars [
                                ALSA_RAWMIDI_CARD
                                ALSA_CARD
                        ]
                        default {
                                @func refer
                                name defaults.rawmidi.card
                        }
                }
        }
        @args.DEV {
                type integer
                default {
                        @func igetenv
                        vars [
                                ALSA_RAWMIDI_DEVICE
                        ]
                        default {
                                @func refer
                                name defaults.rawmidi.device
                        }
                }
        }
        @args.SUBDEV {
                type integer
                default -1
        }
        type hw
        card $CARD
        device $DEV
        subdevice $SUBDEV
        hint {
                description "Direct rawmidi driver device"
                device $DEV
        }
}

rawmidi.virtual {
        @args [ MERGE ]
        @args.MERGE {
                type string
                default 1
        }
        type virtual
        merge $MERGE
}

#
#  Sequencer interface
#

seq.default {
        type hw
}

seq.hw {
        type hw
}

#
#  HwDep interface
#

hwdep.default {
        type hw
        card {
                @func getenv
                vars [
                        ALSA_HWDEP_CARD
                        ALSA_CARD
                ]
                default {
                        @func refer
                        name defaults.hwdep.card
                }
        }
        device {
                @func igetenv
                vars [
                        ALSA_HWDEP_DEVICE
                ]
                default {
                        @func refer
                        name defaults.hwdep.device
                }
        }
}

hwdep.hw {
        @args [ CARD DEV ]
        @args.CARD {
                type string
                default {
                        @func getenv
                        vars [
                                ALSA_HWDEP_CARD
                                ALSA_CARD
                        ]
                        default {
                                @func refer
                                name defaults.hwdep.card
                        }
                }
        }
        @args.DEV {
                type integer
                default {
                        @func igetenv
                        vars [
                                ALSA_HWDEP_DEVICE
                        ]
                        default {
                                @func refer
                                name defaults.hwdep.device
                        }
                }
        }
        type hw
        card $CARD
        device $DEV
}

#
#  Timer interface
#

timer_query.default {
        type hw
}

timer_query.hw {
        type hw
}

timer.default {
        type hw
        class {
                @func refer
                name defaults.timer.class
        }
        sclass {
                @func refer
                name defaults.timer.sclass
        }
        card {
                @func refer
                name defaults.timer.card
        }
        device {
                @func refer
                name defaults.timer.device
        }
        subdevice {
                @func refer
                name defaults.timer.subdevice
        }
        hint.description "Default direct hardware timer device"
}

timer.hw {
        @args [ CLASS SCLASS CARD DEV SUBDEV ]
        @args.CLASS {
                type integer
                default {
                        @func refer
                        name defaults.timer.class
                }
        }
        @args.SCLASS {
                type integer
                default {
                        @func refer
                        name defaults.timer.sclass
                }
        }
        @args.CARD {
                type string
                default {
                        @func refer
                        name defaults.timer.card
                }
        }
        @args.DEV {
                type integer
                default {
                        @func refer
                        name defaults.timer.device
                }
        }
        @args.SUBDEV {
                type integer
                default {
                        @func refer
                        name defaults.timer.subdevice
                }
        }
        type hw
        class $CLASS
        sclass $SCLASS
        card $CARD
        device $DEV
        subdevice $SUBDEV
}


Woodsman 08-22-2009 06:54 PM

Okay, another weekend and I'm back to trying to resolve this silly problem. :)

To recap, I'm using Slackware Current/13.0 with a 2.6.30.4 kernel.

Ideally, I want sound through both external speakers (analog device 0:0) and HDMI (device 0:3). Which device is primary is not important. The box should send audio to both devices. I want the external speakers as an available audio device because I'm a long way from configuring this box as a HTPC and testing in my office is more convenient. Yet I need sound through HDMI for when I test configuration changes with my HD TV.

The aplay -l command does list the HDMI audio device. That seems to be half the battle. However, I cannot consistently get any audio through HDMI when I use Current/13.0. I can get audio with xbmc and sometimes with PCLOS.

First test this weekend in my office with small, cheap, external speakers from a console (no X):

mplayer -ao alsa:device=hw=0.0 soundfile

I hear the wave file from my external speakers. I then tried a slight variation:

mplayer -ao alsa:device=plughw=0.0 soundfile

I again hear the sound file.

I moved the PC from the office to the HD TV. I connected a (3.5 mm) stereo speaker cable from the PC audio out port to the TV computer audio port. The TV audio port is intended for use with the D-Sub/RGB video connector.

I heard the test file from the HD TV speakers with both mplayer commands (using analog device 0:0).

Next test was the HDMI audio device:

mplayer -ao alsa:device=hw=0.3 soundfile

Nothing.

Next:

mplayer -ao alsa:device=plughw=0.3 soundfile

Nothing.

Next I added the following changes to /usr/share/alsa/alsa.conf:

#defaults.pcm.device 0
defaults.pcm.device 1
#defaults.pcm.dmix.rate 48000
defaults.pcm.dmix.rate 44100


I restarted alsa and tried the same mplayer commands.

I had sound from the analog device (0:0) but no sound from the HDMI device (0:3). :(

I disabled the /etc/asound.conf file and rebooted. Same results. :(

I restored /usr/share/alsa/alsa.conf.

Some strangeness: when I'm not in X, the mplayer and speaker-test command line tests to the analog device (0:0) are good. That is, I hear audio through the TV speakers but through the analog device (0:0). The same tests to the HDMI audio device (0:3) fail. When I start X there is no audio with the same tests to the analog device 0:0. Yet in X I get audio through the TV speakers through the HDMI audio device (0:3). I toggled to a different console outside X and I can hear audio through 0:0 but not 0:3.

More strangeness: Although I get audio through HDMI with the command line tests in X, I have no audio from any GUI media player (Xine, MPlayer, Dragon Player) with either port. KMix and alsamixer shows no muted ports.

At the moment I sort of have audio through HDMI but everything is hit and miss. I'm not seeing any patterns. Why no audio through the media players? :scratch:

As a side note, I have been able to get audio through HDMI in xbmc. Yet I noticed in my several previous tests with xbmc that audio and video often are out of sync.

forum1793 08-22-2009 08:59 PM

A little hard to help you since I don't have that hardware.

Back up a little bit. What does lspci and lsmod show?

Here is one link that has this working. You've probably already seen it. It shows a 2.6.28 kernel works. So maybe a 2.6.27.x won't work for you. Seems the 2.6.30.x should.

What did you select when building custom kernel for the audio driver?
My guess is you would pick all modules
Code:

Sound card support
 PCI sound devices
  Intel HD Audio
    Build Realtek HD-audio codec support
    Build NVIDIA HDMI HD-audio codec
    Enable generic HD-audio codec support

.

Since you already show the device in aplay -l, I would think the rest is turning it on via the video driver. Is there maybe an option required in xorg.conf for this? For example with the proprietary radeon driver (catalyst aka fglrx) this now seems to be enabled per default but with the radeonhd open source driver I have to explicitly turn this on with something like:
Code:

Section "Device"
        Identifier  "RadeonVid"
        Driver "radeonhd"
        Option "HDMI" "all"
EndSection

To set mplayer from command line to default to hdmi, in home/youruser/.mplayer/config, you want a line:
ao="alsa:device=hw=0.3"

Xine gets set in its gui but if you look at home/youruser/.xine/config, you should have something like:
Code:

# device used for stereo output
# string, default: plug:front:default
audio.device.alsa_front_device:plughw:0,3


forum1793 08-22-2009 09:25 PM

Last suggestion I came across is to upgrade bios and check settings.

Link

Link

Good luck.

Woodsman 08-22-2009 11:45 PM

lspci output:

Code:

00:10.1 Audio device: nVidia Corporation MCP51 High Definition Audio (rev a2)
  Subsystem: ASUSTeK Computer Inc. Unknown device 81cb
  Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 22
  Memory at fe024000 (32-bit, non-prefetchable) [size=16K]
  Capabilities: [44] Power Management version 2
  Capabilities: [50] Message Signalled Interrupts: Mask+ 64bit+ Queue=0/0 Enable-
  Capabilities: [6c] HyperTransport: MSI Mapping Enable- Fixed+
  Kernel driver in use: HDA Intel
  Kernel modules: snd-hda-intel

lsmod | grep snd_hda_intel output
Code:

snd    46884 12 snd_seq_oss,snd_seq,snd_seq_device,snd_pcm_oss,snd_mixer_oss,snd_hda_intel,snd_pcm,snd_timer
snd_hda_intel  358540 3
snd_page_alloc  7560 2 snd_hda_intel,snd_pcm
snd_pcm    59140 3 snd_pcm_oss,snd_hda_intel

Quote:

Here is one link that has this working.
Yes, I have seen that thread. Thanks. :) Seems so simple yet so many people experience different results. Weird.

Quote:

Since you already show the device in aplay -l, I would think the rest is turning it on via the video driver. Is there maybe an option required in xorg.conf for this?
I thought something similar but I see nothing in the nvidia-settings tool. :scratch:

Quote:

audio.device.alsa_front_device:plughw:0,3
Well! That trick seemed to awaken xine! Gxine now seems to work too. By the way how did gxine end up as the default media player in KDE 4.x? :scratch:

Quote:

ao="alsa:device=hw=0.3"
Well! That trick seemed to awaken mplayer!

No audio yet from dragon.

Quote:

Last suggestion I came across is to upgrade bios and check settings.
BIOS is the latest 0604. First thing I did when I powered up the box was flash the BIOS. :)

Well, that I have xine working is a partial victory.

However, the system does not always terminate the audio and leaves a background humming noise. Seems I have to exit X, reboot, run another video, or send a test audio from the command line to stop the humming. Once again, I don't see any patterns.

One thing adding to the frustration is nothing in KDE 4.x is configured the way I liked in KDE 3.5.10. I have to reconfigure everything in KDE from scratch. :(

forum1793 08-23-2009 08:40 AM

gxine: agreed. First thing I did was relink those suffixes back to xine or mplayer. xine seems to work better with screen scaling (or I haven't figured how to do it with mplayer). Mplayer lets you go back a few seconds which xine is not good at.

I get high pitched oscillator sound when first starting X. This happens for me with either the proprietary or open source drivers. I use the TV remote to flip between TV and hdmi 1 to 5 times and it goes away.

Since you have mplayer working with hdmi out (probably in -current) you have something mythtv can use. Problem now is mythtv didn't run or compile with qt4 which is in -current. Maybe they've fixed this by now. We'll have to check.

Woodsman 08-23-2009 10:59 AM

Quote:

gxine: agreed.
Just weird. Then again, I seem to recall that any time gxine is installed that the app is given or grabs precedence over other apps. I always remove the package but for those few days when gxine is installed, seems that is the behavior. Must be something in the packaging?

Quote:

I get high pitched oscillator sound when first starting X. This happens for me with either the proprietary or open source drivers. I use the TV remote to flip between TV and hdmi 1 to 5 times and it goes away.
I haven't yet noticed any pattern when the humming noise starts. If I terminate a video in xine by pressing the q key, then this sometimes happen. I'll try to remember to experiment with stopping the video before pressing the quit key and see whether that makes a difference.

Quote:

Since you have mplayer working with hdmi out (probably in -current) . . .
Yes, I have given up trying to get audio through HDMI in 12.2 :( and am now only testing Current/13.0.

I still prefer KDE 3.5.10. However, as this box will be an HTPC, I'm not overly concerned with several issues many people (including me) have with KDE 4. All I need is a basic desktop, some basic file management and a tool to watch videos. Gradually I'm trying to get KDE 4 configured to my taste but the process is slow. I have read many times not to try to merge KDE 3.5 configuration settings into KDE 4. So reconfiguring from scratch is painful. Some things are the same, some are not. I still haven't grasped how to completely configure the panel.

I will say that KDE 4 is much more pleasing to view on the HD TV than KDE 3.5.10 or Xfce 4.6.1. I would like to know why the latter two look so grainy and awful on the TV when KDE 4 does not.

XBMC also looks much nicer on the TV but I can't get that interface to play videos without losing sync between video and audio. I was considering XBMC as an option for an HTPC interface. I found an XBMC Slackware build script for 12.2 but I'm going to guess the build will fail with Current. I have a feeling that XBMC will run better as a package on Slackware rather than integrated into Ubuntu as is done with the Live CD version I installed.

Quote:

. . . you have something mythtv can use. Problem now is mythtv didn't run or compile with qt4 which is in -current. Maybe they've fixed this by now. We'll have to check.
That has been a background concern for me. As I now seem "stuck" with using Current to get audio through HDMI, that means waiting to see which third-party packages will successfully build with Current/13.0. I can "survive" with a basic KDE desktop to watch TV recordings and DVDs. I wrote some very basic scripts to record TV, which I have been using for several months under 12.2. Function before form. :) Yet eventually I'd like a nice interface for the project. Also MythTV provides more robustness than my meager scripts for scheduling recordings and archiving.

Odd, now that I sort of have audio through HDMI. I pretty much use xine to watch any recordings or DVDs but now xine is hard-coded to only send audio to HDMI. When I have the PC in my office I'm connected to some inexpensive external computer speakers and I have to manually reconfigure xine to route audio back to the external speakers rather than HDMI. In the end I'll only be using the TV but during this experiment and testing phase I need both audio devices. I'm hoping I can find a way for xine to concurrently send audio to both devices. :scratch:

forum1793 09-04-2009 08:10 PM

No one responded for a bit so I'll suggest something. Any luck using Jack? Maybe output to both outlets at nearly same time?

I only briefly tried Jack but didn't have much luck.

Woodsman 09-04-2009 10:53 PM

I have audio over HDMI now working in 13.0. I had to hard-code the Xine config file to send audio to HDMI. I wrote a shell script to thelp me toggle to external speakers when I have the box connected in my office and vice-versa. Clunky but doable. :)

I haven't a clue about Jack.


All times are GMT -5. The time now is 06:09 PM.