This has been such an integral part of Sonic games that I think it deserves its own discussion/thread as to how different projects have tackled the issue. I think this will be a really handy resource and food-for-thought when tackling the music side of your fangame engine. THE TYPES: 1) Powerup song - Cut level BGM, play a specific speed shoes BGM, then cut back to the level BGM at the end of the powerup. It's optional if you play the BGM from the start again (stop, play), or resume where it left off (mute, unmute) Sonic Adventure does this. Very easy to implement 2) Level-specific Powerup song - Cut level BGM, play a specific speedshoes version of the level's BGM that has been rendered at a higher tempo (typically 1.25x) that starts from the beginning and lasts 20 secs or however long the powerup is. At the 20 second mark, just as the powerup fades, you start the level BGM from the 25s mark (or in other words, 20 x 1.25, which due to the maths will 'segue' at the exact spot) Sonic Generations does this. Also very easy to implement, a little more responsibility on the people who is procuring your music for you. 3) Speed up the music, easy version - Your music engine just plays the music at a 1.25 rate for however long the powerup lasts. Very easy to do, results are often 'musical' enough as it feels like a major 3rd up modulation for the duration of the powerup. Easy to implement, doesn't require anything extra from music guys 4) Speed up the music, hard version - You procure two versions of each level track - normal and sped-up (1.25x), both with the audio clip starting directly on bar:beat:division 1:1:00. Upon grabbing a speedshoes powerup, the default BGM plays to the next beat in the music, and then transitions to the exact same relative grid in the speedshoes version. The reverse happens as the powerup wears off. In terms of mathematics, the easiest way to accomplish this would be to supply your music engine with the BPM of each level track. Upon grabbing a powerup, you want the music to stop at the next beat, meaning first you need to identify that beat: <current time in music, in seconds>*bpm/60 will tell you this. You then round up the number to get the next beat, and do <current beat in music>*60/bpm to get the exact time you want the music to stop. Next, you want the speedshoes version of the music to start on that same beat. Essentially again you first get the absolute time value via <current beat in music>*60/bpm, then start the new track from there. Since BPM in this case is higher (typically 1.25) the math works out and you get a seamless transition. The opposite takes place when the powerup runs out - calculate absolute time of next beat, stop speedshoes version at that absolute time, calculate corresponding absolute time of the normal version at that beat, start playback from there. For music that has a changing tempo for whatever reason, if you're really OCD you could supply the music engine with two arrays that provide a complete list of absolute times that correspond to beats for both versions, or simply say screw changing on the beat, and simply note absolute time of current normal track, stop current normal track and start speedshoes version at <absolute time * 0.8> I'll try to procure both example audio clips and for 4) example code that does what I'm talking about. Hilariously enough, this is the one thing that Wwise cannot do as it can't segue based on beats (the most you can do is transition from one clip to another maintaining the same absolute time which does not help in this case)
You know I've given this very subject a lot of thought but it never crossed my mind to start a thread about it. So far my favorite method has been Sonic Generations (Type 2). They did specific up-tempo remixes of the music instead of just rendering out a higher tempo version or using a time stretch process. It made the speedup shoes worth getting just to hear the way the music changed. My least favorite, and by that I mean I dislike it, is Type 1, replacing the music with a jingle (as done in Sonic CD and Sonic Adventure). It made me want to avoid the speed shoes altogether since I hated the generic jingle and preferred listening to the level music. It really breaks the aesthetic flow of the game when that happens. I considered the invincibility jingle somewhat of an exception since it is more rare and modifies the gameplay a lot. In the Sonic fan game I'm working on though, I actually intend to have speedup AND invincibility variants of each level music, so apply Type 2 to both powerups.
5) Apply a high-pass filter. edit: I've been hoping to see number 4 for years, but I haven't so far. Also, and forgive me if I'm missing something obvious why this isn't possible, couldn't you also have the sped-up version play slowed down (at the same speed as the normal version) and then speed both songs up on switching to it? Then, when the speed wears off, you slow both songs down again and switch back to the normal one. It would keep them completely in-sync, and have roughly the same net effect.
Considering we have the software to brilliantly change the tempo, keep the pitch live without creating noticeable artifices for well over a decade, there should be no other alternative than to do it just like the original chiptune music. In fact it should only be used if new versions were created, if they're going to sound just like the originals then there's nothing stopping creating a virtual synth with more channels, stereo and better sample rate.
That might work, actually. The only reason I can think of that might throw a monkey wrench into the works is that when going from one track to another, it's inherently implied from an audio implementation perspective that you'd want to do a short crossfade (typically 10-20 samples) between the two rather than simply muting one and unmuting the other to avoid a pop, which requires both tracks to be playing at their 1x speed for that moment, or you'd get a short instance of things being the wrong pitch. Granted, 20 samples really isn't all that long of a period so it might just be completely unnoticable. edit: Thinking about it a little more it's just much more efficient from a resource overhead perspective to not have stuff that's muted playing, at all. As it is you'd basically be using the muted track pretty much to count the number of samples (multiplied by 1.25 or 0.8) which from a programming perspective is like "x++ <till> event" whereas you might as well do "wait till event <then> calculate once". It's not exactly accurate. The best equivalent I can think of would be 2xSAI/etc filters, which, while good, isn't going to hold up to OCD-level inspection. It definitely is an option, but if you're going to go for posterity, why not just go that extra mile? (There's a reason the speed-shoes tracks in Generations are entirely separate tracks, as an example of what I mean)
Yeah, adjusting the 'tempo' (I.e. speed without affecting pitch) of PCM is plagued with potential ill effects. Sure, they're much more obvious when the direction of the adjustment is downwards to a slower tempo, but I've yet to hear a method that can speed a waveform up to a faster tempo with precisely no audible artefacts either.
Keep in mind that the change in tempo is going one way and it's not the way that has noticeable artefacts. Also is 2xSAI some open source software because who says that it has to be that? Considering the remakes are official, there's nothing stopping from getting a licence from the masters of sample manipulation Celemony. For years they have had the ability to change polyphonic samples which most people thought was impossible and since 2000 have pretty much been the masters of live pitch modification.
You've never actually used Melodyne or anything else that manipulates pitch and/or tempo on complex material, have you? Practically every single manipulation package worth its transparent salt has separate algorithms for different types of materials (pitched vs percussive vs polyphonic) because they behave differently. They're intended to be used on simpler material. Melodyne is great for things like a choir, or an acoustic guitar. Give it something a little more eclectic, like a tracked distortion guitar track (which, at its base, mind you, is summation of the sounds produced by each string and THEN clipped as a whole) and the results are not nearly as believable. Using it on finished tracks always results in less optimal results. This doesn't even tread yet into the territory of what constitutes a commercially acceptable master. Before computers could transcribe music, I was one of the people who prophesied that it would. Before manipulation of polyphonic material via advanced DCT and frequency-based analysis I theorized that it was possible. I've been pretty much a pro-computing advocate in the realm of audio since forever and I use cutting edge manipulation tools from Celemony and iZotope, that seem like black magic from a pre-2000 perspective, almost on a weekly basis right now. Even then I'm going to have to say that at this point in time, the technology to properly digest a complex amalgamation of material (e.g. a complete track with percussion, pitched content, bells and whistles) is still years off. I hate to pull this card, but honestly, you really don't have a complete idea of what you're talking about. And yes, I do agree that what's 'acceptable', like I said in my earlier post, is somewhat subjective.
While I haven't used the likes of Melodyne (I mention Celemony because they're supposed to be the best in that field), I do used FL Granulator and did an experiment with Propellerheads record testing for acceptable time stretching for S2HD and put up the results. Providing drums are not heavy in a track that's mixed down you will not notice (subjective but honestly I think this is ear fatigue with most people who would just nit pick it) the difference. Go and download Sonic 1 SAGE 2010 and change the music files in Green Hill Zone, play act 2 and get the speed shoes to hear what it sounds like with different tracks. I have done this on numerous accounts with many different tracks so I wouldn't say I have no idea what I'm talking about, I would say that you need to go and test this yourself and find out if those results are acceptable to you.
I didn't say you had no idea what you're talking about. I specifically, meticulously said you don't have a complete idea what you're talking about.
But I don't need to have a complete idea, just enough to get the acceptable results. We have the adequate software to do it and providing the producer of the new tracks takes measures to remove undesirable artefacts when mixing/mastering new ones, they will appear flawless to the masses.
Speed-up - hard mode - wins, every time. As for "let the software do it for you".. ehh. Even with what S1SAGE2010 does, it isn't what it should be; instrument envelopes, effects, etc. (not to mention any artifacting that occurs from the process in the first place). But, as has been said, for fangames it's okay. For professional? Go with hard mode.