Waterfall config example #36
Answered
by
cifkao
zhuzixu900818
asked this question in
Q&A
-
I'm an absolute Javascript newbie. Not sure where to put config code. I'm using the below script in a WordPress Custom HTML Code block <script src="https://cdn.jsdelivr.net/combine/npm/tone@14.7.58,npm/@magenta/music@1.23.1/es6/core.js,npm/focus-visible@5,npm/html-midi-player@1.4.0">
</script>
(midi-player src="https://cdn.jsdelivr.net/gh/cifkao/html-midi-player@2b12128/twinkle_twinkle.mid" visualizer="#myPianoRollVisualizer">
</midi-player)
(midi-visualizer type="waterfall" id="myPianoRollVisualizer">
<script>
visualizer.config = {showOnlyOctavesUsed:True};
</script>
</midi-visualizer) Thank you! |
Beta Was this translation helpful? Give feedback.
Answered by
cifkao
Dec 16, 2021
Replies: 1 comment 1 reply
-
In your script, you first need to get a reference to your visualizer, e.g.: This should work: <script src="https://cdn.jsdelivr.net/combine/npm/tone@14.7.58,npm/@magenta/music@1.23.1/es6/core.js,npm/focus-visible@5,npm/html-midi-player@1.4.0">
</script>
<midi-player src="https://cdn.jsdelivr.net/gh/cifkao/html-midi-player@2b12128/twinkle_twinkle.mid" visualizer="#myPianoRollVisualizer">
</midi-player>
<midi-visualizer type="waterfall" id="myPianoRollVisualizer">
</midi-visualizer>
<script>
const visualizer = document.getElementById("myPianoRollVisualizer");
visualizer.config = {showOnlyOctavesUsed: true};
</script> |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
zhuzixu900818
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In your script, you first need to get a reference to your visualizer, e.g.:
const visualizer = document.getElementById("myPianoRollVisualizer")
. Also, you should pay attention to<
vs.(
andtrue
vsTrue
.This should work: