Author Topic: How the #@$# do I customize asound.conf?  (Read 5430 times)

m3freak

  • Veteran
  • ***
  • Posts: 125
    • View Profile
How the #@$# do I customize asound.conf?
« on: November 12, 2011, 06:21:55 pm »
I edited asound.conf in /usr/pluto/diskless/29/usr/pluto/templates, rebooted my MD, and still don't get any sound via the HDMI connection.  This is what the MD's asound.conf looks like now:

Code: [Select]
pcm_slave.spdif_convert48k {
pcm "spdif:%MAIN_CARD%"
rate 48000
}

pcm.spdif_playback {
type plug
slave spdif_convert48k
}

pcm_slave.hdmi_convert48k {
pcm "hdmi:%MAIN_CARD%"
rate 48000
}

pcm.hdmi_playback {
type plug
slave hdmi_convert48k
}

pcm.asym_spdif {
type asym
playback.pcm "spdif_playback"
capture.pcm "plughw:%MAIN_CARD%"
}

pcm.asym_hdmi {
type asym
playback.pcm "hdmi_playback"
capture.pcm "plughw:%MAIN_CARD%"
}

pcm.asym_analog {
type asym
playback.pcm "plug:dmix:%MAIN_CARD%"
capture.pcm "plughw:%MAIN_CARD%"
}

pcm.hdmi {
type hw
card 0
device 7
}

Can someone PLEASE tell what the hell to do?  Which file am I supposed to edit?  WTH am I supposed to put in it?  I can't find shit on the wiki, and nothing in the forums gives me a fix that survives reboot.

I admin massive Linux systems running a huge variety of applications and services, and yet LinuxMCE has completely stumped me.  WTF.  :(


merkur2k

  • Addicted
  • *
  • Posts: 513
    • View Profile
Re: How the #@$# do I customize asound.conf?
« Reply #1 on: November 12, 2011, 07:09:55 pm »
LMCE attempts to "self-repair" as much as possible, and as such most config files are regenerated at boot. usually all you need to do is make sure settings are correct on the various devices in the web admin, but for more customizing you may need to modify the scripts that write the config files. these are generally in various .sh files in /usr/pluto/bin.
there is often a better way of doing whatever it is that you are trying to accomplish though, and in particular if its a bug in something, others might appreciate the contribution of proper patch.

m3freak

  • Veteran
  • ***
  • Posts: 125
    • View Profile
Re: How the #@$# do I customize asound.conf?
« Reply #2 on: November 13, 2011, 03:06:58 am »
LMCE attempts to "self-repair" as much as possible, and as such most config files are regenerated at boot. usually all you need to do is make sure settings are correct on the various devices in the web admin, but for more customizing you may need to modify the scripts that write the config files. these are generally in various .sh files in /usr/pluto/bin.

Last time I asked this (which was recently), I was told to edit files in the MD's template dir.  So, I did.  It didn't help. I cried...lots.

Now I'm supposed to edit the scripts that generate the config files.  This sounds to me like a non-permanent solution, too.  What will happen if there's an upgrade that includes the very file I changed?  Won't it be over written?

This is the file I'm looking to change now: /usr/pluto/bin/SetupAudioVideo.sh.  This is the section I believe I should change:
Code: [Select]
Setup_AsoundConf()
{
        local AudioSetting="$1"
        local SoundCard

        SoundCard=$(GetDeviceData "$PK_Device" "$DEVICEDATA_Sound_Card"|cut -f2 -d";")
        SoundCard=$(TranslateSoundCard "$SoundCard")
        if [[ -z "$SoundCard" ]]; then
                SoundCard=0
        fi
        sed -r "s,%MAIN_CARD%,$SoundCard,g" /usr/pluto/templates/asound.conf >/etc/asound.conf

        case "$AudioSetting" in
                *[CO]*)
                        # audio setting is Coaxial or Optical, i.e. S/PDIF
                        echo 'pcm.!default asym_spdif' >>/etc/asound.conf
                        EnableDigitalOutputs
                ;;
                *H*)
                        # audio setting is HDMI
                        echo 'pcm.!default asym_hdmi' >>/etc/asound.conf
                        EnableDigitalOutputs
                ;;
                *)
                        # audio setting is Stereo or something unknown
                        echo 'pcm.!default asym_analog' >>/etc/asound.conf
                ;;
        esac
}

I think if I change the "*H*)" case to the following, audio over HDMI will start working on every boot.:
Code: [Select]
*H*)
                        # audio setting is HDMI
                        echo -e 'pcm.!default {\n\ttype hw\n\tcard 0\n\tdevice 7\n}' >> /etc/asound.conf
                        EnableDigitalOutputs

Will that work? Should I do something else?  Maybe I should try updating the nvidia drivers before messing with the setup scripts.

there is often a better way of doing whatever it is that you are trying to accomplish though, and in particular if its a bug in something, others might appreciate the contribution of proper patch.

I have a Jetway Ecomini. It has a nvidia chipset, which appears to be detected correctly.  But, the asound.conf that gets created doesn't give me ANY sound over HDMI.  In the other thread I started, I explain what I've tried (http://forum.linuxmce.org/index.php/topic,12082.0.html).

tux-box1

  • Veteran
  • ***
  • Posts: 80
    • View Profile
Re: How the #@$# do I customize asound.conf?
« Reply #3 on: November 13, 2011, 03:54:08 pm »
What I had to do was connect my video card to my SPDIF sound connector on my Mother board. set the mother board up for spdif pass-through or something like that(i'm not in front of my system.) then during the setup wizard I had to full the system to think it was passing video through DVI, after I could see what I was doing I changed it to HDMI. Then during the sound setup I changed the sound settings to SPDIF optical or SPDIF Coaxial (not in front of system). Sound and Video over HDMI worked after that.
I hope this helps you.

m3freak

  • Veteran
  • ***
  • Posts: 125
    • View Profile
Re: How the #@$# do I customize asound.conf?
« Reply #4 on: November 15, 2011, 07:00:30 am »
What I had to do was connect my video card to my SPDIF sound connector on my Mother board. set the mother board up for spdif pass-through or something like that(i'm not in front of my system.) then during the setup wizard I had to full the system to think it was passing video through DVI, after I could see what I was doing I changed it to HDMI. Then during the sound setup I changed the sound settings to SPDIF optical or SPDIF Coaxial (not in front of system). Sound and Video over HDMI worked after that.
I hope this helps you.


That's utterly insane.  Why do you have to jump through so many hoops just to get HDMI audio to work? I can't believe I'm having so many problems: it has to be because of the old version of Ubuntu being used as a base for the current LinuxMCE release. :(

I haven't tested my changes yet.  As soon as I do, I will report back here.

Note: I'm really starting to dislike this project.  I may just abandon it and my home automation goals and revist when the next LinuxMCE version is released (the one based on 1010).

alx2k

  • Regular Poster
  • **
  • Posts: 45
    • View Profile
Re: How the #@$# do I customize asound.conf?
« Reply #5 on: November 15, 2011, 08:34:32 am »
What I did in my system was to create a "asound.conf.ok" file with the proper configuration and change the .sh created "asound.conf" with the one I created on the last step of the bootup.

That did the trick.

Check http://forum.linuxmce.org/index.php/topic,11460.msg79404.html#msg79404 and read replies 8 and 9

Alejandro.

Murdock

  • Guru
  • ****
  • Posts: 229
    • View Profile
Re: How the #@$# do I customize asound.conf?
« Reply #6 on: February 04, 2012, 10:16:16 pm »
m3freak - I can't speak for tux-box1's issue, though what you're seeing is the lack of support for the ion2 chipset for hdmi audio, specifically on 10.04. I've also been looking around the internet and it appears that in order to get this to function correctly you need to update both alsa drivers as well as the nvidia driver as well as manually modify the asound.conf file. My initial thought was that instead of updating alsa and nvidia for these specific boards (though possible and I've scripted some basic detection and installation based on board type here: http://svn.linuxmce.org/trac.cgi/ticket/1153 ) instead to wait for 12.04 to come out since all the updates required will already be there.

I'm curious, I saw in another thread that you had been able to get HDMI audio working. Would you mind describing what you did and what pieces of media you've tested (i.e. myth, dvd, avi, mp3, etc)?

m3freak

  • Veteran
  • ***
  • Posts: 125
    • View Profile
Re: How the #@$# do I customize asound.conf?
« Reply #7 on: February 05, 2012, 04:22:24 am »
m3freak - I can't speak for tux-box1's issue, though what you're seeing is the lack of support for the ion2 chipset for hdmi audio, specifically on 10.04. I've also been looking around the internet and it appears that in order to get this to function correctly you need to update both alsa drivers as well as the nvidia driver as well as manually modify the asound.conf file. My initial thought was that instead of updating alsa and nvidia for these specific boards (though possible and I've scripted some basic detection and installation based on board type here: http://svn.linuxmce.org/trac.cgi/ticket/1153 ) instead to wait for 12.04 to come out since all the updates required will already be there.

I'm curious, I saw in another thread that you had been able to get HDMI audio working. Would you mind describing what you did and what pieces of media you've tested (i.e. myth, dvd, avi, mp3, etc)?

I'll start a new thread.  But, I really want to write a wiki article, so I'm going to do that soon, too.