Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Dev

Seemingly simple and useful digital audio toggle

 

 

MythTV dev RSS feed   Index | Next | Previous | View Threaded


zlg1 at yahoo

Dec 3, 2011, 9:26 AM

Post #1 of 4 (747 views)
Permalink
Seemingly simple and useful digital audio toggle

I have my MythTV box hooked up to my TV via an analog stereo connection.  I also have the MythTV box hooked up to my surround receiver via an SPDIF output.  I use the analog output when just casually watching TV - the news, a TV show.  But I want to use digital surround pass-through when I'm watching a movie.  The trouble is that there's no easy way to switch outputs, as far as I can tell.  Obviously, I know how to go into settings and change the audio output, but this is cumbersome.

In an ideal world, both streams would play simultaneously, and I'd just put on my surround receiver and mute the TV when I want to listen in surround.  I don't know why this would be hard to implement, since the SPDIF should just be a pass-through, but I've read that MythTV simply can't play two audio streams.

Second best would be a simple menu choice or toggle to easily switch between audio outputs.  Any idea how I can do this?


octoberblu3 at gmail

Dec 3, 2011, 9:21 PM

Post #2 of 4 (707 views)
Permalink
Re: Seemingly simple and useful digital audio toggle [In reply to]

On Sat, Dec 3, 2011 at 12:26 PM, Zachary Gleit <zlg1 [at] yahoo> wrote:
> I have my MythTV box hooked up to my TV via an analog stereo connection.  I
> also have the MythTV box hooked up to my surround receiver via an SPDIF
> output.  I use the analog output when just casually watching TV - the news,
> a TV show.  But I want to use digital surround pass-through when I'm
> watching a movie.  The trouble is that there's no easy way to switch
> outputs, as far as I can tell.  Obviously, I know how to go into settings
> and change the audio output, but this is cumbersome.
>
> In an ideal world, both streams would play simultaneously, and I'd just put
> on my surround receiver and mute the TV when I want to listen in surround.
>  I don't know why this would be hard to implement, since the SPDIF should
> just be a pass-through, but I've read that MythTV simply can't play two
> audio streams.
>
> Second best would be a simple menu choice or toggle to easily switch between
> audio outputs.  Any idea how I can do this?
>

Someone else here once wrote this script to do this for switching
between bluetooth and spdif using the python bindings, but I'm sure
you can adapt it to work for you. Just replace the a2dp with your
preferred analog output. The print statements are optional.


#!/usr/bin/python

from MythTV import MythBE

be = MythBE()
db = be.db
hostname = db.gethostname()

print 'Host: %s'%hostname
print '\tAudio device: %s'%db.settings[hostname]['AudioOutputDevice']
print '\tMax Channels: %s'%db.settings[hostname]['MaxChannels']
print '\tDTS: %s AC3:
%s'%(db.settings[hostname]['DTSPassThru'],db.settings[hostname]['AC3PassThru'])

if db.settings[hostname]['AudioOutputDevice']=='ALSA:plug:a2dp':
db.settings[hostname]['AudioOutputDevice']='ALSA:iec958:CARD=SB,DEV=0'
db.settings[hostname]['MaxChannels']=u'6'
db.settings[hostname]['DTSPassThru']=u'1'
db.settings[hostname]['AC3PassThru']=u'1'
else:
db.settings[hostname]['AudioOutputDevice']='ALSA:plug:a2dp'
db.settings[hostname]['MaxChannels']=u'2'
db.settings[hostname]['DTSPassThru']=u'0'
db.settings[hostname]['AC3PassThru']=u'0'

print 'Host: %s'%hostname
print '\tAudio device: %s'%db.settings[hostname]['AudioOutputDevice']
print '\tMax Channels: %s'%db.settings[hostname]['MaxChannels']
print '\tDTS: %s AC3:
%s'%(db.settings[hostname]['DTSPassThru'],db.settings[hostname]['AC3PassThru'])

be.backendCommand('MESSAGE[]:[]CLEAR_SETTINGS_CACHE')


Just place in a file, make executable, and set up a convenient way for
you to execute when switching (perhaps bind the script to a button on
your remote). Just make sure to do this in a menu, and not during
playback.

Good luck,
Patrick
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


Christian.Oltenburger at bnv-bamberg

Dec 4, 2011, 1:09 AM

Post #3 of 4 (699 views)
Permalink
Re: Seemingly simple and useful digital audio toggle [In reply to]

> I have my MythTV box hooked up to my TV via an analog stereo
> connection. I also have the MythTV box hooked up to my surround
> receiver via an SPDIF output. I use the analog output when just
> casually watching TV - the news, a TV show. But I want to use digital
> surround pass-through when I'm watching a movie. The trouble is that
> there's no easy way to switch outputs, as far as I can tell.
> Obviously, I know how to go into settings and change the audio
> output, but this is cumbersome.
>
> In an ideal world, both streams would play simultaneously, and I'd
> just put on my surround receiver and mute the TV when I want to listen
> in surround. I don't know why this would be hard to implement, since
> the SPDIF should just be a pass-through, but I've read that MythTV
> simply can't play two audio streams.
>
> Second best would be a simple menu choice or toggle to easily switch
> between audio outputs. Any idea how I can do this?
>
>
Hi,

to stream the audio output to both interfaces you can setup a mixer via
alsa. I did this too to get audio on my TV via HDMI and the amplifier
via SPDIF.
Unfortunately I can't find the HOWTO anymore but searching the web for
"asound.conf HDMI spdif" should help you.

Regards,
Christian


zlg1 at yahoo

Dec 4, 2011, 8:03 AM

Post #4 of 4 (702 views)
Permalink
Re: Seemingly simple and useful digital audio toggle [In reply to]

Hi -

Along Christian's lines, I have tried numerous solutions to try to stream via analog (not HDMI) and SPDIF simultaneously.  The problem with the solutions I've tried (when I get them to work) is  that either the simultaneous stream is in stereo (not surround) or, if MythTV detects a surround stream, it only passes through to SPDIF and doesn't play through analog (it'll play through both only if there's a stereo source).

I found Patrick's solution really helpful (there were two syntax errors in his script, but that likely came from cutting and pasting).  My modification is pasted below.  I don't use Myth with a remote control, so I added a menu option to the mainmenu.xml file that runs the script.  It works perfectly.

Thanks a lot.

Zack

#!/usr/bin/python

from MythTV import MythBE

be = MythBE()
db = be.db
hostname = db.gethostname()

print 'Host: %s'%hostname
print '\tAudio device: %s'%db.settings[hostname]['AudioOutputDevice']
print '\tMax Channels: %s'%db.settings[hostname]['MaxChannels']
print '\tDTS: %s    AC3: %s'%(db.settings[hostname]['DTSPassThru'],db.settings[hostname]['AC3PassThru'])

if db.settings[hostname]['AudioOutputDevice']=='ALSA:pulse':
  db.settings[hostname]['AudioOutputDevice']='ALSA:iec958:CARD=Intel,DEV=0'
  db.settings[hostname]['MaxChannels']=u'6'
  db.settings[hostname]['DTSPassThru']=u'1'
  db.settings[hostname]['AC3PassThru']=u'1'
else:
  db.settings[hostname]['AudioOutputDevice']='ALSA:pulse'
  db.settings[hostname]['MaxChannels']=u'2'
  db.settings[hostname]['DTSPassThru']=u'0'
  db.settings[hostname]['AC3PassThru']=u'0'

print 'Host: %s'%hostname
print '\tAudio device: %s'%db.settings[hostname]['AudioOutputDevice']
print '\tMax Channels: %s'%db.settings[hostname]['MaxChannels']
print '\tDTS: %s    AC3: %s'%(db.settings[hostname]['DTSPassThru'],db.settings[hostname]['AC3PassThru'])

be.backendCommand('MESSAGE[]:[]CLEAR_SETTINGS_CACHE')

MythTV dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.