Sound and show player issues on subsequent mode play

68 views
Skip to first unread message

Anthony Bates

unread,
Apr 9, 2026, 8:53:06 PM (10 days ago) Apr 9
to MPF Users
I'm having some very odd and specific issues with the timing of my sound_player and show_player in a mode. The first time through the mode, everything works perfectly. But if that mode is failed and then tried again, I am having 2 very specific issues. 

1. The base mode music plays on top of the mode music so the 2 tracks are playing at the same time. This forced me to add a redundant line about stopping the base music which then led to another mor minor issue where at the start of a mode, there is a slight stutter in the music. Players may not notice or care but it's driving me crazy and I have tried everything to fix it with no luck.

2. The more important issue is that the second time through the mode, there is a delay as to when the first light show starts. It's only slight and normally this wouldn't matter but for this particular mode I actually have the light show synced up to the music so after about 10 seconds, it gets completely out of sync and looks terrible. 

I would be very grateful for any ideas as to how to fix either of these as I have tried many variations and had no success. I have attached my base mode and find_keys mode. Let me know if looking at a log would be useful as well as I can also post that. 

Thanks in advance,
Anthony 
base.yaml
find_keys.yaml

Ben Tripoli

unread,
Apr 10, 2026, 8:14:30 PM (9 days ago) Apr 10
to MPF Users
Not sure I would have sound setup in base, its a low priority mode and yours is set even lower than normal at 50. I generally haven't had sound issues, but if this was me I would create a separate mode that runs at a high priority and stop/start all this in the one place at least just for a test. Also there is a tips and tricks section in the docs for sound, check sampling rate, all the same file type etc etc.

Anthony Bates

unread,
Apr 11, 2026, 10:42:14 PM (8 days ago) Apr 11
to mpf-...@googlegroups.com
Thanks for the message. I didn't realise that all sounds should be controlled from its own mode. I just tried condensing all the sounds into one mode and removing the sound controls from each of the individual modes. Unfortunately, I was still having the exact same issues. The music would double up when a mode was played for a second time on the same ball so the base mode music and find_keys music would play at the same time. The light show also has a slight delay when played for a second time. It's like there's something strange going on that is affecting the mode logic or timing but only when played for a second time during the same ball. I'm very stuck at the moment as nothing I have tried has seemed to make any progress. 

--
You received this message because you are subscribed to a topic in the Google Groups "MPF Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mpf-users/blePJk9SyuE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mpf-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mpf-users/8b4fe6fc-ddff-474b-9b7c-d56fefd75e7en%40googlegroups.com.

Ben Tripoli

unread,
Apr 11, 2026, 10:56:02 PM (8 days ago) Apr 11
to MPF Users
No, sounds can be controlled in each mode - I just meant for you to try it as a Test to rule out any low priority mode issues. Only other thing I can think of is try the preload/ondemand settings in sound setup.

assets:
  sounds:
    default:
      load: preload
  

Anthony Bates

unread,
Apr 12, 2026, 12:23:52 AM (7 days ago) Apr 12
to mpf-...@googlegroups.com
Oh, I see. I really appreciate the recommendations. Well having a dedicated sound player mode didn't seem to work so I went back to what I had before. I did some more trouble shooting and I found that in order to correctly stop my firstballintro track, it needs to be controlled in the sound_player for my base mode. But, to correctly stop the subsequentball track, it needs to be controlled from my find_keys mode. This did help me work out that it seems the stutter in the music only comes from the sound_player when it is controlled through the base mode. The problem is, when I try to control the firstballintro music in my find_keys mode, the firstballintro music doesn't stop for some reason. 

That just doesn't make any sense to me as to why they would need to be controlled from different locations. I've tried twenty different iterations of stopping each track and the firstballintro must be stopped from the base mode whereas the subsequentball must be stopped from the find_keys mode. Also, I'm still running into the issue of the exact same light show playing during the second time through the mode just a little bit behind the timing of when it plays the first time through, throwing off the light show timing. I'm failing to understand the logic and timing sequence in why things happen differently in separate playthroughs of the same mode. I have attached a recent log for reference in case it is helpful at all. 

There is clearly something about a mode starting the first time versus the second time that changes the timing of music/light shows. I may need to set up a failsafe byt creating a counter so anytime this mode is played for the second+ time, I can add a slight delay in the music so it syncs up with the light show. Very fiddly and it has be quite confused. 

2026-04-12-14-12-49-mpf-LAPTOP-MPGP6R69.log

Anthony Bates

unread,
Apr 12, 2026, 7:27:44 AM (7 days ago) Apr 12
to mpf-...@googlegroups.com
Okay, well after many many iterations I've come to some solid conclusions and found a partial solution. 

It turns out, MPF is not able to recognise and turn off multiple music tracks within the sound_player at once. I'm assuming because there generally wouldn't be a situation where 2 music tracks are playing simultaneously. I will only recognise the first one in order and not the second one. 
So when the code is written like this in my game mode:
mode_find_keys_started:
  find_keys_music:  
    action: play
  subsequentball:
    action: stop
  firstballintro:
    action: stop
It would stop the subsequentball music but not the firstballintro music. This is why I then had to have code to stop the firstballintro music in the base mode. The problem with that, is controlling sound in the base mode led to that short cutting out of the music. 

The workaround I found was to create a counter that identifies the ball number and whether any game mode had been played yet to create events.
I can then trigger different sound files to stop depending on the event. 
Pretty fiddly and doesn't seem like the cleanest option but it seems to be working for now. I attached my updated yamls for reference. 

Now I just need to sort the slight lag in the show_player during when the mode is played for a second time. I might do a similar counter fix and just adjust the light shows when the mode is triggered for a second+ time. 


On Sun, Apr 12, 2026 at 12:56 PM Ben Tripoli <bentri...@gmail.com> wrote:
base.yaml
find_keys.yaml
Reply all
Reply to author
Forward
0 new messages