Assunto che così invece, riscontri che ti funziona:
codice:
<body>
    <script type="text/javascript">
        document.write('<embed src="' + playmp3() + '" volume="30%" hidden="false" autostart="true"  height="50" width="150" loop ="true" />');
                 alert('<embed src="' + playmp3() + '" volume="30%" hidden="false" autostart="true"  height="50" width="150" loop ="true" />');
    </script>
    
</body>
in luogo dell' impiego del document.write arriverei ad inviare la stringa dell' EMBED come .innerHTML ad un DIV o una TD o etc. .

Fate attenzione che cambiare il Valore a SRC come si fa con l' Elemento IMG per le slide-show, con l' EMBED Element invece non è cosa che funzioni ...