Multitrack Love

Hi, I made this multitrack player of some famous songs so that you can re-discover them by muting some tracks :slight_smile:

I originally made it few years ago in Flash, and as I learn Phaser I tried to do this as a challenge

https://zanorg.net/multitrack/

I made it with Phaser 3, on mobile it can crash the browser after playing many songs, I don’t know why… I clean the cache etc, any idea is good to take !

2 Likes

Cool! I liked it!

What do you mean you clean the caches? How do you do that?

Do you properly dispose any instances of media player related objects like media streams, media stream tracks, media player, audio nodes etc. in case you use them?

Thank you !

For the loading of the mp3 I use :

let mp3Load = homeScene.load.audio("drums_mp3", 'drums.mp3');

For each track (voice, guitar etc, each time the same key name - I supposed it replace the old one- )
And then when you load a new song, I “clear the cache” like this :

homeScene.load.reset(); 

//TAB_INSTR is an array containing the sound objects
TAB_INSTR.forEach((item, index) => {
    item.destroy();
    item = null;
});

homeScene.cache.audio.entries.each(function (snd) {        
    snd = null;
}, homeScene);

homeScene.cache.audio.entries.clear();

Getting into what does these Phaser functions do under the hood can give you ideas about what you should do about resource usage economy. Maybe you need to use another function, tweak some or implement a little custom functionality. Again I would suggest you look more for Web Audio and gotchas to use it efficiently.

2 Likes