Can C2 be used for blending two music tracks?

0 favourites
  • 8 posts
From the Asset Store
Weather Wind Sounds - Mountains contains 10 tracks (3 tracks and 7 seamless loops)
  • The old Variable mix thing, where the boss's theme gets louder as he wins, and the hero's theme gets louder as you win. Can you play two Music files at the same time? (The manual references multiple sounds, but I don't believe it mentioned multiple music files). If it is possible, will starting both Plays at the same time cause them to start at the exact same time? (So that, if they're the same tempo, they'll stay in time with each other?)

    Thanks

  • Hi, perhaps I am not qualified to answer you, I am new to construct.

    The software is capable of playing simultaneously many sound files (I am guessing the limit has to be set bu the hardware), and it doesn't matter if they are contained in the sound or music folder. The difference is that the audio files that are referenced as "music" are being streamed while the game is running, while the ones that are in "sound" will be downloaded the first time they will be triggered and there will be a delay until you listen them.

    That being said, I tried to make an example where two looping sounds should play in sync and that doesn't happen. I made the loops my self and I know that they are correct. Perhaps something is being messed up upon the conversion into ogg/m4a format, I don't know.

    Never the less, a crude but effective way to achieve what you want is to use two instance variables (one for each object, player-enemy) that are linked with the volume of the corresponding music track. Every time an object is being hit, it receives some x value of damage, a value that can be translated to a degree of db subtraction.

    I know that I haven't described very well, so I made an example capx, you can download it here eli0s.com/Tests/musicExample.capx (use Construct 2 r131 or above).

    I hope that helps!

  • Most platforms should support two musics playing simultaneously. Did you try it?

  • well, I know this is old, but I spent the last two days trying to accomplish this. Here is my experience so far:

    The idea is simple, at some point, past a certain Y coordinate over the layout, the initial track fades out, then the second one fades in, being louder as you go further down the layout.

    I tried the following things:

    • a combination of play/stop and pause resume, if "Tag" playing/not playing, as well as play/stop only sequentially. With the official Audio plugin only.
    • same thing using the similar from the RexRainbow plugin (Audio Helper), which is dependent from the official Audio plugin.
    • Same thing, this time using a mix of Rex's plugin and of the official one.
    • All the above, but with preloading the sound/music and making sure preloads were complete.

    All worked. Then it stopped working on a relaunch , without me changing anything in the code. The second is triggered and plays, from what I noticed, when I just changed the code. If I restart it, it stops working consistently, I even end up with the song starting a few minutes after it should have. Again, I do not change anything in the code after it works, restart the project and stops.

    I should probably mention that I use NW.js and tried it on chrome, same results on both. I also that I got my first NW.js error while quitting the game, and this after I started tying to play two music tracks at once.

    I am very curious about what could be the reason behind the inconsistency of having two tracks playing at once. If you have any experience with mixing tracks together in Construct 2, your help would be very appreciated , thanks!

  • I read somewhere that looping works better if you move your music into Sounds instead of Music, let me know if that helps!

  • I haven't tested it in a while.. but it's a Chrome/FireFox/IE/Safari problem..

    and the last I checked it did NOT work... the audio will eventually go out of sync - always at the loop point.. if you are not looping, then you should be okay... for my tests the music was in sync for the first couple loop iterations..then it got messed. C-7 came up with a way to sync the music by lining up the playback point.. but you need to do it when the music's volume is down otherwise you hear it skip..

    I submitted bug reports to the Browsers but I never heard back.

    My guess is it is a limitation of the built-in sound engine. Otherwise companies like fmod/wwise etc would kind of be in trouble...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • eli0s I spent a good week last year testing this like crazy... as you can see in my link above... I also have a capx in there you can download to see where the loops go out of sync with each other.

    it just almost works! so close...

  • jobel , yes I've seen your other topic. Your examples are very solid and depict the problem perfectly.

    Unfortunately, in my opinion, C2 + HTML5 technology as is now, are not capable to handle audio in a synched manner. There is no practical way to guaranty audio synchronization/looping in any or all delivery options.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)