Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Endless music playing


Recommended Posts

  • 4 weeks later...
in genesis games and stuff, they dont have MP3s or WAVs, they have instruments, (along with some PS2 games) which play at a certain time depending on the song...

Well, as long as this topic is back from the grave, might I add that this is a common practice. Under different names, like say... Channels and such, allocating a set of objects to play sounds is a very good idea, and im surprised people doing fan games don't do it as often. (Although, they might)

Although, in the interest of conserving memory, and also keeping code condensed. It might be a good idea to handle all the channels or instruments in a single object, or to have one object dictate what the channels are doing. Ill try something like that in what Im using now, and ill see how that goes.

Link to comment
Share on other sites

  • 2 weeks later...

MIDI is pretty much what you are talking about, however, MMF provides no features to directly loop a midi or set it up so it can be scripted do to the fact that the sound is indeed not internal. Your method can and has been done with wave-form compositions like mp3\ogg\wav just as much, including more complex effects like dynamic song phrase transitions. (ex. PSO, Mystic Mansion in Sonic Heroes)

If we had more control over the way the music is playing, you can rig the track so that you have a loopable phrase, and what you could do is while the conditions are true for the music to loop back to X time in the music at Y time, preventing the song from ending, which will keep it in the memory as well as prevent it from ending.

and for example of this, if you listen to one of PSO:BB's audio files, you will see that all of the different segments and transitions are embedded in the .ogg, which shows that at the very least in PSOBB's case you basically end up with a never-ending song because the song is never allowed to end ingame (obviously it will end when you listen to the ogg...

I have very little experience with Dshow though, so I don't know if time jumps are possible, nor how skippy it may sound. You would need some sort of buffer for smooth transition.

Link to comment
Share on other sites

Well, you could certainly do smooth jumps by playing the same track twice, one reference at 100% volume and another at 0% and when you want to make a jump, you could just gradually pan the volume from one track to another after setting your new time in the 0 volume track.

Then of course you could free up the first track so that your performance doesn't get raped.

Link to comment
Share on other sites

I think it'd be much easier to check how close you are from the end of the file (using size of the mp3 in bytes and checking current location)... when you hit a few bytes before the end, jump to byte 0

That should eliminate the jump. No extra shit needed. Try it out, someone.

Link to comment
Share on other sites

  • 1 month later...

For the record, tried this in a recent test with a 1:47 Ogg I'd made with a looping section.

MMF's got a "Get Sample Position/Duration" thing, and that's all done in Milliseconds (So a position of "19000" means its 19 seconds into the song) - All you really need is the exact timing of the bars you want to loop (Which you can find out in Audacity or, if you'd made the music yourself, whatever you're using) and either directly set the position of the same to the beginning of the loop or subtract the length of the loop from the current position.

There's a "Slight" jump, but with a bit of playing around (Shave a couple of ms off the "If Position > 19000" to make it "If Position >= 18960" or some such) you can complete eliminate that, and presto - Loopable music, with none of the shoddy big pauses MMf usually adds in.

Link to comment
Share on other sites

  • 6 months later...

Just for the record, MP3 encoding doesn't usually allow for perfect cut music. This is due to artifacts. So unless your MP3 is encoded using some new shit or whatever, the only way to get around this perfectly is to have sex with Red... I mean...erm.... o.o

Link to comment
Share on other sites

  • 1 year later...

Bumping this topic just to say that there is no need to contrive to do this.

You should just use OGGs. They are as good as MP3s (I'm talking about filesize) and they can be looped flawlessly.

However if you want to make an 'intro' and ' main part' of the music you should preload the 'main part' cause ogg loading is not instant.

Example:

attachment.php?attachmentid=1268&stc=1&d=1266958998

post-359-138639764044_thumb.jpg

Link to comment
Share on other sites

That's actually a pretty clever method to get simple gapless looping playback if you don't mind splitting the song into two sections. I normally just set the position backwards after reaching a certain amount to loop only a certain section using a single song file, and ignore the tiny stutter as the buffer quickly loads the new position. I may keep this technique in mind though!

Link to comment
Share on other sites

I think it'd be much easier to check how close you are from the end of the file (using size of the mp3 in bytes and checking current location)... when you hit a few bytes before the end, jump to byte 0

That should eliminate the jump. No extra shit needed. Try it out, someone.

I'm a little late, but I don't think most of these game making programs have a feature that allows them to jump by address. But yeah, thats a fine way to do it if you can.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...