Can C2 be used for blending two music tracks?

Discussion and feedback on Construct 2

Post » Wed May 22, 2013 5:20 pm

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
B
17
S
4
G
4
Posts: 143
Reputation: 4,004

Post » Thu May 23, 2013 2:53 pm

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 www.eli0s.com/Tests/musicExample.capx (use Construct 2 r131 or above).

I hope that helps!       eli0s2013-05-27 06:46:18
composer - multimedia artist
www.eli0s.com/en/
B
53
S
21
G
3
Posts: 1,127
Reputation: 8,095

Post » Thu May 23, 2013 3:10 pm

Most platforms should support two musics playing simultaneously. Did you try it?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Wed May 13, 2015 7:01 am

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!
Working on creating MYTHS, a 2D sidescroller adventure game - check more at :
nativepixels.com
Image
B
12
S
2
G
1
Posts: 7
Reputation: 1,081

Post » Fri May 15, 2015 8:07 pm

I read somewhere that looping works better if you move your music into Sounds instead of Music, let me know if that helps!
B
17
S
4
G
4
Posts: 143
Reputation: 4,004

Post » Sat May 16, 2015 1:16 am

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.

viewtopic.php?f=146&t=98383

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... ;)
B
53
S
13
G
7
Posts: 929
Reputation: 8,455

Post » Sat May 16, 2015 1:20 am

@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...
B
53
S
13
G
7
Posts: 929
Reputation: 8,455

Post » Sun May 17, 2015 11:44 am

@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.
composer - multimedia artist
www.eli0s.com/en/
B
53
S
21
G
3
Posts: 1,127
Reputation: 8,095


Return to Construct 2 General

Who is online

Users browsing this forum: 99Instances2Go, Aphrodite, Eisenhans, R0J0hound and 13 guests