Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 9
Release AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output
#1
Hi,

i was looking for a solution to switch Audio Devices AUTOMATICALLY when i start playing Music and Videos.
Although it wasn't meant to be released for public - due to the fact that i am a python beginner - i decided to share my addon, because i read about requests for this kind of feature.

WHAT IS IT?

It's a Service Addon which can setup DIFFERENT Audio Devices, one for Videos and one for Music WITHIN XBMC/KODI without fiddling around with logfiles or python code. When you play a Video- or Audiofile, it will switch to the pre-defined Audio Output automatically.

HOW TO SETUP

1. Download and install the addon from here: [url=https://www.dropbox.com/s/v1gvutur8l5hvpo/script.audioswitch.0.2.3.zip?dl=0[/url]
2. Go to the Service Addon Settings and enable "Run Audio Device Setup".
3. Go to the XBMC/KODI Audio Output Settings and set your Audio Device for MUSIC / AUDIO
4. Play an Audiofile (the Addon will save the Device plus Passthrough and Channels)
5. Do the same Step 3 and 4 for VIDEOS
6. Configuration is now done! From now on the Audio Device will switch automatically when playing a Video or Audio File.
(7. If you want you can go to the Addon Settings and define the GUI Audio Device as well.)
(8. You now even can set different volume levels for each Audio Device)

MANUAL SWITCH:
Additionally you can bind a key to XBMC.RunScript(special://home/addons/script.audioswitch/manualswitch.py) to toggle the Audio Devices manually.
if you deactivate the Service Addon, you still can use the manual switch.

I've tested it on Windows and Openelec!
Feedback is appreciated. thanks!

Version 0.1.1
Initial Release

Version 0.1.2
Fixed Title for Devices in the Setting (was interchanged)
Minor Code changes
Added Setting to Swap Output Devices (using MUSIC Device for VIDEOS and vice versa)

Version 0.2.1
Fixed issue with Devices using S/PDIF
Added Volume Setting for each Audio Device

Version 0.2.2
Improved Volume Setting handling

Version 0.2.3
Added Localization (EN / GER / IT)
Reply
#2
nice one. i think i saw request about this feature a while ago.

D.
Reply
#3
Hello,

Thank you for for this, I wait for long time this kind of addons.
I will check if it's works.

Many thanks.
Reply
#4
Just installed and tested it on OpenELEC 4.1.4, and it basically does the job very nicely. Cool

One thing I noticed, that switching from video to audio, the sound from the music source is still played to the video source for about/upto half a second. This is only noticeable when the music file/stream starts right away. Music/Songs starting with a small silence at the beginning will not reveal this 'tiny bug' in your AudioSwitcher.
Reply
#5
i have noticed the switching delay as well. i am not sure i can get rid of it but maybe i can speed up the code to (at least) shorten the switching delay.
Reply
#6
Nice add-on, any chance of adding one for Movies as well as Videos?
I have my TV stuff setup as I like it, so not added to the library but my Movies are.
I found that it switches fine between my radio feed (to the headphone socket on my pi) and TV (the the tv) but if I go from radio to Movies it stays on analog.
Reply
#7
back from holidays...

hairybiker: theres actually no difference wether it's a video/movie from file mode or from library. do you use an external player for the library files?
Reply
#8
No, no external players. But if I go from playing a radio stream to a movie then it doesn't change the audio o/p whereas if I goto a video then it does and stays switched fine.
Not a biggie, I will normally go through the TV stuff first before switching to a movie later.

My setup is all nfs shares, 3 movie drives mounted in the library and 1 tv share mounted as a file mount, no library access. I have one pls file in the audio section.
Your addon works great for me playing an audio stream at lunch time, but if I then switch to a library file not a folder file it doesn't switch over.
Maybe I need to use the library as the source for the video selection on the config? I setup using the audio then a tv file.
Reply
#9
sounds odd. the addon just gets the info when a video file will be played - no matter from where it comes from - and switches the audio output. xbmc/kodi makes no difference here.

do you use the latest version of xbmc gotham?
i will try to recreate the behaviour you described. maybe i can see if it's a bug from the addon or from xbmc/kodi itself.
Reply
#10
hairybiker: is it possible that the movies in your library are iso files (dvd rips)?
i have one movie as iso format in my library and the addon don't switch the audio output neither.
i will open a ticket, it seems to be a bug in the xbmc/kodi core code.
Reply
#11
thanks for writing this helpful service addon! it's perfect for my use case.

i installed it yesterday and in the first few tests automatic switching worked just fine. however i also noticed that the first milliseconds of a song still get played on the wrong audio device before the switching occurs. but i don't think this can be easiliy optimized, since it takes some time before the webservice receives and responds to the call.

i also noticed a little bug: in the settings dialog, the labels for the speaker configuration from audio and video are swapped. in my case it says 5.0 for my stereo setup and 2.0 for my home cinema setup Smile

great work and thanks again!
Reply
#12
(2014-08-19, 23:22)marv_el Wrote: i have noticed the switching delay as well. i am not sure i can get rid of it but maybe i can speed up the code to (at least) shorten the switching delay.

tried to get rid of the delay but it wasn't possible. python is too slow to achieve it. i even tried to pause the playback immediately, make the switch and continue playback, but i got the same result.
Confused

(2014-09-03, 08:22)blubserl Wrote: thanks for writing this helpful service addon! it's perfect for my use case.

i installed it yesterday and in the first few tests automatic switching worked just fine. however i also noticed that the first milliseconds of a song still get played on the wrong audio device before the switching occurs. but i don't think this can be easiliy optimized, since it takes some time before the webservice receives and responds to the call.

i also noticed a little bug: in the settings dialog, the labels for the speaker configuration from audio and video are swapped. in my case it says 5.0 for my stereo setup and 2.0 for my home cinema setup Smile

great work and thanks again!

great to hear that.
bug should be fixed in the updated version - see first post!

(2014-08-31, 15:20)Hairybiker Wrote: No, no external players. But if I go from playing a radio stream to a movie then it doesn't change the audio o/p whereas if I goto a video then it does and stays switched fine.
Not a biggie, I will normally go through the TV stuff first before switching to a movie later.

My setup is all nfs shares, 3 movie drives mounted in the library and 1 tv share mounted as a file mount, no library access. I have one pls file in the audio section.
Your addon works great for me playing an audio stream at lunch time, but if I then switch to a library file not a folder file it doesn't switch over.
Maybe I need to use the library as the source for the video selection on the config? I setup using the audio then a tv file.

could you please download and try the new version. i don't know why, but ISO files do work now Tongue.
maybe it solves your problem as well?!
Reply
#13
Just what i was looking for.
But... Smile
Not working for me. (on xmbc 13.2)
When i try step 4 nothing is happening.
I tried playing a mp3 file.

When i select a video file (mkv) i do get a notification popup.
After setting this, i do get another popup for setting Music.
But again no popup after playing a mp3 (or airplay) file.

I must be doing something wrong?
Reply
#14
You can hear anything in two audio output in same time, one must be speakers and second is your choice.. Look this trick http://www.addictivetips.com/windows-tip...windows-7/
Work on all windows (7 and 8 x64 and x86)
Reply
#15
(2014-10-05, 21:18)wilaim555 Wrote: You can hear anything in two audio output in same time, one must be speakers and second is your choice.. Look this trick http://www.addictivetips.com/windows-tip...windows-7/
Work on all windows (7 and 8 x64 and x86)

That would a good solution.
But i dont have the extender options in my audio setting.
Reply
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 9

Logout Mark Read Team Forum Stats Members Help
AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output1
This forum uses Lukasz Tkacz MyBB addons.