1
I am developing an application that involves music and, to facilitate development, I am using the API Retrojs. However, I am unable to use it. The following errors appear in the Console:
<html>
<head>
<script src="src/Chord.js"></script>
<script src="src/Controls.js"></script>
<script src="src/Events.js"></script>
<script src="src/Instrument.js"></script>
<script src="src/Note.js"></script>
<script src="src/Player.js"></script>
<script src="src/Song.js"></script>
<script src="src/Track.js"></script>
<script src="src/instruments/Oscillator.js"></script>
<script src="vendor/modernizr.js"></script>
<script src="vendor/module.js"></script>
<script src="vendor/namespace.js"></script>
<script src="vendor/sushi/extend.js"></script>
<script>
function play(){
let player = new Player();
var minhaSingelaCancao = JSON.stringify({
title : "mi-mi-re-do",
tempo : 60,
time_signature : "4/4",
score : [{
instrument : "oscillator-sine",
volume : 1.0,
sheet : "EEDCCDEFGGFEEDD".split('')
}]
});
player.load(minhaSingelaCancao);
}
</script>
</head>
<body>
<button onclick="play()">Play</button>
</body>
</html>
All errors are gone, except this one: "Uncaught Referenceerror: Player is not defined at play (index.html:19) at Htmlbuttonelement.onclick (index.html:37)"
– user75204
Utilize
new Retro.Player();
instead ofnew Player();
– Valdeir Psr
index.html:19 Uncaught Referenceerror: Retro is not defined at play (index.html:19) at Htmlbuttonelement.onclick (index.html:37)
– user75204
I edited my reply. I added some information + a demo.
– Valdeir Psr