First note starting on "currentTime+1" : it fails #75
-
Hi, const context = new AudioContext() If I don't create the dummy "C0", then "A4" will not be heard. Thanks and regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This works for me: <html>
<body>
<button id="btn">play</button>
</body>
<script type="module">
import { SplendidGrandPiano } from "https://unpkg.com/smplr/dist/index.mjs";
const context = new AudioContext();
const piano = new SplendidGrandPiano(context);
document.getElementById("btn").onclick = () => {
context.resume(); // enable audio context after a user interaction
const now = context.currentTime
piano.start({ note: 60, velocity: 80, time: now + 1 }); // play the note after 1 second
};
</script>
</html> So I guess the problem is that you didn't resume the audio context first. |
Beta Was this translation helpful? Give feedback.
This works for me:
So I guess the problem is that you didn't resume the audio context first.