mixxxdj / mixxx

Mixxx is Free DJ software that gives you everything you need to perform live mixes.
http://mixxx.org
Other
4.43k stars 1.27k forks source link

feature request: chiptunes support VGM (Video Game Music) #12122

Open ghost opened 11 months ago

ghost commented 11 months ago

Feature Description

Hi

Mixxx already can play tracker formats using ModPlug but I would like it to play chiptunes too. Is anybody interested in adding chiptunes support? Then Mixxx will become the ONLY DJ Software being able to mix chiptune music! I think the same way of working as for Tracker files (ModPlug) can be used: decode the file into RAM and then give this data to Mixxx.

There is a wonderful player called ZXTune that uses many open source libraries to play a lot of chiptune formats. This player is available for Android, Windows, MacOS, Linux so the code will run everywhere.

https://zxtune.bitbucket.io/

https://github.com/vitamin-caig/zxtune

https://github.com/vitamin-caig/zxtune/tree/develop/src/formats/chiptune

Supported formats:

Here are music catalogues to download music files:

Some open source libraries to use (see ZXTune source code for maybe some more):

Supported formats by Game Music Emu afbeelding

ghost commented 11 months ago

I'm highly interested to test if somebody wants to work on this!

ghost commented 11 months ago

Also nice would be support of AdLib sound files which can be made yourself using DOSBox https://www.dosbox.com/

Hardware-independent AdLib sound player library

https://github.com/adplug/adplug

Supported AdLib formats: A2M, ADL, AMD, BAM, CFF, CMF, D00, DFM, DMO, DRO, DTM, HSC, HSP, IMF, KSM, LAA, LDS, M, MAD, MID, MKJ, MSC, MTK, RAD, RAW, RIX, ROL, S3M, SA2, SAT, SCI, SNG, XAD, XMS, XSM

daschuer commented 11 months ago

Which format do you need the most? Do you have such files in your library? Which player do you use to play them?

ghost commented 11 months ago

Most formats are obscure formats and you can't find many of them. I have however many VGM files, So in order to make sense to add this to Mixxx, I changed my request.

So I changed the request to a very popular multiplatform format VGM: https://en.wikipedia.org/wiki/VGM_(file_format)

You can find many files:

https://vgmrips.net

And many players:

https://audacious-media-player.org/

https://www.foobar2000.org/components/view/foo_gep

https://zxtune.bitbucket.io/

I don't know if there is a library for VGM but Audacious and zxtune are open source and they can play VGM. I recommend ZXtune because it runs everywhere and very good quality.

update: I found this library https://github.com/ValleyBell/libvgm

There is also vgmstream for streamed formats:

https://vgmstream.org/

I hope you want to add this to Mixxx?

afbeelding

Holzhaus commented 11 months ago

This is supported by FFmpeg when built with GME support: https://www.ffmpeg.org/general.html#Game-Music-Emu

We already support FFmpeg, so I suppose we only need to add the formats to SoundSourceFFmpeg IIRC.

ghost commented 11 months ago

We already support FFmpeg, so I suppose we only need to add the formats to SoundSourceFFmpeg IIRC.

If you provide a test version, I want to test it!

Is FFmpeg now used to play audio from MP4 video files in Mixxx? Or is it also used to play MP3 (or other) formats?

ghost commented 11 months ago

So will this be added? Nobody really confirms.

Swiftb0y commented 11 months ago

That's because while nobody opposes it, nobody with authority needs it either right now. The beauty of open source is that if you want it, you can do it yourself. So I'd encourage you to check out our "get involved" section and contribute the feature yourself. As already established, its not super hard to implement using ffmpeg and we will do our best to assist you along the way if you'll decide to take this into your own hands. Just please understand that I'm (and I imagine I'm speaking for the rest of the team here as well) not implementing each and every niche feature people ask for because I/we simply have other priorities. Thank you.

ghost commented 11 months ago

I'm not a developer and don't know anything about code. I don't want to follow a programming course just to add this to Mixxx, if I even can do it when having 0 experience :) And because it's not so hard, I thought somebody wanted to spend a little bit time on it :(

Swiftb0y commented 11 months ago

I'm not a developer and don't know anything about code.

Neither did I really before getting interested in mixxx. Everyone gets started somehow. :wink:

And because it's not so hard, I thought somebody wanted to spend a little bit time on it :(

Well, this is a hobby. I don't work on mixxx because it's easy but because its fun or I want a particular feature. Unless you're lucky enough that that somebody with coding skills (or the willingness to learn them) and the same feature request shows up to dedicate some time on it, it's unlikely to happen.

To summarize, nobody is currently against adding VGM support (we very much welcome it generally actually), it just seems like that nobody (including you) is interested in implementing it right now.

ghost commented 11 months ago

I'm sad now :( I also have autism and learning something new is REALLY hard for me. So the chance I can do this myself is close to Zero. Goodbye, I don't know if I will return here :((((((((((((((((((((((((((((((((((((((((((((

ghost commented 11 months ago

VGM music just means a lot to me.

Swiftb0y commented 11 months ago

I figured explaining the situation to you is better than leaving you without an answer. Expecting us to implement a niche feature for you is not realistic. I apologize if I've been insensitive in my previous messages.

Holzhaus commented 11 months ago

As @Swiftb0y pointed out, it's not that likely that someone will solve this issue for you, but contributions are always appreciated and even without prior coding knowledge, there are a few things you can do to move this issue forward.

First of all, if you're using Linux you need to check that FFmpeg actually supports the codecs. On macOS and Windows we ship our own copy of FFmpeg, so this should not be an issue, but on Linux, we just link it. This means that if you're using Linux, you need to verify that your FFmpeg version actually supports the Codecs in question. You could try to play back the files using ffplay command.

If that works, you can try to enable the Codecs in the code. For this you need to clone the git repository and be able to build the code. This is documented here:

When running the cmake step, make sure to pass -DFFMPEG=ON, otherwise FFmpeg support might not be enabled at all.

Once you're able to compile your own version of Mixxx, have a look at this file: https://github.com/mixxxdj/mixxx/blob/main/src/sources/soundsourceffmpeg.cpp#L372 This is where the FFmpeg Codecs are whitelisted. This is where you need to add support for vgm. You can probably just copy some lines to add an else if for vgm.

If I didn't forget something, this may already suffice to support for this format. Afterwards, recompile mixxx and drag a vgm file onto a deck to check if it works.

If you need help with, feel free to ask your questions on the #development channel on Zulip Chat.

ghost commented 11 months ago

If you need help with, feel free to ask your questions on the #development channel on Zulip Chat.

Please answer my question on the chat! I'm trying to compile mixxx on windows. I have a problem with QT 6, an error. See chat for details

ywwg commented 11 months ago

One way to work around this issue would be to convert your VGM or other files to regular mp3 using ffmpeg. This would still take some work but would be easier than writing support for mixxx. I don't know for sure if these steps will work but this is a good place to start:

  1. install libgme and libgme-dev on your system -- ubuntu seems to have packages
  2. build ffmpeg with gme support as described at their docs. You may have to get help from the ffmpeg folks to figure out exactly how to do this.
  3. use ffmpeg to convert your files to mp3 or any other format you like, something like: ffmpeg -i input.vgm -b:a 256k output.mp3

Then mixxx will be able to play those files back.

ghost commented 11 months ago

Sorry, but that's not what I want.

ghost commented 11 months ago

. On macOS and Windows we ship our own copy of FFmpeg, so this should not be an issue, but on Linux, we just link it.

Where in the installation folder of Mixxx can I find this ffmpeg? Is that one supporting GME ?

daschuer commented 11 months ago

I have just read about an issue with ffmpeg: https://github.com/termux/termux-packages/issues/13888

libvgm seems to be the solution: https://github.com/ValleyBell/libvgm

You may ask there for a recipe to bring libvgm to Mixxx. You may point them to our modplug souns source: https://github.com/mixxxdj/mixxx/blob/main/src/sources/soundsourcemodplug.cpp

I don't know how the situation with libopenmpt is. Does that Support VGMs?

There is also a wrapper package that wraps libopenmpt into modplug. Since we already have modplug sound source, maybe we can use just that: https://packages.debian.org/sid/libopenmpt-modplug1

ghost commented 11 months ago

Hi everybody!!!

I followed @Holzhaus instructions above but it doesn't work :( Here is what I did:

The modified function is below: I added this code

else if (!strcmp(pavInputFormat->name, "vgz")) { list.append("vgz"); continue; }

`QStringList SoundSourceProviderFFmpeg::getSupportedFileTypes() const { QStringList list; QStringList disabledInputFormats;

// Collect all supported formats (whitelist)
const AVInputFormat* pavInputFormat = nullptr;
void* pOpaqueInputFormatIterator = nullptr;
while ((pavInputFormat = av_demuxer_iterate(&pOpaqueInputFormatIterator))) {
    if (pavInputFormat->flags | AVFMT_SEEK_TO_PTS) {
        ///////////////////////////////////////////////////////////
        // Whitelist of tested codecs (including variants)
        ///////////////////////////////////////////////////////////
        if (!strcmp(pavInputFormat->name, "aac")) {
            list.append("aac");
            continue;
        } else if (!strcmp(pavInputFormat->name, "aiff")) {
            list.append("aiff");
            continue;
        //VGM
        } else if (!strcmp(pavInputFormat->name, "vgz")) {
            list.append("vgz");
            continue;
        } else if (!strcmp(pavInputFormat->name, "mp3")) {
            list.append("mp3");
            continue;
        } else if (!strcmp(pavInputFormat->name, "mp4") ||
                !strcmp(pavInputFormat->name, "m4v")) {
            list.append("mp4");
            continue;
        } else if (!strcmp(pavInputFormat->name, "mov,mp4,m4a,3gp,3g2,mj2")) {
            list.append("mov");
            list.append("mp4");
            list.append("m4a");
            list.append("3gp");
            list.append("3g2");
            list.append("mj2");
            continue;
        } else if (!strcmp(pavInputFormat->name, "opus") ||
                !strcmp(pavInputFormat->name, "libopus")) {
            list.append("opus");
            continue;
        } else if (!strcmp(pavInputFormat->name, "wav")) {
            list.append("wav");
            continue;
        } else if (!strcmp(pavInputFormat->name, "wv")) {
            list.append("wv");
            continue;
            ///////////////////////////////////////////////////////////
            // Codecs with failing tests
            ///////////////////////////////////////////////////////////
            /*
        } else if (!strcmp(pavInputFormat->name, "flac")) {
            // FFmpeg failure causes test failure:
            // [flac @ 0x2ef2060] read_timestamp() failed in the middle
            // SoundSourceFFmpeg - av_seek_frame() failed: Operation not permitted
            list.append("flac");
            continue;
        } else if (!strcmp(pavInputFormat->name, "ogg")) {
            // Test failures that might be caused by FFmpeg bug:
            // https://trac.ffmpeg.org/ticket/3825
            list.append("ogg");
            continue;
        } else if (!strcmp(pavInputFormat->name, "wma") ||
                !strcmp(pavInputFormat->name, "xwma")) {
            list.append("wma");
            continue;
        */
            ///////////////////////////////////////////////////////////
            // Untested codecs
            ///////////////////////////////////////////////////////////
            /*
        } else if (!strcmp(pavInputFormat->name, "ac3")) {
            list.append("ac3");
            continue;
        } else if (!strcmp(pavInputFormat->name, "caf")) {
            list.append("caf");
            continue;
        } else if (!strcmp(pavInputFormat->name, "mpc")) {
            list.append("mpc");
            continue;
        } else if (!strcmp(pavInputFormat->name, "mpeg")) {
            list.append("mpeg");
            continue;
        } else if (!strcmp(pavInputFormat->name, "tak")) {
            list.append("tak");
            continue;
        } else if (!strcmp(pavInputFormat->name, "tta")) {
            list.append("tta");
            continue;
        */
        }
    }
    disabledInputFormats.append(pavInputFormat->name);
    continue;
}

if (!disabledInputFormats.isEmpty()) {
    kLogger.info().noquote()
            << "Disabling untested input formats:"
            << disabledInputFormats.join(QStringLiteral(", "));
}

return list;

}`

I get this image when drag and drop a VGZ file, with a red sign

afbeelding

Can somebody please tell what I need to change in the code to allow VGZ files? I'm NOT a developer so tell me step by step please! I also don't know how to read or write code... I can compile Mixxx again with the changes you tell me!

file soundsourceffmpeg.cpp in zip file

soundsourceffmpeg.zip

VGZ files to test in zip file

OutRun(Arcade).zip

Please help! I'm already a big step forward!!! It seems Mixxx doesn't allow VGZ files to be drag and dropped into a deck, and also Mixxx doesn't see them in the file browser. Maybe somebody knows where this can be changed in the code?

Is FFmpeg included with Mixxx (on Windows) compiled to support GME? https://www.ffmpeg.org/general.html#Game-Music-Emu

artworks-NnMVVJMzVaVzqdj3-1bqkLw-t500x500

ghost commented 11 months ago

I don't know how the situation with libopenmpt is. Does that Support VGMs?

I don't think it supports VGM because libopenmpt is for tracker formats. Also libmodplug doesn't support it. So those 2 libraries won't help us I think.

I tested the program openmpt which the libopenmpt is based on, and this are the formats

https://openmpt.org/

afbeelding

Opening a VGM file gives this:

afbeelding

daschuer commented 11 months ago

It looks like the situation is more difficult than original expected. We have assumed that libopenmpt can play VGMs but it can't. So ffmpeg cannot do it out of the box. There are forks out here, but using that is probably too adventures. Two somehow mature libraries can be found:

If you like to follow this route, I would try to build there demo applications along with their libraries and check out if they suite to your needs.

The next would be to copy and rename: https://github.com/mixxxdj/mixxx/blob/main/src/sources/soundsourcemodplug.cpp/h And duplicate all occurrences in the Mixxx source.

Than redirect the calls from libmodplug to the library of your choice. This is no longer an easy task unfortunately. You will need help and patience. The best from one of the chiptunes community who has an original interest to DJ with VGMs. I am sorry no one is interested in this in our community.