alemangui / pizzicato

Library to simplify the way you create and manipulate sounds with the Web Audio API.
https://alemangui.github.io/pizzicato/
MIT License
1.66k stars 130 forks source link

Unable to play sounds one after the other #152

Open Benoit1980 opened 3 years ago

Benoit1980 commented 3 years ago

Hello,

I need to be able to play tiny wav files one after the other(with BPM sync). At the moment I coded;

            var sound = [];
            this.samples.forEach((item, i) => {
                sound[i] = new Pizzicato.Sound({
                    source: 'file',
                    options: { path: item.sampleUrl }
                }, () => {
                    sound[i].play();
                });
            })

My first problem is that all the files are playing like on a sprite(all at once). How to have them playing sequentially and only once please?

It looks like the library does not have a BPM function, am I correct? ie: Play the give files on a beat at 125BPM,135BPM and so on.

Thank you for the great library!

1hko commented 1 year ago

Maybe you could consider Pizzicato.Group?