-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading all GM instruments for midi file #268
Comments
Commenting this line back in adds more instruments, but they play wrong parts. So there are probably other bugs. Possibly related: issue #226 I'm looking for the other bugs. Feel free to help. The events in the |
Maybe MIDI.js doesn't properly use the info contained in programChange events for selecting appropriate instruments from the SoundFont. |
In case you want to check whether someone fixed this in their fork of this repo, there are several ways to find repos that made changes: https://stackoverflow.com/questions/54868988/how-to-determine-which-forks-on-github-are-ahead |
If I understand issue #256 correctly: the branch called "abcjs" fixes this, but introduces other problems (playing one or two notes 3 or 4 seconds after resuming from a pause). So looking into the changes made in that branch might help. |
js/midi/player.js contains the sequencer (the code that plays the event queue). |
The newest branch of this repo (named "abcjs") plays all instruments of a MIDI file correctly, but plays several unexpected notes in the first few seconds instead of the first notes of the song (when playing the song for the first time). Fixing that seems more promising than fixing wrong instruments in older branches. The
(Maybe the remaining problem has something to do with |
During the problems, the values After a few seconds, they get updated, and the problems stop. They get updated at https://github.com/mudcube/MIDI.js/blob/abcjs/js/adaptors.js#L145-L151. Why is this code reached too late? In the MIDI file, programs/instruments get defined, and then the notes play. In MIDI.js, several notes attempt to play and only a few seconds later the A place in the code where you can see the wrong |
Replacing The following things are executed too late and in the wrong order:
Do these scheduled tasks trip over each other? What's weird is that there are no such problems anymore after clicking "stop" and "start" again.
|
|
As far as I know, Overall, So far, I couldn't find the cause of the differences in the Chrome Profiler etc. Maybe you can help. |
Maybe MIDIPlayerJS and SoundFont-Player are useful. As far as I know, that doesn't seem to be the problem. |
Oh, I forgot the link. The link is here: |
Maybe you can use midi.js and soundfont-player together. This will require some code modifications. I am also thinking about this issue. However, while making Kalimba-sheet-music-writer, I found out about the fatal flaw of MidiPlayerJS. So I think the combination of midi.js and soundfont-player will be more powerful. |
Welcome and thank you for the comments! :) Regarding |
hi @page200 how did you load your soundfounts in 'abc' branch? i followed: https://github.com/mudcube/MIDI.js/blob/abcjs/examples/Basic.html as follow: ` MIDI.setup({
using ionic + capacitor |
@acosme I followed https://github.com/mudcube/MIDI.js/blob/abcjs/examples/MIDIPlayer-v2.html as well. Before I look into the details of your question and code, may I ask what you are getting at: does your code solve the problems described here, or are you having other problems? |
I was coming to it, but i think my ionic+capacitor app has some issue that don't allow to load the soundfount correctly, in branch master all good, but not in 'abc'. Something change in abc about load in 'mobile', its why i ask you how did you just load, but i used the same example as well. |
I haven't tried 'mobile'. Thank you for mentioning the 'mobile' problem with the What do you think about https://github.com/surikov/webaudiofont as an alternative? There's a recent example for getting it to play in the background if needed (surikov/webaudiofont#92 (comment)) and I recently fixed its pitch-bend functionality (surikov/webaudiofont#95). |
Last time I tried it myself, the surikov repo had huge advantages in the "make stuff work" aspect, but it was very complicated to verify whether the apparent license grants would be legally effective in Europe. Doesn't help that some crucial license information is scattered in various places in the repo that contradict some of the machine-readable license statements. The reactions in closed license issue threads make it seem like he's a lot less concerned about licences than I have to be, and the home country stated in his GitHub profile gives a good idea why. Nonetheless it's a nice resource for learning and private use. Seeing how actual soundfonts work, helped me make my own converted sound font. Unfortunately, I still haven't found a good solution for hosting the result. The huge storage requirement (6 MB original becomes 124 MB converted) made me realize that we need a structurally better way to encode sound fonts. |
Which license statements would you like to be changed to what? In order to better understand, I also wonder how that influences your use case?
Are SoundFonts stored inefficiently by webaudiofont? And do you have any idea why? As far as I know, the original SoundFont files use lossless audio compression, so a 6 MB original wouldn't be much larger than 40 MB when decompressed. |
I don't know, because I have no idea what the real, legally effective license status currently would be. It might even vary by country.
I'm not sure about the format names here, but…
I know the major part of the conversion is to encode all instruments as a waveform, which destroys any potential cleverness of the original storage format. Then, in the next step, a modern audio codec is called to the rescue and tries to mitigate the disaster. But since it's a general-purpose audio codec, it cannot achieve the original level of cleverness that the synthesizer had available. |
I presume people know that MIDI.js is abandonware and whatever is decided from this thread is unlikely to be implemented. I have an actively developed fork at https://github.com/mscuthbert/midicube |
@mscuthbert How does midicube work in terms of what we're discussing here,
does it use compressed SoundFonts?
…On Wed, 16 Aug 2023 at 21:49, Michael Scott Asato Cuthbert < ***@***.***> wrote:
I presume people know that MIDI.js is abandonware and whatever is decided
from this thread is unlikely to be implemented. I have an actively
developed fork at https://github.com/mscuthbert/midicube
—
Reply to this email directly, view it on GitHub
<#268 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQQDXKMK3RHZS7LFZDNG43TXVUP4PANCNFSM6AAAAAARWQEIHU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Midicube uses the same soundfont in JS/base64 format as MIDI.js. If you want to load all instruments you'll need to iterate over all 255 sounds but I think that is a bad idea for user experience. My company www.artusimusic.com uses the Midicube fork and loads instruments as they are required for various assignments. |
@urobot2011 The discussion at danigb/soundfont-player#107 (comment) is locked, and it's more relevant here, so I'll reply here. There, I wrote:
I might have been wrong with my "probably" statement there. #256 (comment) and https://github.com/KomeijiSatori/3d-piano-player/blob/master/README.md imply that KomeijiSatori got a good solution by using code from Color Piano (redirected from http://mudcu.be/piano) instead of using branches from GitHub whose respective problems had been described at #256 (comment). I haven't checked whether all problems discussed in that comment and here above are indeed solved in https://github.com/KomeijiSatori/3d-piano-player/. I've inquired at #256 (comment) |
To sum up some of the discussions so far:
|
Hi, thanks for this library, it seems very useful :)
I'm looking for a GM soundfont player js lib that supports all GM instruments, so I'm wondering:
When loading a GM file, why aren't all the instruments that loaded that the file uses?
In other words, why is this line commented out?
MIDI.js/js/midi/player.js
Line 116 in a8a8425
The text was updated successfully, but these errors were encountered: