ogg vorbis looping crashes MC

14 views
Skip to first unread message

Ryan McQuaid

unread,
Jun 4, 2020, 3:06:57 PM6/4/20
to MPF Users

Hi,

I'm trying to use the looping ability of .ogg music files. This allows you to specify the part of the song that looping comes back to. If a song has an intro before the loop point, it is important that intro is not played again. this is done by adding LOOPSTART and LOOPLENGTH tags to the file as described here:


In my experience, anytime MPF encounters an ogg file with these tags present the MC immediately freezes and does not recover (no error messages. Game continues to play.). I have used a tag editor to try the same file with and without the tags as the only difference. without the tags the song plays fine but doesn't loop correctly, with the tags the MC freezes.

How do we loop ogg files in a way the MC can swallow? Sometimes I am unaware that the ogg file I'm using even has looping tags until I'm playing and the MC chokes on it. 

Quinn Capen

unread,
Jun 5, 2020, 9:33:35 AM6/5/20
to MPF Users
The MPF MC uses the sdl_mixer software package for its sound loading and final mix output (an add-on to SDL2). sdl_mixer supports the loading of loop tags in WAV files and has added loop tag support in v2.0.5 which does not appear to have been released yet. Unfortunately, the sdl_mixer API does not expose the loop point information so it is not available for use in the MPF MC even when it is available for internal sdl_mixer use. We do not have the ability to fix the crash/freeze problem with loading ogg files that contain loop tags as that happens entirely in the sdl_mixer library so you will have to check those yourself before using them in MPF, at least until the next version of sdl_mixer is released.

The audio engine currently only supports looping at the beginning and the end of sounds in standard audio tracks. However, it would be relatively easy for me to add the loop point feature which you would have to specify in your config files (rather than in the audio files themselves). This would at least give you the desired looping functionality even if it had to be manually configured for each sound. I will add a new issue and see if I can get that sound loop point feature added in the next few weeks. If someday sdl_mixer exposes the loop start and loop length tag information through its API the MC would be ready to use it automatically.

Quinn

Quinn Capen

unread,
Jun 5, 2020, 9:42:51 AM6/5/20
to MPF Users

Ryan McQuaid

unread,
Jun 5, 2020, 10:00:40 AM6/5/20
to MPF Users
Thanks. Being able to set a looping point in config would be even better as it's kind of a pain to set up ogg loop tags

Quinn Capen

unread,
Jun 6, 2020, 4:29:48 PM6/6/20
to MPF Users
Got this added to MPF (0.54.0-dev.44) and MPF-MC (0.54.0-dev.9). You will need to update both to get the new feature. Docs were updated here: http://docs.missionpinball.org/en/dev/config/sounds.html

You will need to add 'start_loop_at' and 'end_loop_at' settings to your sound config for any files you wish to modify the loop points (loops default to beginning and end of sound). The values are entered in times (seconds) not samples so be sure to use a lot of decimal points for precision. It works quite well in my tests. Let me know if you have any questions or run into any issues.

Thanks,

Quinn
Reply all
Reply to author
Forward
0 new messages