cuthbertLab / music21j

Javascript port of music21 -- Toolkit for Computational Musicology
Other
144 stars 41 forks source link

Hardcoded soundfont path prevents loading from CDN into `<script>` tag #115

Closed jacobtylerwalls closed 2 weeks ago

jacobtylerwalls commented 3 years ago

We should make it so that you can just get a CDN URL for this repo and plug it into a <script> tag and be able to use the project. Currently the hardcoded soundfont path prevents it (we should just disable playback rather than not load the project).

Matteo discovered a workaround, but the workaround doesn't work for just loading into a simple HTML page or trying to use JSFiddle as a sandbox.


As for the second issue, I managed to fix it in the following way. Is it the way it should be done, though?

import { common } from "music21j/releases/music21.debug"
common.urls.soundfontUrl = "./soundfonts/midi-js-soundfonts-master/FluidR3_GM/"

Thank you again

Originally posted by @mttbernardini in https://github.com/cuthbertLab/music21j/issues/58#issuecomment-639331946

mscuthbert commented 3 years ago

You used to be able to put the soundfont url as a data-* attribute in the script tag and music21j would use that instead. I haven't investigated if it still works though.

jacobtylerwalls commented 3 years ago

IMO this right here is worth documenting in the README. I'll get to it at some point.

<script>
    window.m21conf = { loadSoundfont: false };
</script>
mscuthbert commented 2 weeks ago

I think that this is now fixed in #261. Let me know if it's still a problem.