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


Groups > comp.lang.javascript > #34445 > unrolled thread

Set midi channel "web MIDI API"

Started byJonas Thörnvall <jonas.thornvall@gmail.com>
First post2018-01-04 02:39 -0800
Last post2018-01-04 09:59 -0800
Articles 8 — 1 participant

Back to article view | Back to comp.lang.javascript


Contents

  Set midi channel "web MIDI API" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-04 02:39 -0800
    Re: Set midi channel "web MIDI API" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-04 02:42 -0800
    Re: Set midi channel "web MIDI API" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-04 03:21 -0800
      Re: Set midi channel "web MIDI API" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-04 03:27 -0800
        Re: Set midi channel "web MIDI API" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-04 04:14 -0800
          Re: Set midi channel "web MIDI API" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-04 08:38 -0800
            Re: Set midi channel "web MIDI API" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-04 09:51 -0800
              Re: Set midi channel "web MIDI API" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-04 09:59 -0800

#34445 — Set midi channel "web MIDI API"

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2018-01-04 02:39 -0800
SubjectSet midi channel "web MIDI API"
Message-ID<c090d6b1-a89f-4995-acd3-9040bc50670e@googlegroups.com>
I try to set midichannel the way i did set midiprogram, i get no complains but it does not change the midichannel on my module?

Is midichannel something that need to be sent with each note?

function changeMidiChannel(){
console.log("Change MIDI channel");
channelC=document.getElementById("out_channel").selectedIndex+1;
console.log("channel ",channelC);
if (channelC==1) {sysexC=0xC0}
else if (channelC==1) {sysexC=0xC0}
else if (channelC==2) {sysexC=0xC1}
else if (channelC==3) {sysexC=0xC2}
else if (channelC==4) {sysexC=0xC3}
else if (channelC==5) {sysexC=0xC4}
else if (channelC==6) {sysexC=0xC5}
else if (channelC==7) {sysexC=0xC6}
else if (channelC==8) {sysexC=0xC7}
else if (channelC==9) {sysexC=0xC8}
else if (channelC==10) {sysexC=0xC9}
else if (channelC==11) {sysexC=0xCA}
else if (channelC==12) {sysexC=0xCB}
else if (channelC==13) {sysexC=0xCC}
else if (channelC==14) {sysexC=0xCD}
else if (channelC==15) {sysexC=0xCE}
else if (channelC==15) {sysexC=0xCF}
else if (channelC==15) {sysexC=0xD0}
output = mid.outputs.get(outportindex);
console.log("Channel ",sysexC," program ",programC);
var programChange = [sysexC,programC];
output.send( programChange );
}

[toc] | [next] | [standalone]


#34446

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2018-01-04 02:42 -0800
Message-ID<cf3dcb18-2615-43b1-877a-a545b1e812bd@googlegroups.com>
In reply to#34445
Den torsdag 4 januari 2018 kl. 11:39:52 UTC+1 skrev Jonas Thörnvall:
> I try to set midichannel the way i did set midiprogram, i get no complains but it does not change the midichannel on my module?
> 
> Is midichannel something that need to be sent with each note?
> 
> function changeMidiChannel(){
> console.log("Change MIDI channel");
> channelC=document.getElementById("out_channel").selectedIndex+1;
> console.log("channel ",channelC);
> if (channelC==1) {sysexC=0xC0}
> else if (channelC==1) {sysexC=0xC0}
> else if (channelC==2) {sysexC=0xC1}
> else if (channelC==3) {sysexC=0xC2}
> else if (channelC==4) {sysexC=0xC3}
> else if (channelC==5) {sysexC=0xC4}
> else if (channelC==6) {sysexC=0xC5}
> else if (channelC==7) {sysexC=0xC6}
> else if (channelC==8) {sysexC=0xC7}
> else if (channelC==9) {sysexC=0xC8}
> else if (channelC==10) {sysexC=0xC9}
> else if (channelC==11) {sysexC=0xCA}
> else if (channelC==12) {sysexC=0xCB}
> else if (channelC==13) {sysexC=0xCC}
> else if (channelC==14) {sysexC=0xCD}
> else if (channelC==15) {sysexC=0xCE}
> else if (channelC==15) {sysexC=0xCF}
> else if (channelC==15) {sysexC=0xD0}
> output = mid.outputs.get(outportindex);
> console.log("Channel ",sysexC," program ",programC);
> var programChange = [sysexC,programC];
> output.send( programChange );
> }
http://computermusicresource.com/MIDI.Commands.html

[toc] | [prev] | [next] | [standalone]


#34447

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2018-01-04 03:21 -0800
Message-ID<21d01afa-1470-4359-89ed-d9d29fa4570a@googlegroups.com>
In reply to#34445
Den torsdag 4 januari 2018 kl. 11:39:52 UTC+1 skrev Jonas Thörnvall:
> I try to set midichannel the way i did set midiprogram, i get no complains but it does not change the midichannel on my module?
> 
> Is midichannel something that need to be sent with each note?
> 
> function changeMidiChannel(){
> console.log("Change MIDI channel");
> channelC=document.getElementById("out_channel").selectedIndex+1;
> console.log("channel ",channelC);
> if (channelC==1) {sysexC=0xC0}
> else if (channelC==1) {sysexC=0xC0}
> else if (channelC==2) {sysexC=0xC1}
> else if (channelC==3) {sysexC=0xC2}
> else if (channelC==4) {sysexC=0xC3}
> else if (channelC==5) {sysexC=0xC4}
> else if (channelC==6) {sysexC=0xC5}
> else if (channelC==7) {sysexC=0xC6}
> else if (channelC==8) {sysexC=0xC7}
> else if (channelC==9) {sysexC=0xC8}
> else if (channelC==10) {sysexC=0xC9}
> else if (channelC==11) {sysexC=0xCA}
> else if (channelC==12) {sysexC=0xCB}
> else if (channelC==13) {sysexC=0xCC}
> else if (channelC==14) {sysexC=0xCD}
> else if (channelC==15) {sysexC=0xCE}
> else if (channelC==15) {sysexC=0xCF}
> else if (channelC==15) {sysexC=0xD0}
> output = mid.outputs.get(outportindex);
> console.log("Channel ",sysexC," program ",programC);
> var programChange = [sysexC,programC];
> output.send( programChange );
> }

This function work to set program via a input text field, and it basicly the same code as the midichannel change, except i type in program 1-128 instead of using select option list.

Probably my message to set midichannel miss some parameter, or have a bad format?

function changeProgram(){
console.log("Change program");
sysexC=0xC0;
programC=document.getElementById("prog_sel").value;
output = mid.outputs.get(outportindex);
var programChange = [sysexC,programC];
output.send( programChange );  
}

[toc] | [prev] | [next] | [standalone]


#34448

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2018-01-04 03:27 -0800
Message-ID<7f71ff8e-4abd-4d5f-a50d-c0e821b65bb0@googlegroups.com>
In reply to#34447
Den torsdag 4 januari 2018 kl. 12:21:39 UTC+1 skrev Jonas Thörnvall:
> Den torsdag 4 januari 2018 kl. 11:39:52 UTC+1 skrev Jonas Thörnvall:
> > I try to set midichannel the way i did set midiprogram, i get no complains but it does not change the midichannel on my module?
> > 
> > Is midichannel something that need to be sent with each note?
> > 
> > function changeMidiChannel(){
> > console.log("Change MIDI channel");
> > channelC=document.getElementById("out_channel").selectedIndex+1;
> > console.log("channel ",channelC);
> > if (channelC==1) {sysexC=0xC0}
> > else if (channelC==1) {sysexC=0xC0}
> > else if (channelC==2) {sysexC=0xC1}
> > else if (channelC==3) {sysexC=0xC2}
> > else if (channelC==4) {sysexC=0xC3}
> > else if (channelC==5) {sysexC=0xC4}
> > else if (channelC==6) {sysexC=0xC5}
> > else if (channelC==7) {sysexC=0xC6}
> > else if (channelC==8) {sysexC=0xC7}
> > else if (channelC==9) {sysexC=0xC8}
> > else if (channelC==10) {sysexC=0xC9}
> > else if (channelC==11) {sysexC=0xCA}
> > else if (channelC==12) {sysexC=0xCB}
> > else if (channelC==13) {sysexC=0xCC}
> > else if (channelC==14) {sysexC=0xCD}
> > else if (channelC==15) {sysexC=0xCE}
> > else if (channelC==15) {sysexC=0xCF}
> > else if (channelC==15) {sysexC=0xD0}
> > output = mid.outputs.get(outportindex);
> > console.log("Channel ",sysexC," program ",programC);
> > var programChange = [sysexC,programC];
> > output.send( programChange );
> > }
> 
> This function work to set program via a input text field, and it basicly the same code as the midichannel change, except i type in program 1-128 instead of using select option list.
> 
> Probably my message to set midichannel miss some parameter, or have a bad format?
> 
> function changeProgram(){
> console.log("Change program");
> sysexC=0xC0;
> programC=document.getElementById("prog_sel").value;
> output = mid.outputs.get(outportindex);
> var programChange = [sysexC,programC];
> output.send( programChange );  
> }

I think it could be a mismatch parameter because this table seem to say that each note must be sent with a midi channel?


STATUS	DATA BYTE 1	DATA BYTE 2	COMMENT
144	60	127	Note ON channel 1
145	60	127	Note ON channel 2
146	60	127	Note ON channel 3
147	60	127	Note ON channel 4
148	60	127	Note ON channel 5
149	60	127	Note ON channel 6
150	60	127	Note ON channel 7
151	60	127	Note ON channel 8
152	60	127	Note ON channel 9
153	60	127	Note ON channel 10
154	60	127	Note ON channel 11
155	60	127	Note ON channel 12
156	60	127	Note ON channel 13
157	60	127	Note ON channel 14
158	60	127	Note ON channel 15
159	60	127	Note ON channel 16

[toc] | [prev] | [next] | [standalone]


#34450

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2018-01-04 04:14 -0800
Message-ID<8b1f514a-6508-4d9c-a778-25249783c2c9@googlegroups.com>
In reply to#34448
Den torsdag 4 januari 2018 kl. 12:27:32 UTC+1 skrev Jonas Thörnvall:
> Den torsdag 4 januari 2018 kl. 12:21:39 UTC+1 skrev Jonas Thörnvall:
> > Den torsdag 4 januari 2018 kl. 11:39:52 UTC+1 skrev Jonas Thörnvall:
> > > I try to set midichannel the way i did set midiprogram, i get no complains but it does not change the midichannel on my module?
> > > 
> > > Is midichannel something that need to be sent with each note?
> > > 
> > > function changeMidiChannel(){
> > > console.log("Change MIDI channel");
> > > channelC=document.getElementById("out_channel").selectedIndex+1;
> > > console.log("channel ",channelC);
> > > if (channelC==1) {sysexC=0xC0}
> > > else if (channelC==1) {sysexC=0xC0}
> > > else if (channelC==2) {sysexC=0xC1}
> > > else if (channelC==3) {sysexC=0xC2}
> > > else if (channelC==4) {sysexC=0xC3}
> > > else if (channelC==5) {sysexC=0xC4}
> > > else if (channelC==6) {sysexC=0xC5}
> > > else if (channelC==7) {sysexC=0xC6}
> > > else if (channelC==8) {sysexC=0xC7}
> > > else if (channelC==9) {sysexC=0xC8}
> > > else if (channelC==10) {sysexC=0xC9}
> > > else if (channelC==11) {sysexC=0xCA}
> > > else if (channelC==12) {sysexC=0xCB}
> > > else if (channelC==13) {sysexC=0xCC}
> > > else if (channelC==14) {sysexC=0xCD}
> > > else if (channelC==15) {sysexC=0xCE}
> > > else if (channelC==15) {sysexC=0xCF}
> > > else if (channelC==15) {sysexC=0xD0}
> > > output = mid.outputs.get(outportindex);
> > > console.log("Channel ",sysexC," program ",programC);
> > > var programChange = [sysexC,programC];
> > > output.send( programChange );
> > > }
> > 
> > This function work to set program via a input text field, and it basicly the same code as the midichannel change, except i type in program 1-128 instead of using select option list.
> > 
> > Probably my message to set midichannel miss some parameter, or have a bad format?
> > 
> > function changeProgram(){
> > console.log("Change program");
> > sysexC=0xC0;
> > programC=document.getElementById("prog_sel").value;
> > output = mid.outputs.get(outportindex);
> > var programChange = [sysexC,programC];
> > output.send( programChange );  
> > }
> 
> I think it could be a mismatch parameter because this table seem to say that each note must be sent with a midi channel?
> 
> 
> STATUS	DATA BYTE 1	DATA BYTE 2	COMMENT
> 144	60	127	Note ON channel 1
> 145	60	127	Note ON channel 2
> 146	60	127	Note ON channel 3
> 147	60	127	Note ON channel 4
> 148	60	127	Note ON channel 5
> 149	60	127	Note ON channel 6
> 150	60	127	Note ON channel 7
> 151	60	127	Note ON channel 8
> 152	60	127	Note ON channel 9
> 153	60	127	Note ON channel 10
> 154	60	127	Note ON channel 11
> 155	60	127	Note ON channel 12
> 156	60	127	Note ON channel 13
> 157	60	127	Note ON channel 14
> 158	60	127	Note ON channel 15
> 159	60	127	Note ON channel 16

Well it seem to work to change channel, but i guess to make sense one would have to pair each channel with a selected program. So i think i create those pairs at initiation.
So each channel hold a specific program right at start.

[toc] | [prev] | [next] | [standalone]


#34453

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2018-01-04 08:38 -0800
Message-ID<65d2447c-98e8-4db9-8bed-210945e00f51@googlegroups.com>
In reply to#34450
Den torsdag 4 januari 2018 kl. 13:14:23 UTC+1 skrev Jonas Thörnvall:
> Den torsdag 4 januari 2018 kl. 12:27:32 UTC+1 skrev Jonas Thörnvall:
> > Den torsdag 4 januari 2018 kl. 12:21:39 UTC+1 skrev Jonas Thörnvall:
> > > Den torsdag 4 januari 2018 kl. 11:39:52 UTC+1 skrev Jonas Thörnvall:
> > > > I try to set midichannel the way i did set midiprogram, i get no complains but it does not change the midichannel on my module?
> > > > 
> > > > Is midichannel something that need to be sent with each note?
> > > > 
> > > > function changeMidiChannel(){
> > > > console.log("Change MIDI channel");
> > > > channelC=document.getElementById("out_channel").selectedIndex+1;
> > > > console.log("channel ",channelC);
> > > > if (channelC==1) {sysexC=0xC0}
> > > > else if (channelC==1) {sysexC=0xC0}
> > > > else if (channelC==2) {sysexC=0xC1}
> > > > else if (channelC==3) {sysexC=0xC2}
> > > > else if (channelC==4) {sysexC=0xC3}
> > > > else if (channelC==5) {sysexC=0xC4}
> > > > else if (channelC==6) {sysexC=0xC5}
> > > > else if (channelC==7) {sysexC=0xC6}
> > > > else if (channelC==8) {sysexC=0xC7}
> > > > else if (channelC==9) {sysexC=0xC8}
> > > > else if (channelC==10) {sysexC=0xC9}
> > > > else if (channelC==11) {sysexC=0xCA}
> > > > else if (channelC==12) {sysexC=0xCB}
> > > > else if (channelC==13) {sysexC=0xCC}
> > > > else if (channelC==14) {sysexC=0xCD}
> > > > else if (channelC==15) {sysexC=0xCE}
> > > > else if (channelC==15) {sysexC=0xCF}
> > > > else if (channelC==15) {sysexC=0xD0}
> > > > output = mid.outputs.get(outportindex);
> > > > console.log("Channel ",sysexC," program ",programC);
> > > > var programChange = [sysexC,programC];
> > > > output.send( programChange );
> > > > }
> > > 
> > > This function work to set program via a input text field, and it basicly the same code as the midichannel change, except i type in program 1-128 instead of using select option list.
> > > 
> > > Probably my message to set midichannel miss some parameter, or have a bad format?
> > > 
> > > function changeProgram(){
> > > console.log("Change program");
> > > sysexC=0xC0;
> > > programC=document.getElementById("prog_sel").value;
> > > output = mid.outputs.get(outportindex);
> > > var programChange = [sysexC,programC];
> > > output.send( programChange );  
> > > }
> > 
> > I think it could be a mismatch parameter because this table seem to say that each note must be sent with a midi channel?
> > 
> > 
> > STATUS	DATA BYTE 1	DATA BYTE 2	COMMENT
> > 144	60	127	Note ON channel 1
> > 145	60	127	Note ON channel 2
> > 146	60	127	Note ON channel 3
> > 147	60	127	Note ON channel 4
> > 148	60	127	Note ON channel 5
> > 149	60	127	Note ON channel 6
> > 150	60	127	Note ON channel 7
> > 151	60	127	Note ON channel 8
> > 152	60	127	Note ON channel 9
> > 153	60	127	Note ON channel 10
> > 154	60	127	Note ON channel 11
> > 155	60	127	Note ON channel 12
> > 156	60	127	Note ON channel 13
> > 157	60	127	Note ON channel 14
> > 158	60	127	Note ON channel 15
> > 159	60	127	Note ON channel 16
> 
> Well it seem to work to change channel, but i guess to make sense one would have to pair each channel with a selected program. So i think i create those pairs at initiation.
> So each channel hold a specific program right at start.

Evidently note off is diffent for each channel just as note on, well it simply has to be that way. So the final code to change midichannel must create two messages one for note on and one for note off.

function changeMidiChannel(){
console.log("Change MIDI channel");
channelC=document.getElementById("out_channel").selectedIndex+1;
console.log("channel ",channelC);
if (channelC==1) {mymessage=0xC0}
else if (channelC==1) {mymessage=0x90; mymessage2=0x80;}
else if (channelC==2) {mymessage=0x91; mymessage2=0x81;}
else if (channelC==3) {mymessage=0x92;mymessage2=0x82;}
else if (channelC==4) {mymessage=0x93;mymessage2=0x83;}
else if (channelC==5) {mymessage=0x94;mymessage2=0x84;}
else if (channelC==6) {mymessage=0x95;mymessage2=0x85;}
else if (channelC==7) {mymessage=0x96;mymessage2=0x86;}
else if (channelC==8) {mymessage=0x97;mymessage2=0x87;}
else if (channelC==9) {mymessage=0x98;mymessage2=0x88;}
else if (channelC==10) {mymessage=0x99;mymessage2=0x89;}
else if (channelC==11) {mymessage=0xA0;mymessage2=0x8A;}
else if (channelC==12) {mymessage=0xA1;mymessage2=0x8B;}
else if (channelC==13) {mymessage=0xA2;mymessage2=0x8C;}
else if (channelC==14) {mymessage=0xA3;mymessage2=0x8D;}
else if (channelC==15) {mymessage=0xA4;mymessage2=0x8E;}
else if (channelC==16) {mymessage=0xA5;mymessage2=0x8F;}
output = mid.outputs.get(outportindex);
console.log("Channel ",mymessage," program ",programC);
}

[toc] | [prev] | [next] | [standalone]


#34454

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2018-01-04 09:51 -0800
Message-ID<7c834140-5c2a-41e7-a120-154fba87b72c@googlegroups.com>
In reply to#34453
Den torsdag 4 januari 2018 kl. 17:38:45 UTC+1 skrev Jonas Thörnvall:
> Den torsdag 4 januari 2018 kl. 13:14:23 UTC+1 skrev Jonas Thörnvall:
> > Den torsdag 4 januari 2018 kl. 12:27:32 UTC+1 skrev Jonas Thörnvall:
> > > Den torsdag 4 januari 2018 kl. 12:21:39 UTC+1 skrev Jonas Thörnvall:
> > > > Den torsdag 4 januari 2018 kl. 11:39:52 UTC+1 skrev Jonas Thörnvall:
> > > > > I try to set midichannel the way i did set midiprogram, i get no complains but it does not change the midichannel on my module?
> > > > > 
> > > > > Is midichannel something that need to be sent with each note?
> > > > > 
> > > > > function changeMidiChannel(){
> > > > > console.log("Change MIDI channel");
> > > > > channelC=document.getElementById("out_channel").selectedIndex+1;
> > > > > console.log("channel ",channelC);
> > > > > if (channelC==1) {sysexC=0xC0}
> > > > > else if (channelC==1) {sysexC=0xC0}
> > > > > else if (channelC==2) {sysexC=0xC1}
> > > > > else if (channelC==3) {sysexC=0xC2}
> > > > > else if (channelC==4) {sysexC=0xC3}
> > > > > else if (channelC==5) {sysexC=0xC4}
> > > > > else if (channelC==6) {sysexC=0xC5}
> > > > > else if (channelC==7) {sysexC=0xC6}
> > > > > else if (channelC==8) {sysexC=0xC7}
> > > > > else if (channelC==9) {sysexC=0xC8}
> > > > > else if (channelC==10) {sysexC=0xC9}
> > > > > else if (channelC==11) {sysexC=0xCA}
> > > > > else if (channelC==12) {sysexC=0xCB}
> > > > > else if (channelC==13) {sysexC=0xCC}
> > > > > else if (channelC==14) {sysexC=0xCD}
> > > > > else if (channelC==15) {sysexC=0xCE}
> > > > > else if (channelC==15) {sysexC=0xCF}
> > > > > else if (channelC==15) {sysexC=0xD0}
> > > > > output = mid.outputs.get(outportindex);
> > > > > console.log("Channel ",sysexC," program ",programC);
> > > > > var programChange = [sysexC,programC];
> > > > > output.send( programChange );
> > > > > }
> > > > 
> > > > This function work to set program via a input text field, and it basicly the same code as the midichannel change, except i type in program 1-128 instead of using select option list.
> > > > 
> > > > Probably my message to set midichannel miss some parameter, or have a bad format?
> > > > 
> > > > function changeProgram(){
> > > > console.log("Change program");
> > > > sysexC=0xC0;
> > > > programC=document.getElementById("prog_sel").value;
> > > > output = mid.outputs.get(outportindex);
> > > > var programChange = [sysexC,programC];
> > > > output.send( programChange );  
> > > > }
> > > 
> > > I think it could be a mismatch parameter because this table seem to say that each note must be sent with a midi channel?
> > > 
> > > 
> > > STATUS	DATA BYTE 1	DATA BYTE 2	COMMENT
> > > 144	60	127	Note ON channel 1
> > > 145	60	127	Note ON channel 2
> > > 146	60	127	Note ON channel 3
> > > 147	60	127	Note ON channel 4
> > > 148	60	127	Note ON channel 5
> > > 149	60	127	Note ON channel 6
> > > 150	60	127	Note ON channel 7
> > > 151	60	127	Note ON channel 8
> > > 152	60	127	Note ON channel 9
> > > 153	60	127	Note ON channel 10
> > > 154	60	127	Note ON channel 11
> > > 155	60	127	Note ON channel 12
> > > 156	60	127	Note ON channel 13
> > > 157	60	127	Note ON channel 14
> > > 158	60	127	Note ON channel 15
> > > 159	60	127	Note ON channel 16
> > 
> > Well it seem to work to change channel, but i guess to make sense one would have to pair each channel with a selected program. So i think i create those pairs at initiation.
> > So each channel hold a specific program right at start.
> 
> Evidently note off is diffent for each channel just as note on, well it simply has to be that way. So the final code to change midichannel must create two messages one for note on and one for note off.
> 
> function changeMidiChannel(){
> console.log("Change MIDI channel");
> channelC=document.getElementById("out_channel").selectedIndex+1;
> console.log("channel ",channelC);
> if (channelC==1) {mymessage=0xC0}
> else if (channelC==1) {mymessage=0x90; mymessage2=0x80;}
> else if (channelC==2) {mymessage=0x91; mymessage2=0x81;}
> else if (channelC==3) {mymessage=0x92;mymessage2=0x82;}
> else if (channelC==4) {mymessage=0x93;mymessage2=0x83;}
> else if (channelC==5) {mymessage=0x94;mymessage2=0x84;}
> else if (channelC==6) {mymessage=0x95;mymessage2=0x85;}
> else if (channelC==7) {mymessage=0x96;mymessage2=0x86;}
> else if (channelC==8) {mymessage=0x97;mymessage2=0x87;}
> else if (channelC==9) {mymessage=0x98;mymessage2=0x88;}
> else if (channelC==10) {mymessage=0x99;mymessage2=0x89;}
> else if (channelC==11) {mymessage=0xA0;mymessage2=0x8A;}
> else if (channelC==12) {mymessage=0xA1;mymessage2=0x8B;}
> else if (channelC==13) {mymessage=0xA2;mymessage2=0x8C;}
> else if (channelC==14) {mymessage=0xA3;mymessage2=0x8D;}
> else if (channelC==15) {mymessage=0xA4;mymessage2=0x8E;}
> else if (channelC==16) {mymessage=0xA5;mymessage2=0x8F;}
> output = mid.outputs.get(outportindex);
> console.log("Channel ",mymessage," program ",programC);
> }

Since my approach basicly forge the midi message, "my keyboard still send on channel 1" and i replace it. That mean that when i select program it always will change the program using midichannel 1. All the other channels do not care about that program message.

So "what message" actually change so the module listen/responce to another channel when i set the program? 

To be able to send a note to a channel doesn't mean that it will listen to a program change? The forging of note on and off "at the channels" seems to work good and not cause any latency.

But it would be nice to be able to change program at all channels, not only using midi channel 1.

[toc] | [prev] | [next] | [standalone]


#34455

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2018-01-04 09:59 -0800
Message-ID<d505457d-49e7-416d-9b97-0ef4cfa8d3e8@googlegroups.com>
In reply to#34454
Den torsdag 4 januari 2018 kl. 18:52:03 UTC+1 skrev Jonas Thörnvall:
> Den torsdag 4 januari 2018 kl. 17:38:45 UTC+1 skrev Jonas Thörnvall:
> > Den torsdag 4 januari 2018 kl. 13:14:23 UTC+1 skrev Jonas Thörnvall:
> > > Den torsdag 4 januari 2018 kl. 12:27:32 UTC+1 skrev Jonas Thörnvall:
> > > > Den torsdag 4 januari 2018 kl. 12:21:39 UTC+1 skrev Jonas Thörnvall:
> > > > > Den torsdag 4 januari 2018 kl. 11:39:52 UTC+1 skrev Jonas Thörnvall:
> > > > > > I try to set midichannel the way i did set midiprogram, i get no complains but it does not change the midichannel on my module?
> > > > > > 
> > > > > > Is midichannel something that need to be sent with each note?
> > > > > > 
> > > > > > function changeMidiChannel(){
> > > > > > console.log("Change MIDI channel");
> > > > > > channelC=document.getElementById("out_channel").selectedIndex+1;
> > > > > > console.log("channel ",channelC);
> > > > > > if (channelC==1) {sysexC=0xC0}
> > > > > > else if (channelC==1) {sysexC=0xC0}
> > > > > > else if (channelC==2) {sysexC=0xC1}
> > > > > > else if (channelC==3) {sysexC=0xC2}
> > > > > > else if (channelC==4) {sysexC=0xC3}
> > > > > > else if (channelC==5) {sysexC=0xC4}
> > > > > > else if (channelC==6) {sysexC=0xC5}
> > > > > > else if (channelC==7) {sysexC=0xC6}
> > > > > > else if (channelC==8) {sysexC=0xC7}
> > > > > > else if (channelC==9) {sysexC=0xC8}
> > > > > > else if (channelC==10) {sysexC=0xC9}
> > > > > > else if (channelC==11) {sysexC=0xCA}
> > > > > > else if (channelC==12) {sysexC=0xCB}
> > > > > > else if (channelC==13) {sysexC=0xCC}
> > > > > > else if (channelC==14) {sysexC=0xCD}
> > > > > > else if (channelC==15) {sysexC=0xCE}
> > > > > > else if (channelC==15) {sysexC=0xCF}
> > > > > > else if (channelC==15) {sysexC=0xD0}
> > > > > > output = mid.outputs.get(outportindex);
> > > > > > console.log("Channel ",sysexC," program ",programC);
> > > > > > var programChange = [sysexC,programC];
> > > > > > output.send( programChange );
> > > > > > }
> > > > > 
> > > > > This function work to set program via a input text field, and it basicly the same code as the midichannel change, except i type in program 1-128 instead of using select option list.
> > > > > 
> > > > > Probably my message to set midichannel miss some parameter, or have a bad format?
> > > > > 
> > > > > function changeProgram(){
> > > > > console.log("Change program");
> > > > > sysexC=0xC0;
> > > > > programC=document.getElementById("prog_sel").value;
> > > > > output = mid.outputs.get(outportindex);
> > > > > var programChange = [sysexC,programC];
> > > > > output.send( programChange );  
> > > > > }
> > > > 
> > > > I think it could be a mismatch parameter because this table seem to say that each note must be sent with a midi channel?
> > > > 
> > > > 
> > > > STATUS	DATA BYTE 1	DATA BYTE 2	COMMENT
> > > > 144	60	127	Note ON channel 1
> > > > 145	60	127	Note ON channel 2
> > > > 146	60	127	Note ON channel 3
> > > > 147	60	127	Note ON channel 4
> > > > 148	60	127	Note ON channel 5
> > > > 149	60	127	Note ON channel 6
> > > > 150	60	127	Note ON channel 7
> > > > 151	60	127	Note ON channel 8
> > > > 152	60	127	Note ON channel 9
> > > > 153	60	127	Note ON channel 10
> > > > 154	60	127	Note ON channel 11
> > > > 155	60	127	Note ON channel 12
> > > > 156	60	127	Note ON channel 13
> > > > 157	60	127	Note ON channel 14
> > > > 158	60	127	Note ON channel 15
> > > > 159	60	127	Note ON channel 16
> > > 
> > > Well it seem to work to change channel, but i guess to make sense one would have to pair each channel with a selected program. So i think i create those pairs at initiation.
> > > So each channel hold a specific program right at start.
> > 
> > Evidently note off is diffent for each channel just as note on, well it simply has to be that way. So the final code to change midichannel must create two messages one for note on and one for note off.
> > 
> > function changeMidiChannel(){
> > console.log("Change MIDI channel");
> > channelC=document.getElementById("out_channel").selectedIndex+1;
> > console.log("channel ",channelC);
> > if (channelC==1) {mymessage=0xC0}
> > else if (channelC==1) {mymessage=0x90; mymessage2=0x80;}
> > else if (channelC==2) {mymessage=0x91; mymessage2=0x81;}
> > else if (channelC==3) {mymessage=0x92;mymessage2=0x82;}
> > else if (channelC==4) {mymessage=0x93;mymessage2=0x83;}
> > else if (channelC==5) {mymessage=0x94;mymessage2=0x84;}
> > else if (channelC==6) {mymessage=0x95;mymessage2=0x85;}
> > else if (channelC==7) {mymessage=0x96;mymessage2=0x86;}
> > else if (channelC==8) {mymessage=0x97;mymessage2=0x87;}
> > else if (channelC==9) {mymessage=0x98;mymessage2=0x88;}
> > else if (channelC==10) {mymessage=0x99;mymessage2=0x89;}
> > else if (channelC==11) {mymessage=0xA0;mymessage2=0x8A;}
> > else if (channelC==12) {mymessage=0xA1;mymessage2=0x8B;}
> > else if (channelC==13) {mymessage=0xA2;mymessage2=0x8C;}
> > else if (channelC==14) {mymessage=0xA3;mymessage2=0x8D;}
> > else if (channelC==15) {mymessage=0xA4;mymessage2=0x8E;}
> > else if (channelC==16) {mymessage=0xA5;mymessage2=0x8F;}
> > output = mid.outputs.get(outportindex);
> > console.log("Channel ",mymessage," program ",programC);
> > }
> 
> Since my approach basicly forge the midi message, "my keyboard still send on channel 1" and i replace it. That mean that when i select program it always will change the program using midichannel 1. All the other channels do not care about that program message.
> 
> So "what message" actually change so the module listen/responce to another channel when i set the program? 
> 
> To be able to send a note to a channel doesn't mean that it will listen to a program change? The forging of note on and off "at the channels" seems to work good and not cause any latency.
> 
> But it would be nice to be able to change program at all channels, not only using midi channel 1.

Oops i had hardcoded the channel now it works.

function changeProgram(){
console.log("Change program");
sysexC=192+channelC-1;
programC=document.getElementById("prog_sel").value
output = mid.outputs.get(outportindex);
var programChange = [sysexC,programC];
output.send(programChange );  
}

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web