PyMusicLooper icon indicating copy to clipboard operation
PyMusicLooper copied to clipboard

Try common tags by default for `play-tagged` command

Open Splendide-Imaginarius opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

When using the play-tagged command, manually checking which tag convention a given file uses is bothersome, as is manually entering that on the command line.

Describe the solution you'd like

If no tags are explicitly specified on the command line for play-tagged, check for commonly used tags and use those if they're found.

I looked at SDL_mixer, and I see that it supports the following:

  • LOOPSTART
  • LOOPLENGTH
  • LOOPEND
  • LOOP_START
  • LOOP_LENGTH
  • LOOP_END
  • LOOP-START
  • LOOP-LENGTH
  • LOOP-END

Meanwhile vgmstream supports the following:

  • LOOP_START
  • LOOPPOINT
  • COMMENT=LOOPPOINT
  • LOOPSTART
  • um3.stream.looppoint.start
  • LOOP_BEGIN
  • LOOP
  • XIPH_CUE_LOOPSTART
  • LOOPS
  • LOOPLENGTH
  • LOOP_END
  • LoopEnd
  • XIPH_CUE_LOOPEND
  • LOOPE

Describe alternatives you've considered (if relevant)

Picking a default tag pair for the tag command could be done as well, but since many game engines expect a specific tag pair, and there's inconsistent behavior between game engines, this should probably not be done automatically.

If supporting all of the ones I listed is too unwieldy, I suppose we could just check for LOOPSTART, LOOPLENGTH, LOOPEND, and the underscore-containing variants thereof. I don't see much harm in supporting all of them though; it seems that these are all used somewhere in the wild, and supporting all of them just means having more entries in a list of strings that we iterate through.

Additional context

I would be happy to submit a PR if you'd be amenable to accepting one.

Splendide-Imaginarius avatar Oct 31 '24 04:10 Splendide-Imaginarius

Thanks for the research and links provided @Splendide-Imaginarius, they're a great resource and guide for implementing this feature. I imagine this would make the --tag-names argument for optional overrides, keeping the default behavior automatic, which would improve streamline and improve the play-tagged command's ease-of-use.

As an aside, since I had the vgmstream foobar plugin, I decided to test a few of the PyMusicLooper's tag outputs, and so far it seems to work out of the box with tagged FLAC format files (which is great!). Tagged file in other formats like ogg and mp3 do not seem to be parsed as expected though, so maybe the tag metadata is expected differently?

arkrow avatar Mar 28 '25 00:03 arkrow

As an aside, since I had the vgmstream foobar plugin, I decided to test a few of the PyMusicLooper's tag outputs, and so far it seems to work out of the box with tagged FLAC format files (which is great!). Tagged file in other formats like ogg and mp3 do not seem to be parsed as expected though, so maybe the tag metadata is expected differently?

@arkrow I think it's a recent regression in vgmstream. In theory vgmstream is supposed to support any tag metadata that ffmpeg reads, but I think they broke this sometime in the last couple years. I'm intending to bisect it and file a bug with vgmstream, but I haven't had the time to do this yet.

Splendide-Imaginarius avatar Oct 28 '25 12:10 Splendide-Imaginarius

Actually I just checked latest vgmstream and it looks like they fixed Ogg Vorbis looping. I'm not sure which commit is responsible for the fix.

Splendide-Imaginarius avatar Oct 28 '25 14:10 Splendide-Imaginarius