Muses RadioPlayer Media Element

Rajavasanthan

New Member
I have a HTML5 Canvas Element in my page where some Animation will be generated according to the Audio played in Muses Radio Player.

Code:
window.addEventListener("load", initMp3Player, false);            
function initMp3Player() {
                document.getElementById('audio_box').appendChild(audio);
                context = new webkitAudioContext(); // AudioContext object instance
                analyser = context.createAnalyser(); // AnalyserNode method
                canvas = document.getElementById('analyser'); //analyser is the id of canvas
                ctx = canvas.getContext('2d');
                source = context.createMediaElementSource(" "); // I need to Pass the audio Element into createMediaElementSource from Muses radio Player.
                source.connect(analyser);
                analyser.connect(context.destination);
                frameLooper();
            }

function frameLooper() {
                window.webkitRequestAnimationFrame(frameLooper);
                fbc_array = new Uint8Array(analyser.frequencyBinCount);
                analyser.getByteFrequencyData(fbc_array);
                ctx.clearRect(0, 0, canvas.width, canvas.height); // Clear the canvas
                ctx.fillStyle = '#00CCFF'; // Color of the bars
                ctx.lineWidth = 5;
                ctx.strokeStyle = "white";
                bars = 500;
                for (var i = 0; i < bars; i++) {
                    bar_x = i * 3;
                    bar_width = 2;
                    bar_height = -(fbc_array[i] / 2);
                    //fillRect( x, y, width, height ) // Explanation of the parameters below
                    ctx.fillRect(bar_x, canvas.height, bar_width, bar_height);


                }
            }

I need to Pass the audio Element into createMediaElementSource from Muses radio Player. But i cant find any object in mrp.js. I tied "MRP" "muses" etc.. But nothing is working.

If anyone know the Audio element in Muses plz help me.
 
Interesting question and it sounds like a very interesting project. The best person to answer your question is fbricker who authored muses. Here's a link to his Github profile : https://github.com/fbricker

Please do let us know if you get it working.
 
Top