[LINUX] ALSA audio, HDMI and analog, on Acer Revo 3610

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
liamf Offline
Member
Posts: 97
Joined: Mar 2010
Reputation: 0
Location: Ireland
Post: #1
Hi

new XBMC user here, just starting to get XBMC setup in earnest (have had it for a while) with arrival of new TV and completion of home network and NAS setup.

Have Acer Revo 3610, running Ubuntu 9.10, XBMC Camelot.

I want to have audio output over HDMI and the analog headphone socket from XBMC at the same time.

I have read some ALSA setup hints here and over in the MythTV forums and using those have defined three pcm outputs in my system-wide asound.conf: analog (== headphone jack), digital ( == hdmi), and xbmc ( == both).

From the unix command line this appears to be working.
If I use $speaker-test -D <pcm> -c2 I can hear sound as expected, either analog, hdmi, or both depending on the pcm output I select.

Using $aplay -D <device> <wav file> I can also play a .wav file over one, other, or both.

In XBMC, if I select "custom" as the output device, and plug:analog or plug:digital as the device, I get audio to the appropriate output. But if I select plug:xbmc, I just get noise. To both outputs mind, but just noise. Doesn't seem to matter if I select "analog" or "digital" as the audio format.

So I am clearly missing something in my understanding of how this works.
Can someone enlighten me, or point to the appropriate FAQ/documentation?

Thanks a lot for any hints.

Regards
Liam
(This post was last modified: 2010-03-26 00:42 by liamf.)
find quote
liamf Offline
Member
Posts: 97
Joined: Mar 2010
Reputation: 0
Location: Ireland
Post: #2
liamf Wrote:I have read some ALSA setup hints here and over in the MythTV forums and using those have defined three pcm outputs in my system-wide asound.conf: analog (== headphone jack), digital ( == hdmi), and xbmc ( == both).

From the unix command line this appears to be working.
If I use $speaker-test -D <pcm> -c2 I can hear sound as expected, either analog, hdmi, or both depending on the pcm output I select.

In XBMC, if I select "custom" as the output device, and plug:analog or plug:digital as the device, I get audio to the appropriate output. But if I select plug:xbmc, I just get noise.

Some more playing around and I found the solution for this. It was almost correct ...

The correct device to put into the audio output is "ALSA:XBMC" and not "PLUG:XBMC", where I have defined the XBMC device in the asound.conf to be both analog and HDMI.

Cool!
find quote
Th3R00st3r Offline
Senior Member
Posts: 110
Joined: Nov 2008
Reputation: 0
Post: #3
My asound.conf has the following on my Revo 1600,
Code:
pcm.!hdmi-remap {
type asym
playback.pcm {
type plug
slave.pcm "remap-surround71"
}
}

pcm.!remap-surround71 {
  type route
  slave.pcm "hw:0,3"
  ttable {
    0.0= 1
    1.1= 1
    2.4= 1
    3.5= 1
    4.2= 1
    5.3= 1
    6.6= 1
    7.7= 1
  }
}

I have HDMI audio, but need analog (headphone jack) to work for the time being as my receiver doesn't have hdmi and I am waiting for an hdmi switch that outputs optical as well. It just isn't here yet and I need sound through the receiver and not the tv.

What did you do to your asound.conf to allow both?
find quote
liamf Offline
Member
Posts: 97
Joined: Mar 2010
Reputation: 0
Location: Ireland
Post: #4
Th3R00st3r Wrote:I have HDMI audio, but need analog (headphone jack) to work for the time being as my receiver doesn't have hdmi and I am waiting for an hdmi switch that outputs optical as well. It just isn't here yet and I need sound through the receiver and not the tv.

What did you do to your asound.conf to allow both?

I have this:

Code:
# ~/.asoundrc or /etc/asound.conf
# ALSA configuration file

##### USAGE #####
# Save this file as "~/.asoundrc" (for user-specific sound configuration) or
# "/etc/asound.conf" (for system-wide sound configuration) and specify ALSA
# device names ad described in the next section.


##### DEVICE NAMES #####
# This configuration file defines four devices for use by the user.  Those
# devices are "analog", "mixed-analog", "digital", and "mixed-digital".  The
# user may also re-define "default" to be identical to one of the above-named
# devices (i.e. to send all sound output to the digital output unless otherwise
# specified).  Use the device names as described below:
#  - "analog" outputs to the analog output directly and (at least on software
#  sound cards) blocks other audio output.  After playback completes, "queued"
#  sounds are output in sequence.
#  - "mixed-analog" mixes audio output from multiple programs into the analog
#  output (so you can hear beeps, alerts, and other noises while playing back
#  an audio stream).
#  - "digital" outputs to the digital output directly.  Since most (all?)
#  digital outputs expect 48kHz PCM audio, this may not work for some playback
#  (i.e. CD's--which are 44.1kHz PCM audio--or 32kHz audio streams from TV
#  recordings, etc.).
#  - "mixed-digital"

# All other devices created within this file are used only by the configuration
# file itself and should /not/ be used directly.  In other words, do not use
# the devices "analog-hw", "dmix-analog", "digital-hw", or "dmix-digital".


##### IMPORTANT #####
# To make this ALSA configuration file work with your sound card, you will need
# to define the appropriate card and device information for the "analog-hw" and
# "digital-hw" devices below.  You can find the card and device information
# using "aplay -l".

# Alias for (converted) analog output on the card
# - This is identical to the device named "default"--which always exists and
# refers to hw:0,0 (unless overridden)
# - Therefore, we can specify "hw:0,0", "default", or "analog" to access analog
# output on the card
# - Note that as of ALSA 1.0.9, "software" sound card definitions redefine
# "default" to do mixing, meaning this device is different from "default" and
# allows playback while blocking other sound sources (until playback
# completes).
pcm.analog {
  type plug
  slave.pcm "analog-hw"
  hint {
    show on
    description "Analog Output - Use analog outputs, converting samples, format, and rate as necessary."
  }
}

# Control device (mixer, etc.) for the card
ctl.analog {
  type hw
  card 0
}

# Alias for (converted) mixed analog output on the card
# - This will accept audio input--regardless of rate--and convert to the rate
# required for the dmix plugin (in this case 48000Hz)
# - Note that as of ALSA 1.0.9, "software" sound card definitions redefine
# "default" to do mixing, meaning this device is identical to "default" for
# "software" sound cards.
pcm.mixed-analog {
  type plug
  slave.pcm "dmix-analog"
  hint {
    show on
    description "Mixed Analog Output - Use analog outputs, converting samples, format, and rate as necessary. Allows mixing with system sounds."
  }
}

# Control device (mixer, etc.) for the card
ctl.mixed-analog {
  type hw
  card 0
}

# Alias for (converted) digital (HDMI) output on the card
pcm.digital {
  type plug
  slave.pcm "digital-hw"
  hint {
    show on
    description "Digital Output - Use digital outputs, converting samples, format, and rate as necessary."
  }
}

# Control device (mixer, etc.) for the card
ctl.digital {
  type hw
  card 0
}

# Alias for mixed (converted) digital (HDMI) output on the card

pcm.mixed-digital {
  type plug
  slave.pcm "dmix-digital"
  hint {
    show on
    description "Mixed Digital Output - Use digital outputs, converting samples, format, and rate as necessary. Allows mixing with system sounds."
  }
}

# Control device (mixer, etc.) for the card
ctl.mixed-digital {
  type hw
  card 0
}

# The following devices are not useful by themselves.  They require specific
# rates, channels, and formats.  Therefore, you probably do not want to use
# them directly.  Instead use of of the devices defined above.

# Alias for analog output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.analog-hw {
  type hw
  card 0
  device 0
}

# Control device (mixer, etc.) for the card
ctl.analog-hw {
  type hw
  card 0
}

# Alias for digital (HDMI) output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.digital-hw {
  type hw
  card 0
  device 3
}

# Control device (mixer, etc.) for the card
ctl.digital-hw {
  type hw
  card 0
}

# Direct software mixing plugin for analog output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.dmix-analog {
  type dmix
  ipc_key 1234
  slave {
    pcm "analog-hw"
    period_time 0
    period_size 1024
    buffer_size 4096
    rate 48000
  }
}

# Control device (mixer, etc.) for the card
ctl.dmix-analog {
  type hw
  card 0
}

# Direct software mixing plugin for digital (S/PDIF) output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.dmix-digital {
  type dmix
  ipc_key 1235
  slave {
    pcm "digital-hw"
    period_time 0
    period_size 1024
    buffer_size 4096
    rate 48000
  }
}

# Control device (mixer, etc.) for the card
ctl.dmix-digital {
  type hw
  card 0
}

# Make joint analog/HDMI the default
pcm.!default {
  type plug
  slave {
    pcm multi
    rate 48000
  }
  ttable.0.0 1.0
  ttable.1.1 1.0
  ttable.0.2 1.0
  ttable.1.3 1.0
}

# Control device (mixer, etc.) for the card
ctl.!default {
  type hw
  card 0
}

pcm.xbmc {
  type plug
  slave {
    pcm multi
    rate 48000
    channels 4
  }
  ttable.0.0 1.0
  ttable.1.1 1.0
  ttable.0.2 1.0
  ttable.1.3 1.0
}


ctl.xbmc {
  type hw
  card 0
}

pcm.multi {
  type multi
  slaves.a.pcm "analog-hw"
  slaves.a.channels 2
  slaves.b.pcm "digital-hw"
  slaves.b.channels 2
  bindings.0.slave a
  bindings.0.channel 0
  bindings.1.slave a
  bindings.1.channel 1
  bindings.2.slave b
  bindings.2.channel 0
  bindings.3.slave b
  bindings.3.channel 1
}

ctl.multi {
  type hw
  card 0
}

"XBMC" is the name I gave the combined HDMI/Analog output. I didn't figure this out all on my own, either: I learned from the excellent post here: http://forum.xbmc.org/showthread.php?tid=58978 which almost worked for me.

It was the ALSA: instead of PLUG: in the XBMC settings which finally did the magic.

On a 3610 the HDMI output is device 3.
And you have to have to have the pcm.!default section so that menu sounds work properly (they work fine for me too).

HTH

Liam
find quote
liamf Offline
Member
Posts: 97
Joined: Mar 2010
Reputation: 0
Location: Ireland
Post: #5
I also notice as I post it there that some of the comments in the asound.conf file are not correct any more - as shown it is for the HDMI output on the Revo and not the S/PDIF output ....

So references to S/PDIF in the comments should be ignored.

It shouldn't be hard to have HDMI + Analog + S/PDIF all working using the same technique probably, but I don't have an optical amp next to the XBMC box to check it, so you'd have to try that yourself ...
find quote
Th3R00st3r Offline
Senior Member
Posts: 110
Joined: Nov 2008
Reputation: 0
Post: #6
Thanks Liamf. I have a Revo 1600 and I am assuming this would work the same for the 1600 as it does the 3610, but I also assume it is using different hardware so I will backup my original asound.conf before I muck it up.

Thanks!
find quote
kola Offline
Junior Member
Posts: 7
Joined: Jul 2009
Reputation: 0
Post: #7
This works indeed and I can recommend it to anyone with Revo 3610 who needs HDMI and analog audio output.
Thanks Liamf!
find quote
Michael 2010 Offline
Junior Member
Posts: 25
Joined: May 2010
Reputation: 0
Post: #8
where is this file and how you edit am have the same problem cant get hdmi audio out me revo 3610?

liamf Wrote:I have this:

Code:
# ~/.asoundrc or /etc/asound.conf
# ALSA configuration file

##### USAGE #####
# Save this file as "~/.asoundrc" (for user-specific sound configuration) or
# "/etc/asound.conf" (for system-wide sound configuration) and specify ALSA
# device names ad described in the next section.


##### DEVICE NAMES #####
# This configuration file defines four devices for use by the user.  Those
# devices are "analog", "mixed-analog", "digital", and "mixed-digital".  The
# user may also re-define "default" to be identical to one of the above-named
# devices (i.e. to send all sound output to the digital output unless otherwise
# specified).  Use the device names as described below:
#  - "analog" outputs to the analog output directly and (at least on software
#  sound cards) blocks other audio output.  After playback completes, "queued"
#  sounds are output in sequence.
#  - "mixed-analog" mixes audio output from multiple programs into the analog
#  output (so you can hear beeps, alerts, and other noises while playing back
#  an audio stream).
#  - "digital" outputs to the digital output directly.  Since most (all?)
#  digital outputs expect 48kHz PCM audio, this may not work for some playback
#  (i.e. CD's--which are 44.1kHz PCM audio--or 32kHz audio streams from TV
#  recordings, etc.).
#  - "mixed-digital"

# All other devices created within this file are used only by the configuration
# file itself and should /not/ be used directly.  In other words, do not use
# the devices "analog-hw", "dmix-analog", "digital-hw", or "dmix-digital".


##### IMPORTANT #####
# To make this ALSA configuration file work with your sound card, you will need
# to define the appropriate card and device information for the "analog-hw" and
# "digital-hw" devices below.  You can find the card and device information
# using "aplay -l".

# Alias for (converted) analog output on the card
# - This is identical to the device named "default"--which always exists and
# refers to hw:0,0 (unless overridden)
# - Therefore, we can specify "hw:0,0", "default", or "analog" to access analog
# output on the card
# - Note that as of ALSA 1.0.9, "software" sound card definitions redefine
# "default" to do mixing, meaning this device is different from "default" and
# allows playback while blocking other sound sources (until playback
# completes).
pcm.analog {
  type plug
  slave.pcm "analog-hw"
  hint {
    show on
    description "Analog Output - Use analog outputs, converting samples, format, and rate as necessary."
  }
}

# Control device (mixer, etc.) for the card
ctl.analog {
  type hw
  card 0
}

# Alias for (converted) mixed analog output on the card
# - This will accept audio input--regardless of rate--and convert to the rate
# required for the dmix plugin (in this case 48000Hz)
# - Note that as of ALSA 1.0.9, "software" sound card definitions redefine
# "default" to do mixing, meaning this device is identical to "default" for
# "software" sound cards.
pcm.mixed-analog {
  type plug
  slave.pcm "dmix-analog"
  hint {
    show on
    description "Mixed Analog Output - Use analog outputs, converting samples, format, and rate as necessary. Allows mixing with system sounds."
  }
}

# Control device (mixer, etc.) for the card
ctl.mixed-analog {
  type hw
  card 0
}

# Alias for (converted) digital (HDMI) output on the card
pcm.digital {
  type plug
  slave.pcm "digital-hw"
  hint {
    show on
    description "Digital Output - Use digital outputs, converting samples, format, and rate as necessary."
  }
}

# Control device (mixer, etc.) for the card
ctl.digital {
  type hw
  card 0
}

# Alias for mixed (converted) digital (HDMI) output on the card

pcm.mixed-digital {
  type plug
  slave.pcm "dmix-digital"
  hint {
    show on
    description "Mixed Digital Output - Use digital outputs, converting samples, format, and rate as necessary. Allows mixing with system sounds."
  }
}

# Control device (mixer, etc.) for the card
ctl.mixed-digital {
  type hw
  card 0
}

# The following devices are not useful by themselves.  They require specific
# rates, channels, and formats.  Therefore, you probably do not want to use
# them directly.  Instead use of of the devices defined above.

# Alias for analog output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.analog-hw {
  type hw
  card 0
  device 0
}

# Control device (mixer, etc.) for the card
ctl.analog-hw {
  type hw
  card 0
}

# Alias for digital (HDMI) output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.digital-hw {
  type hw
  card 0
  device 3
}

# Control device (mixer, etc.) for the card
ctl.digital-hw {
  type hw
  card 0
}

# Direct software mixing plugin for analog output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.dmix-analog {
  type dmix
  ipc_key 1234
  slave {
    pcm "analog-hw"
    period_time 0
    period_size 1024
    buffer_size 4096
    rate 48000
  }
}

# Control device (mixer, etc.) for the card
ctl.dmix-analog {
  type hw
  card 0
}

# Direct software mixing plugin for digital (S/PDIF) output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.dmix-digital {
  type dmix
  ipc_key 1235
  slave {
    pcm "digital-hw"
    period_time 0
    period_size 1024
    buffer_size 4096
    rate 48000
  }
}

# Control device (mixer, etc.) for the card
ctl.dmix-digital {
  type hw
  card 0
}

# Make joint analog/HDMI the default
pcm.!default {
  type plug
  slave {
    pcm multi
    rate 48000
  }
  ttable.0.0 1.0
  ttable.1.1 1.0
  ttable.0.2 1.0
  ttable.1.3 1.0
}

# Control device (mixer, etc.) for the card
ctl.!default {
  type hw
  card 0
}

pcm.xbmc {
  type plug
  slave {
    pcm multi
    rate 48000
    channels 4
  }
  ttable.0.0 1.0
  ttable.1.1 1.0
  ttable.0.2 1.0
  ttable.1.3 1.0
}


ctl.xbmc {
  type hw
  card 0
}

pcm.multi {
  type multi
  slaves.a.pcm "analog-hw"
  slaves.a.channels 2
  slaves.b.pcm "digital-hw"
  slaves.b.channels 2
  bindings.0.slave a
  bindings.0.channel 0
  bindings.1.slave a
  bindings.1.channel 1
  bindings.2.slave b
  bindings.2.channel 0
  bindings.3.slave b
  bindings.3.channel 1
}

ctl.multi {
  type hw
  card 0
}

"XBMC" is the name I gave the combined HDMI/Analog output. I didn't figure this out all on my own, either: I learned from the excellent post here: http://forum.xbmc.org/showthread.php?tid=58978 which almost worked for me.

It was the ALSA: instead of PLUG: in the XBMC settings which finally did the magic.

On a 3610 the HDMI output is device 3.
And you have to have to have the pcm.!default section so that menu sounds work properly (they work fine for me too).

HTH

Liam
find quote
liamf Offline
Member
Posts: 97
Joined: Mar 2010
Reputation: 0
Location: Ireland
Post: #9
Quote:where is this file and how you edit am have the same problem cant get hdmi audio out me revo 3610?

As stated in the comments in the quoted code, the simplest thing to do with that file that I quote is to copy it, verbatim, to the file /etc/asound.conf

On your system by default this file will probably not exist (I forget to be honest).

Just create a text file using your favourite text editor and populate it with the contents I listed in my post.

Then configure the sound in XMBC as stated.

The restart XBMC.

And you should be all set.
find quote
Michael 2010 Offline
Junior Member
Posts: 25
Joined: May 2010
Reputation: 0
Post: #10
still cant get audio this what done

1 copy the file asound.conf in to etc/
then went to system/prefence/sound /hardware change that to digital hdmi stero out put
xbmc change that to digital audio out put select custom and type ALSA:XBMC in caps lock

is this right michael
find quote
liamf Offline
Member
Posts: 97
Joined: Mar 2010
Reputation: 0
Location: Ireland
Post: #11
That is not terribly clear I'm afraid. You're going to have to troubleshoot it a bit.

Your set is not precisely what I have but I don't think the differences are significant.

I have system sound set to analog output (not that it matters a huge amount I think, so long as analog sound is not muted).

Then in XBMC I generally have sound set to Analog (as I do not have a fancy amp (yet) so I don't care about that much either).

So: in XBMC, you have audio output set to "custom" and the device set to ALSA:XBMC and the sound file I specified below.

Do you have analog (headphone jack) sound, or just no sound at all?
Do you have "downmix to 2 channels" on?

From the command line, try:

$speaker-test -D XBMC -c2

You should hear noise on the left and right speakers of both your connected HDMI device and your headphones or whatever is connected to your headphone jack.

Stay away from XBMC until you do ... if it doesn't work in speaker-test, it's not going to work in XBMC either.

Let's assume that you hear headphone audio, but no HDMI audio.

There are a few things to check:
- what is your HDMI output connected to? An amp or a TV?
- if it's an amp, does it give you any diagnostics (i.e. does it tell you when there is a connection and what the connection properties are)
- if it's a TV, you need to check quite carefully what the connection mode is set to (on the TV)

I have seen some TVs (specifically, Samsung TVs) which disable the sound if you choose a particular connection mode for your device. On Samsung 5 series TVs, for certain, there is a plausible looking connection mode for your HTPC called DVI or DVI-PC or something - I forget the precise name - which has the property of a) disabling overscan (very nice) and b) ignoring audio on HDMI (very not nice).

And also on many TVs (Samsung again for sure, and some others) you have to use a particular HDMI input, because only on one HDMI input can you disable overscan.

There is another similar connection setting in the TV setup menu which allows both overscan off and audio.

I recall it took me an hour or two to figure that one out.
But then I never read the manuals.

I suggest playing with $speaker-test and reading your TV manual carefully.
find quote
liamf Offline
Member
Posts: 97
Joined: Mar 2010
Reputation: 0
Location: Ireland
Post: #12
Actually: posting that reminded me of something.

Check to make sure that your HDMI output is not muted too.

Run the alsamixer program (http://en.wikipedia.org/wiki/Alsamixer) and make sure that none of the IE958 devices it will show you are muted.

You can scroll left/right with the arrow keys and use, as far as I recall, the "M" key to unmute anything which is muted.

It's possible that your HDMI audio output is muted by default.
find quote
Michael 2010 Offline
Junior Member
Posts: 25
Joined: May 2010
Reputation: 0
Post: #13
a have me revo 3610 conect to me me pansonic 42px80 by hdmi

a try this comand

speaker-test -D XBMC -c2

but comes up with

ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM XBMC
Playback open error: -2,No such file or directory
ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM XBMC
Playback open error: -2,No such file or directory
ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM XBMC
Playback open error: -2,No such file or directory
ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM XBMC
Playback open error: -2,No such file or directory
ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM XBMC
Playback open error: -2,No such file or directory
ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM XBMC
Playback open error: -2,No such file or directory
find quote
liamf Offline
Member
Posts: 97
Joined: Mar 2010
Reputation: 0
Location: Ireland
Post: #14
Hmm.

Maybe the PCM name is case sensitive, I forget and am not near the system to check.

What does:

$ speaker-test -D xbmc -c2

do for you?
find quote
Michael 2010 Offline
Junior Member
Posts: 25
Joined: May 2010
Reputation: 0
Post: #15
comes up with this

xbmc@xbmc-desktop:~$ $ speaker-test -D xbmc -c2
$: command not found
xbmc@xbmc-desktop:~$ $ speaker-test -D xbmc -c2
$: command not found
xbmc@xbmc-desktop:~$
find quote
Post Reply