Kodi Community Forum

Full Version: Audio Profiles (for Kodi 18 and later)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
(2023-08-24, 01:53)pkscout Wrote: [ -> ]
(2023-08-23, 13:47)hakkinenvthh Wrote: [ -> ]
(2023-08-23, 11:38)pkscout Wrote: [ -> ]Kodi core returned unknown as the type, so that's what we have to work with on the addon side.  I can't say why core did that, especially with only a log snippet.  We really need a full and complete log, not just the snippet.  Put Kodi in debug mode, restart Kodi, duplicate the issue, and then put the entire log in pastebin.  Maybe that'll show something that will tell us why core is doing that.
Yeah you are right, no problem when we can treat it on the add-on side. I notice that when I call the method "GetProperties" on the player to get the current stream 's informations with some *.dsf or *.dff files, it takes time so I had to add some delays  depending on the file's size. Maybe it's the same case for the core, the add-on demands the informations too soon (sometimes the core returns well the song type). I'll try to debug xbmc
There is logic is the add-on to wait for certain video stream types to get results, and you can change the wait time in the settings.  If you find that waiting gets you a result eventually for those files, I can probably add the same logic for audio.  The drawback is that, as currently written, it's all or nothing.  You either have a delay for everything or nothing, and that could mean a delay in triggering whatever action you want for audio.  I might be able to do something where if it gets no result or unknown that it waits and tries again though.
Thank you, I could make some modifications for my use case (dsd music, multi-channels music,...) and everything works great now. For information, even with debug activated, I can't find the reason why sometimes the core returned "unknown" as type, but the method Player.isPlayingAudio() always return True for a song, so I can rely on it to treat the music, without entering in "auto_unknown" type. I wonder if we could retrieive the informations from ffmpeg decoder when opening the file, so we don't have to call jsonRPC getProperties to get the number of channels, and can reduce the delay. Thanks again for your replies, I'm a Kodi user for a long time but I'm just beginning to see the codes, I hope that I would contribute one day ^^
Hi,
Thanks for the add on. Im after a bit of advice which i think might be a yes it does or no it doesnt answer.

I've set up 2 profiles and it does one of the 2 things I need perfectly. When I press the shortcut for either profile in Yatse the audio transfers fine to the corresponding device. How many of the display settings can I expect to work or am I looking at the wrong page the add on uses?

I completley understand it's an audio addon but each profile is a TV so was hoping the display switched aswell but it flashes black and stays on the TV it is on.

Am I barking up the wrong tree?
Thanks for any info I've been plugging away for a bit and I'm not brilliant at this I learn bits as I go.
Thanks
(2023-09-09, 20:51)Pi7a Wrote: [ -> ]Hi,
Thanks for the add on. Im after a bit of advice which i think might be a yes it does or no it doesnt answer.

I've set up 2 profiles and it does one of the 2 things I need perfectly. When I press the shortcut for either profile in Yatse the audio transfers fine to the corresponding device. How many of the display settings can I expect to work or am I looking at the wrong page the add on uses?

I completley understand it's an audio addon but each profile is a TV so was hoping the display switched aswell but it flashes black and stays on the TV it is on.

Am I barking up the wrong tree?
Thanks for any info I've been plugging away for a bit and I'm not brilliant at this I learn bits as I go.
Thanks

The addon doesn’t do any of the display settings. It only does audio settings.
Ahh thankyou for that, I'll stop then.
I had it as a custom command and I just pressed the shortcut and it jumped to the TV along with audio but can't remember how I did it Huh
Will have to have a think

Thanks fpr your answer
Hi,

Ik run Kodi on a Mac Mini, for audio I use an external USB DAC (SMSL brand).
Since this DAC also has additional inputs, it's USB input is not always available / visible for Kodi. When watching TV for instance, I switch over to it's optical input (DAC's remote control). Next, if I want to want to play some music from Kodi, I switch back to USB (DAC's remote control). By that time Kodi already has switched to another sound output and won't switch back to the USB DAC unless I do so manually in Audio Settings.

Would it be possible for Audio Profiles to switch automatically back to the USB DAC as soon as it gets available?

Thanks in advance for your reply!

Harry Nak
(2023-12-23, 13:19)Harry Nak Wrote: [ -> ]Hi,

Ik run Kodi on a Mac Mini, for audio I use an external USB DAC (SMSL brand).
Since this DAC also has additional inputs, it's USB input is not always available / visible for Kodi. When watching TV for instance, I switch over to it's optical input (DAC's remote control). Next, if I want to want to play some music from Kodi, I switch back to USB (DAC's remote control). By that time Kodi already has switched to another sound output and won't switch back to the USB DAC unless I do so manually in Audio Settings.

Would it be possible for Audio Profiles to switch automatically back to the USB DAC as soon as it gets available?

Thanks in advance for your reply!

Harry Nak
Sorry, no.  That would require monitoring at the hardware level.  It's not something I'm prepared to write, and I'm not even sure it's possible.
Hi,
No problem. Please note I have added Dutch translation thru Github.
(2023-12-26, 00:01)Harry Nak Wrote: [ -> ]Hi,
No problem. Please note I have added Dutch translation thru Github.

This addon is tied in to Team Kodi's Weblate setup, so the only way I can accept translations is through that.  If I do any others, they get overridden automatically.

https://kodi.weblate.cloud/projects/kodi...-profiles/
Hi, first of all thanks for this add on.
I am using it on a RPi5 running with LibreElec 11.0.6. I use 2 profiles, one (named DIGITAL) that sends audio to HDMI (for watching movies / TV shows etc) and another one (named ANALOG) that sends audio to a cheap USB audio interface (based on KT0210 dac) that is connected to a stereo amp.

I have a problem with the auto switch function.
The autoswitch is configured to switch on DIGITAL basically always except for playing music and radio (in that case it switch to ANALOG aka the USB audio).
Also the GUI interaction is set to DIGITAL.

Now, the problem.
Let's say the current profile is DIGITAL (HDMI), TV is off, amp is on.
Using Chorus web interface from a PC, I select an album and hit play. The playback sometimes does not start at all and sometimes starts somewhere in the middle of the first track of the album (sometimes also second track). Anyway the auto switch sets the audio aoutput to ANALOG (usb audio), but my impression is that it does so AFTER the playback has started, causing the issue. After that first glitch, if I do not hit the stop button (that triggers the add on to switch back to DIGITAL) the playback works fine.

Dunno if my impression is correct, hope anyway I explained the issue.
Thanks for any suggestion / help
A
(2024-03-14, 11:24)AndreaWozzup Wrote: [ -> ]Now, the problem.
Let's say the current profile is DIGITAL (HDMI), TV is off, amp is on.
Using Chorus web interface from a PC, I select an album and hit play. The playback sometimes does not start at all and sometimes starts somewhere in the middle of the first track of the album (sometimes also second track). Anyway the auto switch sets the audio aoutput to ANALOG (usb audio), but my impression is that it does so AFTER the playback has started, causing the issue. After that first glitch, if I do not hit the stop button (that triggers the add on to switch back to DIGITAL) the playback works fine.

Dunno if my impression is correct, hope anyway I explained the issue.
Your impression is correct.  That audio profile change is triggered when Kodi sends an OnPlaybackStarted event.  I don't know why Kodi isn't sending that event when you start playback in your use case, but that's the issue you need to figure out.  There is no work around on the audio profile side for that.
(2024-03-14, 12:37)pkscout Wrote: [ -> ]
(2024-03-14, 11:24)AndreaWozzup Wrote: [ -> ]Dunno if my impression is correct, hope anyway I explained the issue.
Your impression is correct.  That audio profile change is triggered when Kodi sends an OnPlaybackStarted event.  I don't know why Kodi isn't sending that event when you start playback in your use case, but that's the issue you need to figure out.  There is no work around on the audio profile side for that.

Thanks for replying Smile
I think Kodi is sending the event, because the audio profile change happens, it's just that is sent after the playback is already started, so I think the audio playback starts on DIGITAL (HDMI) and then audio output config is changed to ANALOG (usb) and this cause the hiccup on Kodi default audio player (paPlayer? I see that from the logs I tried collect https://paste.libreelec.tv/new-sunbird.log).
Maybe paPlayer can't handle gracefully a switch of audio output? Or at least that what happens on the Rpi5, which is after all something recent..

I know is a lot to ask here, since it's not an add on issue, but I have no idea on how to investigate it further (which is not really a deal breaker, just... strange Smile), can you suggest something (i.e. which log to collect etc)?
(2024-03-15, 10:26)AndreaWozzup Wrote: [ -> ]
(2024-03-14, 12:37)pkscout Wrote: [ -> ]
(2024-03-14, 11:24)AndreaWozzup Wrote: [ -> ]Dunno if my impression is correct, hope anyway I explained the issue.
Your impression is correct.  That audio profile change is triggered when Kodi sends an OnPlaybackStarted event.  I don't know why Kodi isn't sending that event when you start playback in your use case, but that's the issue you need to figure out.  There is no work around on the audio profile side for that.
I know is a lot to ask here, since it's not an add on issue, but I have no idea on how to investigate it further (which is not really a deal breaker, just... strange Smile), can you suggest something (i.e. which log to collect etc)?
If you turn debug logging on in Kodi and then duplicate the issue, that's the best way to gather info for troubleshooting.  I'd probably also include the hardware info for your Kodi machine as well as that audio device.  Find the right place in the forum (likely one of the OS specific areas), create a new post, include all that, and maybe someone can help.
(2024-03-15, 12:39)pkscout Wrote: [ -> ]
(2024-03-15, 10:26)AndreaWozzup Wrote: [ -> ]
(2024-03-14, 12:37)pkscout Wrote: [ -> ]If you turn debug logging on in Kodi and then duplicate the issue, that's the best way to gather info for troubleshooting.  I'd probably also include the hardware info for your Kodi machine as well as that audio device.  Find the right place in the forum (likely one of the OS specific areas), create a new post, include all that, and maybe someone can help.

I got a somehow strange idea for a workaround to my issue.
I might use this other add-on https://kodi.wiki/view/Add-on:Kodi_Callb...s_-_Events and configure so that I subscribe to onScreensaverActivated and onScreensaverDeactivated monitor events.
When screen saver kicks in I do (switch to ANALOG):
Code:
RunScript(script.audio.profiles,2)
When deactivated (back to DIGITAL):
Code:
RunScript(script.audio.profiles,1)
Will try.. tomorrow Smile
(2024-03-15, 22:34)AndreaWozzup Wrote: [ -> ]
(2024-03-15, 12:39)pkscout Wrote: [ -> ]
(2024-03-15, 10:26)AndreaWozzup Wrote: [ -> ] 

I got a somehow strange idea for a workaround to my issue.
I might use this other add-on https://kodi.wiki/view/Add-on:Kodi_Callb...s_-_Events and configure so that I subscribe to onScreensaverActivated and onScreensaverDeactivated monitor events.
When screen saver kicks in I do (switch to ANALOG):
Code:
RunScript(script.audio.profiles,2)
When deactivated (back to DIGITAL):
Code:
RunScript(script.audio.profiles,1)
Will try.. tomorrow Smile
does not work. nothing triggers i.e. on onScreensaverActivated with this add on. meh
This add-on doesn't work!

Please make a version that does!
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18