Search Unity

An idea, music track embellishment upon powerups!

Discussion in 'General Discussion' started by San_Holo, Nov 27, 2014.

  1. San_Holo

    San_Holo

    Joined:
    Sep 26, 2014
    Posts:
    152
    Hi, easily done really... but the idea is, on my 2D shooter game as you get power-ups the music changes or builds into a nice little trace or Techno track which starts off obviously quite minimalistic at first then comes the hit-hats, bass lead, more drums etc etc... it's been done before I know, but how would you keep it all in time? hmm, I may try it...
     
    GarBenjamin likes this.
  2. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    You keep it in time by synthesizing it in real time (MIDI or whatnot) and turning on and off each instrument as you go. It's unfortunately not as nice with more modern approaches, where you need to play multiple audio files over each other or similar...
     
    Tomnnn likes this.
  3. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    Just use one loop for each level and change the music when the loop ends.
     
  4. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
  5. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Having all of the tracks playing at 0 volume or having the songs meant to play in sync and then enabling them with a starting time of the other currently playing songs is a good way to go for prerecorded stuff if MIDI isn't an option.
     
  6. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    The zero-volume solution means the CPU is constantly decoding a bunch of songs, though. And either way, you can run into synch issues.
     
  7. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Wouldn't that be the case for really good players who unlock all of the tracks anyway? I think I'd rather have consistently strained CPU than having it get worse as the player does better xP
     
  8. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Sure, but I'd rather deal with just the synch issues than synch issues and increased CPU load. Though of course that might not be an issue either, depending on the number of layers and available CPU horsepower.
     
  9. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    We have a feature to keep layered music synchronized in our Master Audio plugin (link below in my signature). You don't even have to keep the other layers playing silently (you can though). Every time you start a new layer it will align to the other audible layers. And there are "no coding" scripts to make this happen when you enter a trigger or dozens of other events.

    I think you'd be better off not using streaming or mp3's with layered music as stated above. Too much drain on the CPU!. Better to have shorter sections that can play in order perhaps and take less memory? They could be wav's.

    Hope that helps!
     
  10. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Whats the hit like with layering uncompressed formats? My understanding is that the main hit comes from the decompression. If you're layering loops it's quite possible that the loops themselves aren't that long.
     
  11. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yeah loops would be good. If it's long tracks uncompressed & layered, that could take a lot of memory (not good for mobile).