Asset - Extension MOD Music Player (ModPlug)

Mick

Member


Description
This is a music module player that uses libmodplug and audio buffers (queue) in GMS to play MOD music in 22 different formats (Amiga MOD, XM, S3M, IT etc.). MOD Player currently supports Windows, Ubuntu Linux, Mac OS X (built on 10.9) and Android. Individual tracks can be muted and tempo can be changed in real time. The libmodplug source code is released under public domain so there should be no restrictions to use it in your games.

Documentation
http://gamephase.net/files/linked/mod-player-documentation.pdf

Marketplace link
https://marketplace.yoyogames.com/assets/5289/mod-player

Supported MOD formats
Code:
MOD   ProTracker (Amiga)
STM   ScreamTracker 2
S3M   ScreamTracker 3
XM    FastTracker 2
IT    Impulse Tracker
669   Composer 669
AMF   ASYLUM Music Format / DSMI Advanced Music Format
AMS   Extreme's Tracker / Velvet Studio
DBM   Digi Booster Pro
DMF   X-Tracker
DSM   DSIK Format
FAR   Farandole Composer
MDL   DigiTrakker
MED   OctaMED (Amiga)
MTM   MultiTracker
OKT   Oktalyzer
PTM   PolyTracker
ULT   UltraTracker
UMX   Unreal Music Package
MT2   MadTracker 2
PSM   Epic Megagames MASI
 
Last edited:
F

Falconsoft-Industries

Guest
Wait when, you say IT Impulse Tracker, could that be used to track brain impulses for a game that is controlled by using the emotive headset and reads for certain brain patterns to control the movement of a object in the game? Because right now that's what I really need for a game I am designing.
 

Carnivius

Member
Wait when, you say IT Impulse Tracker, could that be used to track brain impulses for a game that is controlled by using the emotive headset and reads for certain brain patterns to control the movement of a object in the game? Because right now that's what I really need for a game I am designing.
Not sure if you serious or joking. :p Either way I'll just say Impulse Tracker is another music creation program much like Fast Tracker, ProTracker and all the others in that list of supported formats. :p
 
F

Falconsoft-Industries

Guest
I am serious because mind training is important but it also can be fun and have untapped potential.
 
F

Falconsoft-Industries

Guest
basically i am planning on making it send wireless signals to appliances by thought and operating them once the .exe is opened.
example turn on pc double click "go do that now.exe" (thinks coffee maker go make me a latte for when i walkj to the kitchen and its brewed) {coffee maker then makes latte}
 

Mick

Member
basically i am planning on making it send wireless signals to appliances by thought and operating them once the .exe is opened.
example turn on pc double click "go do that now.exe" (thinks coffee maker go make me a latte for when i walkj to the kitchen and its brewed) {coffee maker then makes latte}
That would all be amazing, but this thread is not the correct place to talk about it.
 

Mick

Member
I have updated the MOD Player (1.1.0) to fix a problem with looping. I also made the audio buffers smaller to even out CPU usage.
 

Mick

Member
Due to a feature request I updated the extension (1.2.0) with functions to set and get the volume for individual channels.
 

Ednei

Member
I bought this extension and tested it.
The extension works on windows and Android.

But the music is being played with noises.

Is there any way to make the sound cleaner?

Are there any of the supported extensions that play with better quality and no noise?

Thank you.

Ednei
 

Mick

Member
I bought this extension and tested it.
The extension works on windows and Android.

But the music is being played with noises.

Is there any way to make the sound cleaner?

Are there any of the supported extensions that play with better quality and no noise?

Thank you.

Ednei
My mod player has worked without noises before, the problem is probably due to the audio engine changes (bugs) in GMS. Are you using it with GMS1.4 or GMS2?

Edit: I will do a test with 48khz sample rate as soon as I can. Some other audio problems seems to have been "solved" by changing sample rate to 48khz
 
Last edited:

Ednei

Member
My mod player has worked without noises before, the problem is probably due to the audio engine changes (bugs) in GMS. Are you using it with GMS1.4 or GMS2?

Edit: I will do a test with 48khz sample rate as soon as I can. Some other audio problems seems to have been "solved" by changing sample rate to 48khz
Thanks for the answer
Do I have to change this parameter?
Code:
// Sample rate is hardcoded to 44100 in the dll
sample_rate = 44100;
What is the recommended value? (Im using GM2)

Thank you.
 
Last edited:

Mick

Member
The sample rate is "hard coded" in the dll. I will see if changing to 48khz will fix the problem, if so, I will update the extension so you can choose the sample rate when initializing the mod player.
 

Ednei

Member
The sample rate is "hard coded" in the dll. I will see if changing to 48khz will fix the problem, if so, I will update the extension so you can choose the sample rate when initializing the mod player.
I hope you succeed.
I'm developing an RPG on the Android platform.
I was interested in using its extension because of the possibility of drastically reducing the size of the project.
Is there any possibility of this extension running on the iOS platform?

Thank you.
 

Mick

Member
I hope you succeed.
I'm developing an RPG on the Android platform.
I was interested in using its extension because of the possibility of drastically reducing the size of the project.
Is there any possibility of this extension running on the iOS platform?

Thank you.
I'm looking into this some more now, by the way, is the audio noisy on Android / Windows or both? When I test on Windows everything seems normal, could you perhaps PM me a MOD file that is noisy for you, or are all MODs noisy?

About IOS, I don't have the tools (or patience) necessary, it is totally possible to get it to work though.
 

Ednei

Member
I'm looking into this some more now, by the way, is the audio noisy on Android / Windows or both? When I test on Windows everything seems normal, could you perhaps PM me a MOD file that is noisy for you, or are all MODs noisy?

About IOS, I don't have the tools (or patience) necessary, it is totally possible to get it to work though.
Hello!

Noise is happening on both windows and android.

Below is the link with the mod player test project for you to check:

https://drive.google.com/file/d/1muEOTp0MKoQY6Ave5qvzc-zL8xStZQX2/view?usp=sharing

I'm using the latest version of GM2.

Thank you.

Ednei
 

Mick

Member
Hello!

Noise is happening on both windows and android.

Below is the link with the mod player test project for you to check:

https://drive.google.com/file/d/1muEOTp0MKoQY6Ave5qvzc-zL8xStZQX2/view?usp=sharing

I'm using the latest version of GM2.

Thank you.

Ednei
I think I found the cause of the problem. You need to increase the number of audio buffers used by the MOD Player if your game runs in 30fps. It seems that the new audio engine in GMS is working differently with audio queues. Using the MOD Player with my version of GMS1.4 that still has the old audio engine, I don't need to increase the amount of buffers when running in 30fps.

To increase the number of buffers, open the create event of obj_mod_player and change buffer_count (line 17) from 7 to 20 (you can try different values).

Please let me know if it works for you!

P.S. I don't know if it's a bug with the new audio engine or just other behaviour, pausing an audio queue doesn't seem to happen instantly always, the sound can stutter before pausing. Again, this doesn't happen with the old audio engine.
 

Ednei

Member
I think I found the cause of the problem. You need to increase the number of audio buffers used by the MOD Player if your game runs in 30fps. It seems that the new audio engine in GMS is working differently with audio queues. Using the MOD Player with my version of GMS1.4 that still has the old audio engine, I don't need to increase the amount of buffers when running in 30fps.

To increase the number of buffers, open the create event of obj_mod_player and change buffer_count (line 17) from 7 to 20 (you can try different values).

Please let me know if it works for you!

P.S. I don't know if it's a bug with the new audio engine or just other behaviour, pausing an audio queue doesn't seem to happen instantly always, the sound can stutter before pausing. Again, this doesn't happen with the old audio engine.
Hello,

I tested the mod player with this configuration and I consider it to be working perfectly for both Windows and Android.

With Android I tested on the Motorola G5S Plus smartphone.

I am very satisfied with the results. :)

I'd like to know what music format you recommend to get the best performance with the best music quality.

Can you give me a suggestion?

Thank you,;)

Ednei
 

Mick

Member
Hello,

I tested the mod player with this configuration and I consider it to be working perfectly for both Windows and Android.

With Android I tested on the Motorola G5S Plus smartphone.

I am very satisfied with the results. :)

I'd like to know what music format you recommend to get the best performance with the best music quality.

Can you give me a suggestion?

Thank you,;)

Ednei
Good to hear that it works!

About the music, it depends what tracker you are used to (if any). For best quality with most advanced features I would recommend XM (Fast Tracker 2) or IT (Impulse Tracker). XM is more similar to the traditional Amiga MOD format but allows for more channels and better sample rate etc. IT is a more advanced but a little different.
 

Ednei

Member
Hello Mick,
I'm very excited about the mod player.
So I'd like to give you a suggestion for a next update.
I do not know if it's possible. But I would like to have a function of type:

MOD_GetTime: Gets the current position that the music is playing.
MOD_SetTime: Selects the position where the music starts playing.

For example:

Code:
var sound_id = MOD_LoadSong ("music.xm", -1);
MOD_Play ()
music_stop = MOD_GetTime (); // capture the current seconds of the music played
MOD_Stop ()


MOD_SetTime (music_stop) // adjusts the current song to the selected position.
MOD_Play ()

I thought about these features because I'm developing an RPG game. Imagine that the character is walking on a piece of land with a certain song. If the character enters combat mode with a creature the music will be changed to a fighting song.

When the fight is over, I would like the previous song to continue from where I had paused.

I know there is a MOD_Pause (pause) function, but this function seems to me to be more suited to the Pause function of the game.

With the MOD_GetTime and MOD_SetTime functions I could store the position where a song stopped, play another song, and retrieve the previous musican in the position I want.

What do you think?

Thank you.

Ednei.
 

Mick

Member
I updated this extension so it should now work for Ubuntu 64bit and maybe for Mac OS X 64bit.

With the MOD_GetTime and MOD_SetTime functions I could store the position where a song stopped, play another song, and retrieve the previous musican in the position I want.

What do you think?
I'm sorry, for some reason I had missed your post. I looked into this, it is possible but not very reliable. Here is from the LibModPlug code documentation:

Seek to a particular position in the song. Note that seeking and MODs don't mix very well. Some mods will be missing instruments for a short time after a seek, as ModPlug does not scan the sequence backwards to find out which instruments were supposed to be playing at that time. (Doing so would be difficult and not very reliable.) Also, note that seeking is not very exact in some mods -- especially those for which ModPlug_GetLength() does not report the full length.
So I might add the functions, but I already experienced the brief period of missing instruments when testing.
 

Ednei

Member
I updated this extension so it should now work for Ubuntu 64bit and maybe for Mac OS X 64bit.


I'm sorry, for some reason I had missed your post. I looked into this, it is possible but not very reliable. Here is from the LibModPlug code documentation:



So I might add the functions, but I already experienced the brief period of missing instruments when testing.
I love this extension. I have already updated on my project and it is working perfectly.
It is unfortunate that there is no reliable solution to play music from a desired point.
I will wait patiently for a workaround if someone can do it.
Thank you.
 

Ednei

Member
I love this extension. I have already updated on my project and it is working perfectly.
It is unfortunate that there is no reliable solution to play music from a desired point.
I will wait patiently for a workaround if someone can do it.
Thank you.
Hi Mick, how are you?

Now that I'm at home because of the quarantine imposed by COVID-19, I went back to work on my RPG project that was stopped for two years.

I'm still having trouble finding a solution to continue the music from where it left off before starting a fight.

Then I got a crazy idea to create a second object called obj_mod_player_2 to store the music of the fight previously.

While the city's music continues to run on normal obj_mod_player, obj_mod_player_2 is paused with battle music.

When the player enters battle mode, I could use MOD_PAUSE () for obj_mod_player and MOD_PLAY2 () to execute obj_mod_player2 during the fight.

When the fight is over, I would use a MOD_PAUSE2 () script to pause obj_mod_player2 and a MOD_PLAY to resume the music of obj_mod_player where the music left off.

Of course, this is all just a theory. I couldn't put it into practice.

As I am not familiar with the use of buffers, I would like to know if this theory could be realized with MOD PLAYER?

If so, what lines should I modify to achieve this goal?

If you can give me a tip I would appreciate it.

Ednei
 
Top