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

Confirm file loadd #142

Closed kyoukhana closed 3 years ago

kyoukhana commented 3 years ago

I know how to do a group but how can i show the percent loaded when adding files to the group to confirm the file is loaded then I can play the group

var drums = new Pz.Sound('./audio/drums.mp3');
var guitar = new Pz.Sound('./audio/guitar.mp3');
var bass = new Pz.Sound('./audio/bass.mp3');

var group = new Pizzicato.Group([drums, guitar]);

group.addSound(bass);
group.addEffect(reverb);
group.play();           
kyoukhana commented 3 years ago

So I got it working but loop doesn't seem to work

var group = new Pizzicato.Group();

            var track1 = new Pizzicato.Sound({
                source: 'file',
                loop: 1,
                options: { path: '/api/user/track/audio/9?token='+this.$auth.token() }
            }, function() {
                group.addSound(track1);
            });

            var track2 = new Pizzicato.Sound({
                source: 'file',
                options: { path: '/api/user/track/audio/1?token='+this.$auth.token() }
            }, function() {
                group.addSound(track2);
                group.play();
            });
kyoukhana commented 3 years ago

I got the loop working now

 options: { path: '/api/user/track/audio/9?token='+this.$auth.token(), loop: true }