Open jtrunick opened 5 years ago
Yes, this would work, I think, if you are able to choose a soundfont that represents the ring tone sound you're looking for.
I'm afraid I have no plans whatsoever to update any of my Elm code to 0.19. Unfortunately, I came up against a set of insurmountable barriers in Elm and I chose instead to rewrite everything in PureScript.
Curious what your barriers were, but more important how do you get a .js file from a soundfont file?
I'm not sure exactly what you mean. The soundfont files are themselves .js files - see for example https://raw.githubusercontent.com/gleitz/midi-js-soundfonts/gh-pages/FluidR3_GM/acoustic_grand_piano-mp3.js. But what they really consist of is base64 encoded MP3 or OGG data expressed as JSON.
So what the module does is to decode this data and reconstitute images of the sound files which can then be played through web-audio. Under the covers it uses danigb's JS soundfont player to do all the heavy lifting.
Oh I see. I had found a .sf2 file that definitely isn't .js format. Are soundfonts strictly needed to play midi files? Possibly for my purposes I don't care exactly on the exact sound. I could likely still use your code to convert from Elm -> js midi format.
Well, MIDI is just a definition of a bunch of notes and in order to 'play' MIDI, you need to use some sort of synth to produce actual sounds. Soundfonts are just one option. You could, for example, synthesize the sounds yourself using web-audio oscillators and filters and so on.
You could, if you wanted, use a library like elm-comidi to generate MIDI, but by itself, it won't play anything.
I'm thinking of converting RTTTL (ring tone) to midi, and then when playing midi reflect current note in RTTTL. It looks like this code could work if i understand the translation.
Any plan to update to Elm .19?