I'm quite new to website development, so please forgive any noticeable naivety. So I want to build a simple website where viewers can click on text or graphic triggers to play short music loops that repeat indefinitely. It's part of a larger project, but this is the real tricky part.

The problem comes in, because I want the loops or "tracks" to combine as different triggers are clicked. Imagine an electronic music song, where each trigger can be one of its component parts (one button is the kick drum, another is the piano loop, another the bass, etc.)...and the website viewer can essentially assemble the song in real time, or disassemble it, as they see fit.

In order for this to happen without absolute trainwreck chaos, the loop needs to have some type of start-time quantization so it syncs up with all the other loops that might already be playing....if you know anything about how Ableton Live works, they call it "clip launch quantization." The basic idea is that when you hit the trigger for the loop to start playing back, it has a certain timed latency -- it waits to play until it's synchronized with a certain subdivision of the song's tempo (a 1/8 note, 1/4 note, full bar, etc.).

Hope that wasn't too confusing. But, in any case, if anyone had any insight on where I might want to start to program something like this, or even where to look to get more info, I'd be much obliged. I have Flash, but I don't know if that would best for something like this.

Many thanks in advance for any assistance!