JavaScript reproduce audio de buffer

function playAudio(buffer) {
    var source = context.createBufferSource();
    source.buffer = buffer;
    source.connect(context.destination);
    source.start(0);
    }

    // Load and decode audio file
    function loadSound(url) {
    var request = new XMLHttpRequest();
    request.open('GET', url, true);
    request.responseType = 'arraybuffer';
    request.onload = function() {
        context.decodeAudioData(request.response, function(buffer) {
            playAudio(buffer);
        });
    }
    request.send();
    }

    // Next button
    $("#next").click(function(){
        var next = $("#next").attr("data-next");
        if(next != ""){
            loadSound(next);
        }
    
    });

    // Previous button
    $("#previous").click(function(){
        var previous = $("#previous").attr("data-previous");
        if(previous != ""){
            loadSound(previous);
        }
    
    }
    );

    // Play button
    $("#play").click(function(){
        var play = $("#play").attr("data-play");
        if(play != ""){
            loadSound(play);
        }
    
    }

    // Pause button
    $("#pause").click(function(){
        var pause = $("#pause").attr("data-pause");
        if(pause != ""){
            loadSound(pause);
        }
    
    }

    // Stop button
    $("#stop").click(function(){
        var stop = $("#stop").attr("data-stop");
        if(stop != ""){
            loadSound(stop);
        }
    
    }
    
    // Volume up button
    $("#volume-up").click(function(){
        var volumeUp = $("#volume-up").attr("data-volume-up");
        if(volumeUp != ""){
            loadSound(volumeUp);
        }
    
    }

    // Volume down button
    $("#volume-down").click(function(){
        var volumeDown = $("#volume-down").attr("data-volume-down");
        if(volumeDown != ""){
            loadSound(volumeDown);
        }
    
    }

    // Volume mute button
    $("#volume-mute").click(function(){
        var volumeMute = $("#volume-mute").attr("data-volume-mute");
        if(volumeMute != ""){
            loadSound(volumeMute);
        }
    
    }

    // Volume unmute button
    $("#volume-unmute").click(function(){
        var volumeUnmute = $("#volume-unmute").attr("data-volume-unmute");
        if(volumeUnmute != ""){
            loadSound(volumeUnmute);
        }
    
    }

    // Themes button
    $("#themes").click(function(){
        var themes = $("#themes").attr("data-themes");
        if(themes != ""){
            loadSound(themes);
        }
    
    }
Old-fashioned Otter