creating iMuse effect in AGS?

Started by He-Man, Tue 25/10/2005 15:13:52

Previous topic - Next topic

He-Man

Hi there.

I was just wondering if it would be possible to create soundtracks with AGS a la the iMuse system LEC uses in their games from MI2 and forth.

For those of you who are not familiar with the iMuse system I'll try to explain:
The music in the town (or whatever) Woodtick in MI2 is buildt up around a reggae loop. But when you enter one of the ships the music expands (eg. more instruments are added to the beat). There's even a bar of variation before it changes. The best thing about this is that the music changes by the bars so that the first loop ends before the next continues. That means you get the feeling that the music never change or fade out.

I hope I'm being clear enough here...

Thanks...

Elliott Hird

Possible. Using the timer functions and the goto functions for midis it would be possible. I'll help, pm me.

edmundito

iMUSE clearly took advantage of synthesized music, and Monkey Island 2 was the tech demo for it. I don't think AGS has the ability to control the instruments for midis or the other supported synth formats.

I bet a module could be written for digital music that does an effect similar to what was done in curse of monkey island. It wouldn't be the same because it would be for digital music, but it would still be dynamic music changes, you know? that would probably make vox files a lot bigger...

Rui 'Trovatore' Pires

Search this board. I remember a topic like this a long time ago. The net result was, yeah, it was sorta possible, using - as Elliott suggested - the "goto functions for MIDIs", aka the SetPos and GetPos thingie.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

strazer

There's also the DirectMusic plugin:

Quote from: modgeulator on Wed 28/04/2004 09:12:50
It's intended for playback of DirectMusic Producer soundtracks. You can create scripted interactive music in DMP and use this plug-in to load your project and call routines from within AGS.
If you've ever paid attention to the music in LucasArts games, from Monkey Island 2 onwards, you should have noticed how the music is constantly changing depending on what you do in the game. Think of the music in Woodtick, or at the swamp/voodoo lady. If you can learn DirectMusic Producer, you can now have music like that in an AGS game.

Rui 'Trovatore' Pires

I thought that plugin was in beta phase still! I must add it to my site!
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

strazer

It sounds like it is not quite finished:

Quote from: modgeulator on Thu 19/08/2004 07:42:07It's still being worked on occasionally. That said, I don't think it's ever going to have any sort of appeal to anyone other than myself, so I'm wasn't planning on releasing anything else publicly. If anyone wants to use DirectMusic for their game they can feel free to message or email me and I'll give them what I have and any other assistance I can provide.

Elliott Hird

DirectMuse seems like a pain to work with too.

I'd do it like this:

music1.mid
music2.mid (transition)
music3.mid

room1 plays music1

room2 has in rep_ex
if music 2 is not playing
check if it's already played, play music 3 otherwise
if (getpos(music1 pos1) || (etc with a few break points))
{
PlayMusic(music2);
}

messy pseudo-code, sorry

modgeulator

You can do something like that with scripting in AGS pretty easily.  The GetMidiPosition() function returns the current beat so, for example when you want to transition, if you have a 4/4 piece of music, just set it up in repeatedly_execute_always to wait until the current beat is divisible by 4, play the transition music and use PlayMusicQueued to que the next piece. You can also do this with digital audio music tracks: you just need to calculate the tempo and time signature in such a way as to determine the length, in milliseconds, of each measure.

Unfortunately, both ways suck ass when you actually try them out. The problem is the music totally glitches when you stop and start another track. The notes all cut off in a very obvious and unpleasant way and for some reason it ALWAYS plays some notes from further along in the track. With digital audio unfortunately the functions don't seem to be terribly accurate, so you'll get it half a beat on or off or so everytime it transitions.

So yeah, you can script iMuse-ish transitions and stuff in AGS, but it will glitch really badly when it plays them - thus negating the whole point ::)

There's two big problems with my simple little plugin:
1) It doesn't work alongside AGS DirectSound
2) You have to put everything together in DirectMusic Producer, which is a notoriously un-user friendly and buggy bit of software. Sorry about that  ;)

Adamski

QuoteWith digital audio unfortunately the functions don't seem to be terribly accurate, so you'll get it half a beat on or off or so everytime it transitions.

It's not the accuracy of the functions as such transitions work beautifully with .wavs - it's something to do with the compressed audio decoders.

modgeulator

Quote from: Adamski on Wed 26/10/2005 11:27:50
QuoteWith digital audio unfortunately the functions don't seem to be terribly accurate, so you'll get it half a beat on or off or so everytime it transitions.

It's not the accuracy of the functions as such transitions work beautifully with .wavs - it's something to do with the compressed audio decoders.

Very interesting. So if you distribute the music in a compressed format and have it decompress to wav's as part of the installation process you'd be in business for a working iMuse-ey soundtrack completely scripted withing AGS? Cool  :D

Of course it'd mean the players would need several hundred megabytes free space for the game, but that shouldn't be much of a problem these days should it?

Adamski

#11
It would be a very heavy-handed way of doing things, but I guess you could do. I mean, you can already crossfade audio tracks in AGS so if you can live without syncronised crossfading to get that "same track, different instruments" effect then it's not really worth doing.

Perhaps there's still something that can be tightened up within AGS to allow this to be done - perhaps some extra variable in the Seek and Get functions to compensate for the decoding? I've been pushing for this since the Dos days so it'd be nice if it could be done flawlessly :)

modgeulator

#12
Just tried to do an experiment with this but it doesn't seem that AGS will play wav files as music?

Also, I have a feeling the inaccuracy is a problem within Allegro.

Adamski

I think CJ took out packing wavs into the .vox file for the sake of sensibility, but if you put the .wavs in the compiled folder it works fine.

modgeulator


Haddas

.OGG produces seamless loops, much like wav. But it's a lot smaller

Pumaman

Quote from: Adamski on Wed 26/10/2005 12:59:53
Perhaps there's still something that can be tightened up within AGS to allow this to be done - perhaps some extra variable in the Seek and Get functions to compensate for the decoding? I've been pushing for this since the Dos days so it'd be nice if it could be done flawlessly :)

Unfortunately I'm not sure how practical this is. The music is decoded in chunks and if you seek to a specific position then the decoder seems to need to decode the whole chunk that you're in, which leads to the effect that you describe.

Elliott Hird

PreloadChunk(int milliseconds, BlockingStyle blocking)

Adamski

could PlayMusic and SeekMP3PositionMillis have an optional variable to excecute the crossfade and seek to the time defined until the chunk is decoded?

modgeulator

Even a game with a pretty hefty soundtrack (for an amateur game at least) of an hour or so would only take 600mb hard drive space. Obviously it would be preferable to be able to leave the soundtrack in a compressed format, but would it really so be terrible to have to decompress to .wav files - considering all the cool stuff the composer could now do? Just asking because I'm keen to write a module for dynamic soundtracks using uncompressed .wav files, would anyone actually be interested in using it?

SMF spam blocked by CleanTalk