<font face="Arial, Helvetica, sans-serif"><font size="6">Try it out!
Adaptive Music in Construct 2</font>
<font size="4">Sample CAPX</font>
Here's an example for how to implement adaptive/interactive music in C2. I use the word adaptive instead of interactive, because I tend to think of interactive music to be something more generated on-the-fly. Adaptive music is what is more commonly done to seamlessly transition between multiple versions of a sound piece.
I have 3 themes in this demo (A, B, and C) and moving the ball to each of them will trigger a different version of the track that is currently playing. There is also a "Bigger" button that switches each of those out for a more intense version of each. You could even go one step further and incorporate C2's audio effects into the mix for some really neat results.
As-is, it works the same on every platform that I've tested it on (Chrome, Firefox, and IPad 2 Safari), and should do the same elsewhere. There is a workaround in place for the looping since looping audio isn't identical in each browser. Even with looping on, I sometimes get a gap even in Chrome (but not every playthrough). The method I've used isn't perfect time-wise, but works everywhere. You could also write your music pieces so the end of the audio hangs over/bleeds over into the start of the next iteration (I do it in Courier), but I wanted things to be clear and concise for this demo.
I also admit to throwing the actual music together pretty quickly just to have it working. <img src="smileys/smiley17.gif" border="0" align="middle">
The controls are simply Touch, Mouse, WASD, or Arrow Keys. Let me know what you think!
<font size="6">Try it out!</font>
</font>