Use wp_localize_script
.
function pr_add_link_sound () {
//Register the script first
wp_register_script('add_sound', plugins_url( 'add_sound.js', __FILE__ ), array('jquery'), '', true);
//Localize the sound file url to use in the script
$args = array(
'sound1' => plugins_url( 'sound.mp3', __FILE__ ),
);
wp_localize_script( 'add_sound', 'PRSound', $args );
//Enqueue the script
wp_enqueue_script('add_sound');
}
You can reference the sound in the js file like this..
(function($){
var sound = new Audio( PRSound.sound1 );
$('a').on('click', function(){
sound.play();
});
})(jQuery);