Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #35703

Re: What happened to the web midi api?

Newsgroups comp.lang.javascript
Date 2018-09-26 13:55 -0700
References <85247887-9afe-415e-bf34-58873a916a8e@googlegroups.com> <f6929b8d-ccb5-4e9a-b2f9-53ff8f8d04c3@googlegroups.com> <2ca2fbcc-8f70-4920-9527-5a6c2255495b@googlegroups.com> <pofnbh$1m6$1@softins.softins.co.uk> <1ba7d3f1-f4d6-4684-9260-f0ee69c7c552@googlegroups.com>
Message-ID <204fce2f-cdad-485f-a92e-d36ca2af132a@googlegroups.com> (permalink)
Subject Re: What happened to the web midi api?
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


Den onsdag 26 september 2018 kl. 13:27:39 UTC+2 skrev Jonas Thörnvall:
> Den onsdag 26 september 2018 kl. 12:35:03 UTC+2 skrev Tony Mountifield:
> > In article <2ca2fbcc-8f70-4920-9527-5a6c2255495b@googlegroups.com>,
> > Jonas Thörnvall  <jonas.thornvall@gmail.com> wrote:
> > > 
> > > Here i build message and send to change midichannel
> > > 
> > > function sendMidiChannel(){
> > >     //Set midichannel on the track
> > >     channelC=document.getElementById("out_channel").selectedIndex+1;
> > >     if (channelC==1) {NOTE_ON=0x90; NOTE_OFF=0x80;}
> > >     else if (channelC==2) {NOTE_ON=0x91; NOTE_OFF=0x81;}
> > >     else if (channelC==3) {NOTE_ON=0x92;NOTE_OFF=0x82;}
> > >     else if (channelC==4) {NOTE_ON=0x93;NOTE_OFF=0x83;}
> > >     else if (channelC==5) {NOTE_ON=0x94;NOTE_OFF=0x84;}
> > >     else if (channelC==6) {NOTE_ON=0x95;NOTE_OFF=0x85;}
> > >     else if (channelC==7) {NOTE_ON=0x96;NOTE_OFF=0x86;}
> > >     else if (channelC==8) {NOTE_ON=0x97;NOTE_OFF=0x87;}
> > >     else if (channelC==9) {NOTE_ON=0x98;NOTE_OFF=0x88;}
> > >     else if (channelC==10) {NOTE_ON=0x99;NOTE_OFF=0x89;}
> > >     else if (channelC==11) {NOTE_ON=0xA0;NOTE_OFF=0x8A;}
> > >     else if (channelC==12) {NOTE_ON=0xA1;NOTE_OFF=0x8B;}
> > >     else if (channelC==13) {NOTE_ON=0xA2;NOTE_OFF=0x8C;}
> > >     else if (channelC==14) {NOTE_ON=0xA3;NOTE_OFF=0x8D;}
> > >     else if (channelC==15) {NOTE_ON=0xA4;NOTE_OFF=0x8E;}
> > >     else if (channelC==16) {NOTE_ON=0xA5;NOTE_OFF=0x8F;}
> > > }
> > 
> > Hi Jonas, it looks like you have the NOTE_ON values wrong for channels 11-16.
> > 
> > But you can do it more efficiently like this, instead of all those ifs:
> > 
> > function sendMidiChannel(){
> >     //Set midichannel on the track
> >     var channelC=document.getElementById("out_channel").selectedIndex; // don't need +1 here
> >     if (channelC >= 0 && channelC < 16) {
> >         NOTE_ON = 0x90 + channelC;
> >         NOTE_OFF = 0x80 + channelC;
> >     }
> > }
> > 
> > Cheers
> > Tony
> > -- 
> > Tony Mountifield
> > Work: tony@softins.co.uk - http://www.softins.co.uk
> > Play: tony@mountifield.org - http://tony.mountifield.org
> 
> Yeah lol i did hexdec conversion i can see, i was att 100 LoL
> Thanks for the code will swap immediately, much better and easier to read.
> 
> Cheers 
> Jonas

This is the webbased SF2 "GM synth" i decided to use for my sequenser project i figured out howto send notes vel on/off to it from my script, but i am pretty clueless howto change midichannel and program from my script. Well i see the functions, but i just can't interface the midichannel and program messages correct.

https://logue.github.io/smfplayer.js/wml2.html

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

What happened to the web midi api? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-11 08:56 -0700
  Re: What happened to the web midi api? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-11 10:26 -0700
  Re: What happened to the web midi api? moltenvoltage@gmail.com - 2018-09-26 01:39 -0700
    Re: What happened to the web midi api? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 02:18 -0700
      Re: What happened to the web midi api? tony@mountifield.org (Tony Mountifield) - 2018-09-26 10:34 +0000
        Re: What happened to the web midi api? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 04:27 -0700
          Re: What happened to the web midi api? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 13:55 -0700
            Re: What happened to the web midi api? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 14:23 -0700
              Re: What happened to the web midi api? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 14:56 -0700
                Re: What happened to the web midi api? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 15:06 -0700
    Re: What happened to the web midi api? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 03:22 -0700

csiph-web