Trying to develop a playable 'music composer' but my audio is out of sync.
Hi Guys,
I'm working on building a musical composer whereby you see a musical stave (staff) with both clefs (treble & bass). What I have is musical beats (semibreves, crotchets, quavers etc) which you can drag and drop onto the musical stave.
From here, I then wrote a jQuery script to read all the notes that are placed on the stave, building like a playlist.
So from here. I pretty much have 2 playlists, 1 for treble clef and one for bass clef.
To play the audio, I'm playing the first file of each clef, then using an addEventListener for each clef to play the next file in the sequence.
My problem is that if I place more notes on one clef then the other, the clef with the lesser number of notes placed on it seems to load faster.
Is there a way that once I've built my "playlist" I can just say "Play These Files" instead of using the addEventListener, which i think is that is slowing it down.
At some stages in my audio playing, I may also need to play multiple audio files at the same time. (ie chords on a music sheet, more then 1 note in a single column. like hitting multiple keys on the piano at the same time).
For example I may have something like
var BassClef = 'audio11, audio21, audio1-audio2-audio45, audio15, audio14';
var TrebleClef = 'audio22, audio27, audio14-audio12-audio145, audio15, audio14';
I want to play audio11 & audio22 at the same time. then play audio21 & audio27, but then where I have multiple audio files seperated by a dash (-) I want to play them all at the same time before moving to the next group.
Wondering if you guys could give me any advice on how to process the playing of the audio.