pouët.net

Go to bottom

Extracting notes from modules? (.mod? .xm?)

category: music [glöplog]
 
Hey,
yesterday I made some kind of music player/tracker in a game named "Garry's Mod" which has Lua scripting support.
I used some of the default sounds as instruments.
It doesn't sound that good, but here it is anyways:

Video Capture: http://www.youtube.com/watch?v=j-HhV6410jU

I don't know if I want to continue working on this, but the problem
I had is the lack of example songs.
The song your hear in the video are the first 4 patterns of the mega mix '88 by ziphoid.
I converted these by hand.

This is how it looks like: http://pastebin.com/BE9R2RaP

As you can see, the song is a huge table which consists of one table per "channel".
Each of these "channels" can be filled by even smaller tables which contain info on the sound; at the moment, this includes instrument and note.

Are there existing solutions / libraries that could help me with extracting the notes from a module and mapping the instruments correctly?
added on the 2013-03-02 13:49:00 by PotcFdk PotcFdk
Writing a mod loader is trivial work. Pick the formats you want to support from this archive. MODFIL11.TXT for MOD, XM.TXT for XM.
You can ignore a lot of stuff there if you just want the raw note events.
Another option would be to use e.g. libmodplug and rely on its ModPlug_GetPattern function. I don't think it provides access to the order list though, so you have no indication in which order the patterns should be played. So yeah, reading it yourself might cause the least frustration.
I never did such a thing before, but my current output looks kind of valid.

One thing is confusing me:
For the first note, Milkytracker shows "B-4".
My program shows "226", which is, according to your file, "B-2".
added on the 2013-03-02 21:47:08 by PotcFdk PotcFdk
The classic Amiga Protracker octaves are named differently, which can be confusing at first. There are only three originally.
added on the 2013-03-02 22:56:20 by Marq Marq
Yeah, middle-C is different in various trackers, in ProTracker it's C-2, in FT2/Milky it's C-4, in IT/MPT it's C-5... As long as it's your middle C, the number next to it doesn't matter much... :)
It was hard, but I have some progress.
I made a converter in C++ that reads the notes, maps the instruments correctly and sorts the patterns. Eventually it writes a .lua file with a huge table inside.

http://www.youtube.com/watch?v=QYH1dd222Xo

This is using the samples from the module.
Obviously, it isn't 100 % correct.
By the way, that "lag" that you can hear is because of Fraps.
As long as the FPS is over ~ 60 it doesn't lag like this.
added on the 2013-03-03 01:39:43 by PotcFdk PotcFdk
Okay, next up: implementing the effects :)
added on the 2013-03-03 01:57:47 by Preacher Preacher
Great stuff PotcFdk. Been messing around with Gmod since it's inception and this is certainly very impressive. Instant rulez when you release. ..Does this make Gmod LUA a new platform? :P
added on the 2013-03-03 08:19:29 by Alopex Alopex
You're all assuming the samples are tuned correctly :)
added on the 2013-03-03 09:37:52 by _-_-__ _-_-__
Nice work.
Now, improve it! :D
added on the 2013-03-03 09:56:31 by ham ham
I haven't really worked on this for quite some time,
but I thought it would be worth mentioning that I github'd it:

https://github.com/PotcFdk/pLuadee

It lacks a proper description / manual.
If you need help or want an in-game demonstration - I'd do that.
I wasn't sure if I should release it as a "prod", so I didn't.
added on the 2013-06-27 03:39:25 by PotcFdk PotcFdk

login

Go to top