Register FAQ Search Today's Posts Mark Forums Read
Go Back   JazzJackrabbit Community Forums » Open Forums » General Jazz Jackrabbit Talk

MP3 as level music?

instig1989

JCF Member

Joined: Jan 1970

Posts: 5

instig1989 has disabled reputation

Jul 31, 2022, 04:50 AM
instig1989 is offline
Reply With Quote
Unhappy MP3 as level music?

Hello, everyone!
I hope this is the right place to ask this question.

I would like to know if there is any way to make an MP3 or OGG file into a Jazz2 music file.

I've read this forum post about module music: https://www.jazz2online.com/jcf/showthread.php?t=19570
However it doesn't seem to cover what I'm looking for.

Initially i would have loved to create a scripted music file with an intro segment and a loop segment from an existing MP3 file in Audacity. Though I doubt it can be saved in a module file like XM.

I'd be happy if I can just make the game play an MP3 file on a loop at this point.
Is that even possible?

I'd be thankful for any help in this regard.
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 852

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Jul 31, 2022, 07:17 AM
Seren is offline
Reply With Quote
As pointed out in the post you linked to, the mod JJ2+, used by the majority of the active community, supports mp3 and ogg files out of the box. As such, many levels uploaded to Jazz2Online simply come with mp3 or ogg music. There is no support for custom loops and files are always played beginning to end before looping.

If you want an mp3 file to play in vanilla JJ2, the short answer is no. JJ2 only supports module music files. You can learn more about the difference in the post you linked to. Install JJ2+ or use module music.

For the long answer, let me use a simile. Say you have modeled a 3D scene in Blender and you want a picture of it. This is easy, you just render it. This corresponds to converting from module music like j2b or xm to stream music like mp3 or ogg—also easy, because all that mp3 and ogg need to know is how to play the music, and there is software that plays j2b and xm files.

Now say you have a picture and you want to convert it to a 3D scene. This should immediately sound more complicated if not entirely ill-defined as a task. The picture is just a set of pixels. It contains no information about shapes of the models that could've been used to create it. It's missing an entire dimension. The only way you could possibly "convert" it is by a painstaking manual process, modeling the scene yourself and making sure it matches. This is what "converting" from a stream format to a module format would look like. An mp3 doesn't know the difference between a drum and a guitar string, it's just a wave that tells your headphones membrane how to vibrate. An xm needs to have a clean sample of the instrument you're using and needs to know the sequence of notes you're playing—that's just how the format works.

There is, of course, a second approach. When tasked with converting a picture to a 3D scene, you could just model a single rectangle and slap the picture onto it as a texture. That is, technically, converting the picture to a 3D scene. It's not pretty, it doesn't really utilize the fact it's in 3D, it's not what you think of when you say "3D scene," but if that's all you need, it might work. This is also achievable in the original case. You can, technically, create a module music file that only has one sample, one instrument, and one pattern, which does nothing but play the sample, which is the entire mp3 file. In theory, this actually works. In practice, there is a catch. To my knowledge, other than mo3 (not supported by vanilla JJ2), no module music format supports compressed samples. All samples are raw wav files. This means that, unless your song is only a few seconds long, the resulting file would be gigantic, likely on the order of 100 MB. A music file of this size is almost certain to crash JJ2, as the game is known to exceed its memory limits even with music files just a couple of megabytes in size.

In conclusion, install JJ2+ or use module music.
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.
instig1989

JCF Member

Joined: Jan 1970

Posts: 5

instig1989 has disabled reputation

Aug 1, 2022, 05:18 AM
instig1989 is offline
Reply With Quote
Thank you for your swift answer. x)

I understand now what's going on.
I was hoping to maybe cheese it like in the later example you stated with one note being the intro sample and the second note being the loop sample. But yeah, that would be astronomical in a wave format.

I'll have to look into the JJ2+ mod then.

Thank you very much for the clarification.
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT -8. The time now is 06:29 PM.