[Ohrrpgce] SDL_mixer and loop points

Ralph Versteegen teeemcee at gmail.com
Wed Feb 3 20:02:08 PST 2021


Update!
Now that music_sdl2 is the default almost everywhere, loop points in ogg
files are a reality!
SDL_mixer 2.0.5 is still unreleased since my emails in 2019, but I imagine
is not long off. It supports the more flexible LOOPSTART format loop point
in ogg, flac and opus. Also, it turns out that SDL_mixer has supported
"smpl" loop points in wav files since 2.0.1. smpl loop points are far more
flexible: you can have multiple loops and each can loop a finite number of
times, and it doesn't affect the loop count for the overall track. (If you
ask SDL_Mixer to play a looped ogg n times then it will play the loop n
times, continue to the end of the track, and stop.) Looping not supported
in MP3.

It would be pretty straightfoward to translate an infinite smpl loop point
to ogg when encoding it, by taking the smpl parsing code from SDL_mixer.
Maybe not very useful though.

I don't yet know how we could add loop point metadata to an existing ogg.
And helping the user to pick a good loop point is something that could be
best done by an external tool anyway, though I still think something
primitive would be nice to have in Custom.

Also, I bumped the bugzilla bug about modplug loop points and they enabled
them in both SDL_mixer 1.2 and 2.


On Fri, 22 Nov 2019 at 14:27, Ralph Versteegen <teeemcee at gmail.com> wrote:

> Yes, that's the core difference between GPL and LGPL.
>
> I was interested in it on Android for the MIDI synths. If we had a
> OPL3-synth-based BAM player, we would ideally want to be able to use it
> everywhere, including possibly GPL-problematic platforms. However I'd think
> no one is going to be using BAM files in a Switch or Steam game, so such a
> restriction would be bearable.
> On the other hand there are non-GPL OPL3 synths we could use instead for
> BAM: https://doomwiki.org/wiki/OPL_emulation#OPL_emulators
> And, I still think implementing a BAM player is a quite bad use of time.
> It's only for fun.
>
> On Fri, 22 Nov 2019 at 13:35, James Paige <Bob at hamsterrepublic.com> wrote:
>
>> I must have been confusing the LGPL rules.
>>
>> What was the reason for wanting SDL Mixer X on Android, just for the
>> Midi/BAM synths?
>>
>> On Thu, Nov 21, 2019, 6:57 PM Ralph Versteegen <teeemcee at gmail.com>
>> wrote:
>>
>>> You can't dynamically link to a GPL library without the whole program
>>> being GPL.
>>>
>>> I haven't forgotten about the relicensing either, I need to send that
>>> email.
>>>
>>> It would be rare that someone would be using a backend without loop
>>> point support (eg non-MIDI audio don't even work in music_native/native2 on
>>> Windows currently; noone is using them), but that warning would be a good
>>> idea.
>>>
>>> On Fri, 22 Nov 2019 at 01:53, James Paige <Bob at hamsterrepublic.com>
>>> wrote:
>>>
>>>> The loop support thing sounds cool. I like the idea of in editor
>>>> support, although we'll probably also want some in-editor warning text to
>>>> let people know that support is dependent on backend.
>>>>
>>>> As for the relicensing, I haven't forgotten about that. I do still want
>>>> to do it.
>>>>
>>>> Could using a GPL3 licenced music library work better if it was a
>>>> dynamic library, for greater separation? Sort of like how gfx_directx is
>>>> implemented as a dll?
>>>>
>>>> ---
>>>> James
>>>>
>>>> On Thu, Nov 21, 2019, 6:33 AM Ralph Versteegen <teeemcee at gmail.com>
>>>> wrote:
>>>>
>>>>> I know I've discussed this before, but apparently not on the
>>>>> mailinglist.
>>>>>
>>>>> SDL_Mixer 2 added support for .ogg loop points a couple of years ago.
>>>>> (Strangely it's not in the changelog)
>>>>>
>>>>> Loop points work as LOOPSTART and LOOPEND or LOOPLENGTH (optional)
>>>>> comments embedded in the .ogg file. LOOPSTART+LOOPLENGTH is RPG
>>>>> Maker-compatible.
>>>>>
>>>>> Within the last few days to weeks, more stuff has landed in SDL_mixer
>>>>> hg.
>>>>> -loop points in FLAC files (note: I compiled sdl_mixer.dll without
>>>>> FLAC support)
>>>>> -loop points can now be expressed in hh:mm:ss notation, or named
>>>>> LOOP_START or LOOP-START, for compatibility with Doom source ports
>>>>> https://zdoom.org/wiki/Audio_loop
>>>>> -loop points now respect the number of times we asked SDL_mixer to
>>>>> loop the song. I believe after that number of loops, it'll proceed past
>>>>> LOOPEND to the end, and then stop (not loop to beginning). Someone could
>>>>> always submit a patch for another comment controlling a separate loop count.
>>>>>
>>>>> So I would like to add the ability to edit loop-points right in the
>>>>> music import menu.
>>>>>
>>>>> We already have code for adding comments to an .ogg file when
>>>>> converting .mp3 to .ogg, but it seems to oggenc can't be used to add
>>>>> comments to an existing ogg file. Instead, the vorbiscomment program (part
>>>>> of vorbis-tools) does that. Another 186kB download.
>>>>> <http://www.rarewares.org/files/ogg/vorbiscomment-1.2.0.zip>
>>>>>
>>>>> === SDL_mixer 1.2 ===
>>>>>
>>>>> Loop points aren't in SDL_mixer 1.2. There hasn't been an update to
>>>>> SDL_mixer 1.2 since 2012, but it looks like they're preparing a bugfix one,
>>>>> including a number of backported loop-related bugfixes. It's certainly not
>>>>> getting any features.
>>>>>
>>>>> There are only a couple bugs that I'm aware of left in gfx_sdl2; I'd
>>>>> like to fix them and switch to it as default on Mac, Linux and Windows
>>>>> after Fufluns is released
>>>>>
>>>>> However the ogg loop stuff is spread over just a few of commits and
>>>>> should be very easy to backport to SDL_mixer 1.2, for our own build of
>>>>> sdl_mixer.dll (for people who want to stick to gfx_sdl instead of gfx_sdl2
>>>>> for whatever reason) and also for the android port.
>>>>>
>>>>> === SDL_mixer X ===
>>>>>
>>>>> Loop points were first implemented in SDL_mixer X, which is a fork of
>>>>> SDL_mixer 2, which has a number of interesting features.
>>>>> https://wohlsoft.github.io/SDL-Mixer-X/
>>>>>
>>>>> Most notably, it supports many more module formats and has ADLMIDI
>>>>> (OPL3) and OPNMIDI OPN2 synthesizer-based MIDI players, which could be used
>>>>> to play MIDI on Android or elsewhere without needing soundfonts. Sounds
>>>>> different to MIDI playback with a soundfont, but I think in most case
>>>>> ADLMIDI not bad (except percussion maybe). These both also support
>>>>> controller 111-based loop points (RPG Maker-compatible), just like
>>>>> music_native/native2 do. They could also be used to implement true BAM
>>>>> playback. (ADLMIDI contains at least two OPL3 synthesizers: Nuked and
>>>>> DOSbox)
>>>>>
>>>>> But these synths are GPLv3+ licensed, which is a problem (inhibiting
>>>>> relicensing of the engine). So maybe we could use it just on Android for
>>>>> MIDI playback, and not for BAM. iOS has MIDI support builtin.
>>>>> _______________________________________________
>>>>> Ohrrpgce mailing list
>>>>> ohrrpgce at lists.motherhamster.org
>>>>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>>>>>
>>>> _______________________________________________
>>>> Ohrrpgce mailing list
>>>> ohrrpgce at lists.motherhamster.org
>>>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>>>>
>>> _______________________________________________
>>> Ohrrpgce mailing list
>>> ohrrpgce at lists.motherhamster.org
>>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>>>
>> _______________________________________________
>> Ohrrpgce mailing list
>> ohrrpgce at lists.motherhamster.org
>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20210204/b15f372c/attachment.html>


More information about the Ohrrpgce mailing list