Playlists - Auto-play next sound

20 views
Skip to first unread message

Max Power

unread,
Apr 7, 2020, 4:48:16 PM4/7/20
to MPF Users
Can I get some clarification on how playlists are intended to work?

I am using a series of playlists for the background music in my game.  When a song ends it does not start another one.  Is this by design?  If so l need to use the music_playlist_playlist_sound_stopped event to start the next song?

2020-04-07 16:31:52,214 : Track.1.TrackStandard.music_playlist : Processing notification message 2 for sound instance (id: 1721589316912)
2020-04-07 16:31:52,214 : EventManager : Event: ======'music_playlist_playlist_sound_stopped'====== Args={'sound_instance': <SoundInstance: music_80s_Rock_33 (1721589316912), Volume=0.5, Loops=0, Priority=0, Loaded=True, Track=music_playlist>}
2020-04-07 16:31:52,214 : Track.1.TrackStandard.music_playlist : Removing sound instance <SoundInstance: music_80s_Rock_33 (1721589316912), Volume=0.5, Loops=0, Priority=0, Loaded=True, Track=music_playlist> from playing sound instance dictionary

Thanks in advance.

Quinn Capen

unread,
Apr 7, 2020, 5:45:31 PM4/7/20
to MPF Users
The next song in the playlist should begin playing automatically, just like you expect it to.  Can you post the relevant portions of your config files (sound_system, sounds, playlists, playlist_player) and more of your logs?

Thanks,

Quinn

Andrew B

unread,
Apr 7, 2020, 6:18:33 PM4/7/20
to MPF Users
I encountered this same issue a few days ago. I'm running 0.54.0-dev.18

I too would be expecting the next track to automatically follow. From the investigation I've done so far, it looks to be related to the "crossfade_time" setting on the playlist track.

If I change the crossfade_time to a value other than 0, the playlist works and the next track will play. If I have it set as 0 (which I think is the default value), the playlist ends after the first track and I see the "music_playlist_playlist_sound_stopped" event in the log.




Max Power

unread,
Apr 7, 2020, 6:31:07 PM4/7/20
to MPF Users
That must be my issue... I've got it set to 0.

Config.yaml:

assets:
    sounds:
        default:
            load: on_demand
        music:
            load: on_demand
            track: music_playlist
        sfx:
            track: sfx
        voice:
            track: voice

sound_system:
    buffer: 2048
    channels: 2
    enabled: True
    frequency: 44100
    master_volume: 1.0 # 0.75
    tracks:
       music_playlist:
          type: playlist
          volume: 1.0
          events_when_stopped: music_pl_track_stopped
          events_when_played: music_pl_track_played
          events_when_paused: music_pl_track_paused
       sfx:
          type: standard
          simultaneous_sounds: 8
          volume: 1.0

The rest of it resides in music.yaml, a generated file.  Here is the structure for one of the playlists.

sounds:
    music_80s_Rock_1:
        file: 01 - Huey Lewis and the News - The Power of Love.flac
    music_80s_Rock_2:
        file: 01 - Kenny Loggins - Danger Zone.flac
    music_80s_Rock_3:
        file: 01 - Runaway.flac
    music_80s_Rock_4:
        file: 01 Call Me.flac
    music_80s_Rock_5:
        file: 01 Stan Bush - The Touch.flac

playlists:
    pl_80s_Rock:
      shuffle: true
      repeat: true
      crossfade_mode: override
      crossfade_time: 0s
      sounds:
        - music_80s_Rock_1
        - music_80s_Rock_2
        - music_80s_Rock_3
        - music_80s_Rock_4
        - music_80s_Rock_5

event_player:
    game_ended:
        set_pl_stop
    player_music_type{current_player.upper_drop_level == 1 and current_player.music_type == 8}:
        set_80s_Rock
    player_upper_drop_level{current_player.upper_drop_level == 1 and current_player.music_type == 8}:
        set_80s_Rock
    player_music_type{current_player.upper_drop_level == 2 and current_player.music_type == 8}:
        set_80s_Rock
    player_upper_drop_level{current_player.upper_drop_level == 2 and current_player.music_type == 8}:
        set_80s_Rock

playlist_player:
    set_pl_stop:
      music_playlist:
        action: stop
    set_80s_Rock:
      music_playlist:
        playlist: pl_80s_Rock
        action: play
  
Music_select.yaml is a carousel menu.  This starts the initial playback.
variable_player:
  music_select_80s_Rock_highlighted:
    music_type:
      int: 8
      action: set

Quinn Capen

unread,
Apr 7, 2020, 7:02:38 PM4/7/20
to MPF Users
Sounds like a bug for me to fix.  In the meantime, just set crossfade_time to a really small number like 50ms.

Quinn

Andrew B

unread,
Apr 22, 2020, 2:47:48 AM4/22/20
to MPF Users
Hi Quinn,

Did you have any luck tracking the bug down?

Cheers,

Andrew.
Reply all
Reply to author
Forward
0 new messages