preload sound

Hi! p5 newbie here :)

I want to preload a sound and saw the 'whileLoading' of loadSound should give back 0.0 -> 1.0. But I get these weird numbers:

-4.8889637041629666

1.3532595612921987

1.9429898614028887

2.2925347571405443

this is my code:

function preload(){
    sound = new p5.SoundFile('priest.mp3',
        init,
        onError,
        musicLoading
    );
}

function musicLoading(perc) {
    console.log(perc);

    var loader = document.querySelector('.loader'),
        bar = document.querySelector('.loading-bar'),
        perc = perc * 100;

}

not too exciting right? My goal is to use the perc variable to increase the width of 'bar' with inline styles

Sign In or Register to comment.