Intro music

Moderator: GZDoom Developers

Post Reply
Korax
Posts: 29
Joined: Fri Sep 23, 2011 5:43 am
Location: South Africa
Contact:

Intro music

Post by Korax »

It will really help my project a lot if I could have an automatic feature of the engine where if I specify that a certain map should play an OGG or non-cdtrack music, that it automatically first try find a similar filename starting with "intro_" and play that first before looping the actual audio file. It will go a long way to add more moodiness.

Example:
I specify that the game should play for map01 a music file: "tester".
Then it tries to find and play "intro_tester" once before looping "tester".

This is similar to how Quake III Arena would work.
Possible?
Last edited by Korax on Thu Apr 19, 2012 3:37 pm, edited 1 time in total.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Intro music

Post by Gez »

What you can do with existing features is provide the ogg complete (with the intro and the looping part seamlessly included as a single track) and use [wiki]audio loop[/wiki] tags.
Korax
Posts: 29
Joined: Fri Sep 23, 2011 5:43 am
Location: South Africa
Contact:

Re: Intro music

Post by Korax »

That could also work well. I'll pass this info along and get a test done and see how it works.
User avatar
Enjay
 
 
Posts: 27234
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Intro music

Post by Enjay »

This is a feature that I'd like to use but the wiki description confuses me. Is anyone able to put up a small example of a level that plays the first part of an ogg once and then repeatedly loops the end part after that?
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Intro music

Post by Gez »

Sure. I'll cobble something up.

Here. It's the "Burly Brawl" tune from Dungeons of Dredmor, which plays when you open a monster zoo. Load that zip in ZDoom with your favorite IWAD (or, your least favorite, I won't judge), and type "changemus brawl.ogg" in the console.

How did I do that? Perfectly lazily. What took the most time was verifying that it works since the full length is more than two minutes and a half.

I have a "brawl-intro.ogg" and a "brawl-repeat" ogg. Since it's a streaming format, I lazily glued them to each other to get a single file. (Ctrl-C/Ctrl-V works in a hex editor.)

Foobar2000 told me, looking at its properties, that the duration is "0:05.415 (238 787 samples)". That's because it's too smart for its own good and doesn't play both streams back to back like ZDoom does (or SLADE 3, by the way). I guess it looks at the first header and stops playing when it reaches the given duration. Anyway, that's good.

On the metadata tab , I right-clicked and chose "add new field". I named that new field LOOP_START and gave it the value 238787, since I thought that a duration in samples would be more precise, and I had that value. (My first attempt, actually, was with just 0:05 since that was the duration the playlist gave me. The lack of precision could be heard. I hadn't thought of looking at the properties tab to get a more precise value then; I guess 0:05.415 would have been precise enough.)
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Re: Intro music

Post by Zippy »

Enjay wrote:This is a feature that I'd like to use but the wiki description confuses me. Is anyone able to put up a small example of a level that plays the first part of an ogg once and then repeatedly loops the end part after that?
You can use any tool that allows you to write custom tags to accomplish this. For example, if it was an MP3, just plain old MP3 tags named LOOP_START and LOOP_END will do.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Intro music

Post by Gez »

Except it won't work with MP3 tags. :p
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Re: Intro music

Post by Zippy »

Right, except that.
User avatar
Enjay
 
 
Posts: 27234
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Intro music

Post by Enjay »

Ah, OK, I think I see where my confusion came from. I was under the impression that the tags could somehow be defined in a ZDoom lump of some sort rather than in the music file. I thought that *somewhere* (eg mapinfo or sndinfo) you would write something like

LOOP_START 1:15

To loop an ogg 1 minute 15 seconds in. Or that somehow you had to reference the tag location in a lump somehow.

Thank you for the help. The example made it clear that I was barking up the wrong tree entirely and showed me an example of it working.

[edit] And I got it working with my own file too. Unfortunately, I forgot one thing that means it doesn't quite fit what I wanted nor what the OP wanted either I think.

ie I wanted to play a piece of music once as an intro, have the music move on to a second piece and then loop the second piece for the rest of the time that the player is on the level. What I forgot is that music timing is independent of things like pausing and saving etc so if you play the level until the second piece of music starts, save your game, quit, restart and reload the save, the music will be back to the intro piece for one play again. I guess I'll have to stick to the fingers-crossed ACS timing of music for the the level that I had in mind. So many problems would be solved if ZDoom could save how far through a piece of music is in the same way that it does sounds.

Thanks again for the help though. At least its another feature that I know how to use. (and I noticed that my copy of Foobar was a little out of date too.)[/edit]
User avatar
.+:icytux:+.
Posts: 2661
Joined: Thu May 17, 2007 1:53 am
Location: Finland

Re: Intro music

Post by .+:icytux:+. »

Enjay wrote:I guess I'll have to stick to the fingers-crossed ACS timing of music for the the level that I had in mind. So many problems would be solved if ZDoom could save how far through a piece of music is in the same way that it does sounds.[/edit]
Doesn't that also fail if you pause while the intro is playing? won't that make the ACS counter stop but make the music continue, which will make the intro part loop itself first and then change songs in the middle of it.
User avatar
Enjay
 
 
Posts: 27234
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Intro music

Post by Enjay »

Yes, it fails with just about anything that stops/restarts the game world but not the music. On one map I have the "intro song" saved with about 5 minutes of silence tacked on to the end so that if the game is paused there will just be a period of silence between tune 1 ending and tune 2 starting. ACS changes the music about 2 minutes in (when the first tune ends). Of course, if the game is paused for more than 5 minutes then the system fails and the intro starts again.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”