MIDI.Player.loadFile not working,
MIDI.noteOn and MIDI.noteOff are working, but in the same onsuccess function, the MIDI.Player.loadFile does nothing. I'm on Chrome 51.0
I am passing the file name of the midi file directly to loadFile. Is that correct?
MIDI.loadPlugin({ soundfontUrl: "soundfont/", instrument: "acoustic_grand_piano", onsuccess: function() { var delay = 0; // play one note every quarter second var note = 50; // the MIDI note var velocity = 127; // how hard the note hits // play the note MIDI.setVolume(0, 127); MIDI.noteOn(0, note, velocity, delay); MIDI.noteOff(0, note, delay + 0.75);
MIDI.Player.loadFile("mysong.mid");
MIDI.Player.start();
}
loadFile doesn't block. You are probably calling start() too soon.
Is this correct?
function callback(){ MIDI.Player.start(); }
MIDI.Player.loadFile("mysong.mid",callback);
On Mon, Jul 18, 2016 at 5:39 PM, hmoffatt [email protected] wrote:
loadFile doesn't block. You are probably calling start() too soon.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mudcube/MIDI.js/issues/186#issuecomment-233491115, or mute the thread https://github.com/notifications/unsubscribe-auth/ATk1PGXTXr3KebgLdAI_yf1eLddV7fdyks5qXA6jgaJpZM4JPPkW .
Yes, although you can just write
MIDI.Player.loadFile("mysong.mid",MIDI.Player.start);
Yes, but nothing happens. No errors either.
On Mon, Jul 18, 2016 at 10:36 PM, hmoffatt [email protected] wrote:
Yes, although you can just write
MIDI.Player.loadFile("mysong.mid",MIDI.Player.start);
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mudcube/MIDI.js/issues/186#issuecomment-233528077, or mute the thread https://github.com/notifications/unsubscribe-auth/ATk1PLFXSDW98jDsXoRaLKhFu5dnp6xSks5qXFRbgaJpZM4JPPkW .
Did you load the instruments needed by your MIDI file?
Like this? MIDI.loadPlugin({ soundfontUrl: "soundfont/", instrument: "acoustic_grand_piano", onsuccess: function() { var delay = 0; // play one note every quarter second var note = 50; // the MIDI note var velocity = 127; // how hard the note hits // play the note MIDI.setVolume(0, 127); //MIDI.noteOn(0, note, velocity, delay); //MIDI.noteOff(0, note, delay + 0.75); MIDI.Player.loadFile("mysong.mid",MIDI.Player.start); } });
On Tue, Jul 19, 2016 at 6:30 AM, hmoffatt [email protected] wrote:
Did you load the instruments needed by your MIDI file?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mudcube/MIDI.js/issues/186#issuecomment-233617119, or mute the thread https://github.com/notifications/unsubscribe-auth/ATk1PKCTV9PsdjCehZ2IkcrdEFdcFUWUks5qXMNigaJpZM4JPPkW .
Does your mysong.mid only need the grand piano? You have to load all the instruments that your file needs - MIDI.js won't fall back to other instruments for ones that are missing, it'll just play silence.
Does the MIDI.noteOn/noteOff produce sounds?
Yes on the noteOn and notteOff.
The midi files do not have an instrument change. I never coded for that.
On Tue, Jul 19, 2016 at 5:55 PM, hmoffatt [email protected] wrote:
Does your mysong.mid only need the grand piano? You have to load all the instruments that your file needs - MIDI.js won't fall back to other instruments for ones that are missing, it'll just play silence.
Does the MIDI.noteOn/noteOff produce sounds?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mudcube/MIDI.js/issues/186#issuecomment-233801141, or mute the thread https://github.com/notifications/unsubscribe-auth/ATk1PMDaARqY6-_pUF9NS8hfiaSwMMzWks5qXWPpgaJpZM4JPPkW .
On 20/07/16 10:34, gkfrog wrote:
Yes on the noteOn and notteOff.
The midi files do not have an instrument change. I never coded for that.
What channels do you use? MIDI.js actually defaults to channel 1 instrument 1, channel 2 instrument 2, etc. (in js/midi/GM.js).
I do have a program change I was using instrument 2. I changed my parameters for the program change to Instrument 1 and using Channel 1. Still no sound. $nChannel = 1; $nInstrument = 1;
On Tue, Jul 19, 2016 at 6:39 PM, hmoffatt [email protected] wrote:
On 20/07/16 10:34, gkfrog wrote:
Yes on the noteOn and notteOff.
The midi files do not have an instrument change. I never coded for that.
What channels do you use? MIDI.js actually defaults to channel 1 instrument 1, channel 2 instrument 2, etc. (in js/midi/GM.js).
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mudcube/MIDI.js/issues/186#issuecomment-233807479, or mute the thread https://github.com/notifications/unsubscribe-auth/ATk1PPRvlFYLhW5HYJB41heUY3QKY_hCks5qXW4tgaJpZM4JPPkW .
On 20/07/16 11:17, gkfrog wrote:
I do have a program change I was using instrument 2. I changed my parameters for the program change to Instrument 1 and using Channel 1. Still no sound. $nChannel = 1; $nInstrument = 1;
Not sure what the above code means. By the way when I say channel 1 and instrument 1, I really mean channel and instrument 0.
Anyway, I think you'll need to open the debugger to work this out. Assuming you're using the webaudio output, stick a breakpoint on noteOn in js/midi/plugin.webaudio.js and see what it's doing.
well 0 makes it work. The tempo is a bit slow, but I have notes!
Thanks for your great support.
Gary
On Tue, Jul 19, 2016 at 7:17 PM, Gary Harber [email protected] wrote:
I do have a program change I was using instrument 2. I changed my parameters for the program change to Instrument 1 and using Channel 1. Still no sound. $nChannel = 1; $nInstrument = 1;
On Tue, Jul 19, 2016 at 6:39 PM, hmoffatt [email protected] wrote:
On 20/07/16 10:34, gkfrog wrote:
Yes on the noteOn and notteOff.
The midi files do not have an instrument change. I never coded for that.
What channels do you use? MIDI.js actually defaults to channel 1 instrument 1, channel 2 instrument 2, etc. (in js/midi/GM.js).
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mudcube/MIDI.js/issues/186#issuecomment-233807479, or mute the thread https://github.com/notifications/unsubscribe-auth/ATk1PPRvlFYLhW5HYJB41heUY3QKY_hCks5qXW4tgaJpZM4JPPkW .
On 20/07/16 11:36, gkfrog wrote:
well 0 makes it work. The tempo is a bit slow, but I have notes!
The default example code overrides the tempo (dumb). Set MIDI.Player.BPM = 0 before loading your file.
I'm running into the same problem. Not sure I understood the solution though, could you paste a code example @gkfrog please? :-)
So in my case, the problem was that I did not properly import the inc/jasmid/*.js files
Cheers
what's with the first note missing?
On Wed, Jul 20, 2016 at 4:36 AM, Théo Crevon [email protected] wrote:
So in my case, the problem was that I did not properly import the inc/jasmid/*.js files Cheers
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mudcube/MIDI.js/issues/186#issuecomment-233913824, or mute the thread https://github.com/notifications/unsubscribe-auth/ATk1POE0l7M6zTaMHS48Tnkq84SIWLloks5qXfobgaJpZM4JPPkW .
ok got it.
On Wed, Jul 20, 2016 at 10:17 AM, Gary Harber [email protected] wrote:
what's with the first note missing?
On Wed, Jul 20, 2016 at 4:36 AM, Théo Crevon [email protected] wrote:
So in my case, the problem was that I did not properly import the inc/jasmid/*.js files Cheers
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mudcube/MIDI.js/issues/186#issuecomment-233913824, or mute the thread https://github.com/notifications/unsubscribe-auth/ATk1POE0l7M6zTaMHS48Tnkq84SIWLloks5qXfobgaJpZM4JPPkW .
This is an exceptional program you've put together. Exactly what I needed! I am impressed.
Thanks.
Gary
On Wed, Jul 20, 2016 at 3:37 PM, Gary Harber [email protected] wrote:
ok got it.
On Wed, Jul 20, 2016 at 10:17 AM, Gary Harber [email protected] wrote:
what's with the first note missing?
On Wed, Jul 20, 2016 at 4:36 AM, Théo Crevon [email protected] wrote:
So in my case, the problem was that I did not properly import the inc/jasmid/*.js files Cheers
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mudcube/MIDI.js/issues/186#issuecomment-233913824, or mute the thread https://github.com/notifications/unsubscribe-auth/ATk1POE0l7M6zTaMHS48Tnkq84SIWLloks5qXfobgaJpZM4JPPkW .