g200kg / webaudio-tinysynth

Light-weight GM mapped WebAudio-JavaScript Synthesizer Engine / MIDI Player
Apache License 2.0
229 stars 22 forks source link

Which MIDI message is that? #17

Closed jazz-soft closed 3 years ago

jazz-soft commented 3 years ago

It's not an issue, just a question... There is a piece of code in the end of the send() function:

        if(msg[1]==0x41&&msg[2]==0x10&&msg[3]==0x42&&msg[4]==0x12&&msg[5]==0x40){
          if((msg[6]&0xf0)==0x10&&msg[7]==0x15){
            var ch=[9,0,1,2,3,4,5,6,7,8,10,11,12,13,14,15][msg[6]&0xf];
            this.rhythm[ch]=msg[8];
          }
        }

Which MIDI message does it refer to? - I could not find one in the specs.

g200kg commented 3 years ago

It is a Roland GS (e.g. SC-88Pro) SysEx, 'USE FOR RHYTHM PART' command.

By default, only CH10 is the rhythm track, but this is the command to use other channels as the rhythm track. There are many old MIDI data that used this command (at least in Japan), I supported it because it has a greater impact on the output than other SysEx commands.

http://cdn.roland.com/assets/media/pdf/SC-88PRO_OM.pdf

jazz-soft commented 3 years ago

Thank you! I guess it should also check the first byte for being 0xf0. I'm planning to add a couple more SysEx-es, will create a pull request shortly...

g200kg commented 3 years ago

Yes, this is after switch (first byte) {case 0xf0: ...}

jazz-soft commented 3 years ago

Not exactly: you switch cmd=msg[0]&~0xf; I'll take care of that in my next commit...

g200kg commented 3 years ago

Ah, I understand. I made a mistake.

Thank you.

jazz-soft commented 3 years ago

I have submitted a new pull request: https://github.com/g200kg/webaudio-tinysynth/pull/18 Thanks!