I am building midi messages "interfacing" a software synth. But i am so terrible reading others codes so i am not sure i understand it correct.
Isn't the bank and modulation messages just checking if byte 1 equal 176 and byte 2 equal 1 if so one should call the modulation function and if byte 2 equal 0 one should call the bnk function?
I will try again but i can't get the bnk and modulation messages to work.
switch (message[0] & 0xf0) {
case 0x80: // NoteOff: 8n kk vv
synth.noteOff(channel, message[1], message[2]);
break;
case 0x90: // NoteOn: 9n kk vv
if (message[2] > 0) {
synth.noteOn(channel, message[1], message[2]);
} else {
synth.noteOff(channel, message[1], 0);
}
break;
case 0xB0: // Control Change: Bn cc dd
/** @type {number} */
const value = message[2];
switch (message[1]) {
case 0x00: // Bank Select MSB: Bn 00 dd
synth.bankSelectMsb(channel, value);
break;
case 0x01: // Modulation Depth
synth.modulationDepth(channel, value);
break;
case 0x05: // Portament Time
break;
case 0x06: // Data Entry(MSB): Bn 06 dd
if (this.rpnMode) {
// RPN
switch (this.RpnMsb[channel]) {
case 0:
switch (this.RpnLsb[channel]) {
case 0: // Pitch Bend Sensitivity
synth.pitchBendSensitivity(channel, value);
break;
case 1:
// console.log("fine");
break;
case 2:
// console.log("coarse");
break;
default:
// console.log("default");
break;
}
break;
default:
// console.log("default:", this.RpnMsb[channel], this.RpnLsb[channel]); break;
}
torsdag 24 juni 2021 kl. 15:07:40 UTC+2 skrev Jonas Thörnvall:If someone want to try send a bankchange message.
I am building midi messages "interfacing" a software synth. But i am so terrible reading others codes so i am not sure i understand it correct.
Isn't the bank and modulation messages just checking if byte 1 equal 176 and byte 2 equal 1 if so one should call the modulation function and if byte 2 equal 0 one should call the bnk function?
I will try again but i can't get the bnk and modulation messages to work.
switch (message[0] & 0xf0) {I think there is something very strange i can not quite wrap my head on with web midi link external synth calls, to me it seem what should be sent over net, rather should be a byte length?
case 0x80: // NoteOff: 8n kk vv
synth.noteOff(channel, message[1], message[2]);
break;
case 0x90: // NoteOn: 9n kk vv
if (message[2] > 0) {
synth.noteOn(channel, message[1], message[2]);
} else {
synth.noteOff(channel, message[1], 0);
}
break;
case 0xB0: // Control Change: Bn cc dd
/** @type {number} */
const value = message[2];
switch (message[1]) {
case 0x00: // Bank Select MSB: Bn 00 dd
synth.bankSelectMsb(channel, value);
break;
case 0x01: // Modulation Depth
synth.modulationDepth(channel, value);
break;
case 0x05: // Portament Time
break;
case 0x06: // Data Entry(MSB): Bn 06 dd
if (this.rpnMode) {
// RPN
switch (this.RpnMsb[channel]) {
case 0:
switch (this.RpnLsb[channel]) {
case 0: // Pitch Bend Sensitivity
synth.pitchBendSensitivity(channel, value);
break;
case 1:
// console.log("fine");
break;
case 2:
// console.log("coarse");
break;
default:
// console.log("default");
break;
}
break;
default:
// console.log("default:", this.RpnMsb[channel], this.RpnLsb[channel]); break;
}
The function names are not sent as parameter anyway
So one could just have 3 type of calls/function "3 byte calls", ""2 byte calls" and "sysex calls of variable length?".
The decomposition is done on the receiver side anyway????
Here is my sender, i practically send all CC over noteOn problem is bankchanges and modulation do not work and i do not understand why?
var synth = new Synth();
//To string 16 converts number to hexadecimal value
function Synth() {
this.sy = null;
this.Load = function(url) {
this.sy = window.open(url, "extSynth", "width=700,height=700,scrollbars=yes,resizable=yes");
this.sy.focus();
}
this.NoteOn = function(SFM,note, velo) {
SFM=parseInt(SFM);
note=parseInt(note);
velo=parseInt(velo);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+"," + note.toString(16) + "," + velo.toString(16));
}
this.NoteOff = function(SFM,note) {
SFM=parseInt(SFM);
note=parseInt(note);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+","+ note.toString(16) + ",0");
}
this.PGMchange = function(SFchan,SFprg) {
SFprg=parseInt(SFprg);
SFchan=parseInt(SFchan);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFprg.toString(16));
}
//////////Is PGMchange above not same message "type, not content" as noteOff two bytes sent?//////////////////////////////////
/////////////////////////////////////////////////////////////////////////WHY SHOULD THESE FUNCTIONS BE NEEDED///////////////////////////////
///////////////////////////////////////Or are the function calls somehow passed as argument over net???//////////////////////////////////
/////////////////////////////////////If so i should probably name them correct, but i don't think they are?///////////////////////////////////
this.MODchange = function(SFchan,SFval) {
SFchan=parseInt(SFchan);
SFval=parseInt(SFval);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFval.toString(16));
}
this.BNKchange = function(SFchan,SFbnk) {
SFchan=parseInt(SFchan);
SFval=parseInt(SFbnk);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFbnk.toString(16));
} /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////This is another type of message 1byte, probably could named it anything or????////////////////////
this.AllSoundOff = function(offCh) {
offCh=parseInt(offCh);
this.SendMessage(this.sy, "midi,"+offCh.toString(16));
}
this.SendMessage = function(sy, s) {
if(this.sy)
this.sy.postMessage(s, "*");
}
}
torsdag 24 juni 2021 kl. 15:35:33 UTC+2 skrev Jonas Thörnvall:Give it a go on my phoneserver so no SSL
torsdag 24 juni 2021 kl. 15:07:40 UTC+2 skrev Jonas Thörnvall:
I am building midi messages "interfacing" a software synth. But i am so terrible reading others codes so i am not sure i understand it correct.
Isn't the bank and modulation messages just checking if byte 1 equal 176 and byte 2 equal 1 if so one should call the modulation function and if byte 2 equal 0 one should call the bnk function?
I will try again but i can't get the bnk and modulation messages to work.
switch (message[0] & 0xf0) {I think there is something very strange i can not quite wrap my head on with web midi link external synth calls, to me it seem what should be sent over net, rather should be a byte length?
case 0x80: // NoteOff: 8n kk vv
synth.noteOff(channel, message[1], message[2]);
break;
case 0x90: // NoteOn: 9n kk vv
if (message[2] > 0) {
synth.noteOn(channel, message[1], message[2]);
} else {
synth.noteOff(channel, message[1], 0);
}
break;
case 0xB0: // Control Change: Bn cc dd
/** @type {number} */
const value = message[2];
switch (message[1]) {
case 0x00: // Bank Select MSB: Bn 00 dd
synth.bankSelectMsb(channel, value);
break;
case 0x01: // Modulation Depth
synth.modulationDepth(channel, value);
break;
case 0x05: // Portament Time
break;
case 0x06: // Data Entry(MSB): Bn 06 dd
if (this.rpnMode) {
// RPN
switch (this.RpnMsb[channel]) {
case 0:
switch (this.RpnLsb[channel]) {
case 0: // Pitch Bend Sensitivity
synth.pitchBendSensitivity(channel, value);
break;
case 1:
// console.log("fine");
break;
case 2:
// console.log("coarse");
break;
default:
// console.log("default");
break;
}
break;
default:
// console.log("default:", this.RpnMsb[channel], this.RpnLsb[channel]); break;
}
The function names are not sent as parameter anyway
So one could just have 3 type of calls/function "3 byte calls", ""2 byte calls" and "sysex calls of variable length?".
The decomposition is done on the receiver side anyway????
Here is my sender, i practically send all CC over noteOn problem is bankchanges and modulation do not work and i do not understand why?
var synth = new Synth();
//To string 16 converts number to hexadecimal value
function Synth() {
this.sy = null;
this.Load = function(url) {
this.sy = window.open(url, "extSynth", "width=700,height=700,scrollbars=yes,resizable=yes");
this.sy.focus();
}
this.NoteOn = function(SFM,note, velo) {
SFM=parseInt(SFM);
note=parseInt(note);
velo=parseInt(velo);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+"," + note.toString(16) + "," + velo.toString(16));
}
this.NoteOff = function(SFM,note) {
SFM=parseInt(SFM);
note=parseInt(note);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+","+ note.toString(16) + ",0");
}
this.PGMchange = function(SFchan,SFprg) {
SFprg=parseInt(SFprg);
SFchan=parseInt(SFchan);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFprg.toString(16));
}
//////////Is PGMchange above not same message "type, not content" as noteOff two bytes sent?//////////////////////////////////
/////////////////////////////////////////////////////////////////////////WHY SHOULD THESE FUNCTIONS BE NEEDED///////////////////////////////
///////////////////////////////////////Or are the function calls somehow passed as argument over net???//////////////////////////////////
/////////////////////////////////////If so i should probably name them correct, but i don't think they are?///////////////////////////////////
this.MODchange = function(SFchan,SFval) {
SFchan=parseInt(SFchan);
SFval=parseInt(SFval);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFval.toString(16));
}
this.BNKchange = function(SFchan,SFbnk) {
SFchan=parseInt(SFchan);
SFval=parseInt(SFbnk);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFbnk.toString(16));
} /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////This is another type of message 1byte, probably could named it anything or????////////////////////
this.AllSoundOff = function(offCh) {
offCh=parseInt(offCh);
this.SendMessage(this.sy, "midi,"+offCh.toString(16));
}
this.SendMessage = function(sy, s) {If someone want to try send a bankchange message.
if(this.sy)
this.sy.postMessage(s, "*");
}
}
Here is how you invoke the synth. synth.Load('https://logue.dev/smfplayer.js/wml.html');
And here is the actual sender of messages to the synth.
Notes, programs and CCmessages seems to work but can't get CC modulation to respond, and sustain that should be a range 0-127 seems to be implemented as a binary state on and off.
But the most important thing to get working is bankchange, and i can not make it work.
var synth = new Synth();
//To string 16 converts number to hexadecimal value
function Synth() {
this.sy = null;
this.Load = function(url) {
this.sy = window.open(url, "extSynth", "width=700,height=700,scrollbars=yes,resizable=yes");
this.sy.focus();
}
this.NoteOn = function(SFM,note, velo) {
SFM=parseInt(SFM);
note=parseInt(note);
velo=parseInt(velo);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+"," + note.toString(16) + "," + velo.toString(16));
}
this.NoteOff = function(SFM,note) {
SFM=parseInt(SFM);
note=parseInt(note);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+","+ note.toString(16) + ",0");
}
this.PGMchange = function(SFchan,SFprg) {
SFprg=parseInt(SFprg);
SFchan=parseInt(SFchan);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFprg.toString(16));
}
this.SendMessage = function(sy, s) {
if(this.sy)
this.sy.postMessage(s, "*");
}
}
torsdag 24 juni 2021 kl. 18:07:33 UTC+2 skrev Jonas Thörnvall:
torsdag 24 juni 2021 kl. 15:35:33 UTC+2 skrev Jonas Thörnvall:Give it a go on my phoneserver so no SSL
torsdag 24 juni 2021 kl. 15:07:40 UTC+2 skrev Jonas Thörnvall:If someone want to try send a bankchange message.
I am building midi messages "interfacing" a software synth. But i am so terrible reading others codes so i am not sure i understand it correct.I think there is something very strange i can not quite wrap my head on with web midi link external synth calls, to me it seem what should be sent over net, rather should be a byte length?
Isn't the bank and modulation messages just checking if byte 1 equal 176 and byte 2 equal 1 if so one should call the modulation function and if byte 2 equal 0 one should call the bnk function?
I will try again but i can't get the bnk and modulation messages to work. >>>>
switch (message[0] & 0xf0) {
case 0x80: // NoteOff: 8n kk vv
synth.noteOff(channel, message[1], message[2]);
break;
case 0x90: // NoteOn: 9n kk vv
if (message[2] > 0) {
synth.noteOn(channel, message[1], message[2]);
} else {
synth.noteOff(channel, message[1], 0);
}
break;
case 0xB0: // Control Change: Bn cc dd
/** @type {number} */
const value = message[2];
switch (message[1]) {
case 0x00: // Bank Select MSB: Bn 00 dd
synth.bankSelectMsb(channel, value);
break;
case 0x01: // Modulation Depth
synth.modulationDepth(channel, value);
break;
case 0x05: // Portament Time
break;
case 0x06: // Data Entry(MSB): Bn 06 dd
if (this.rpnMode) {
// RPN
switch (this.RpnMsb[channel]) {
case 0:
switch (this.RpnLsb[channel]) {
case 0: // Pitch Bend Sensitivity
synth.pitchBendSensitivity(channel, value);
break;
case 1:
// console.log("fine");
break;
case 2:
// console.log("coarse");
break;
default:
// console.log("default");
break;
}
break;
default:
// console.log("default:", this.RpnMsb[channel], this.RpnLsb[channel]); >>>> break;
}
The function names are not sent as parameter anyway
So one could just have 3 type of calls/function "3 byte calls", ""2 byte calls" and "sysex calls of variable length?".
The decomposition is done on the receiver side anyway????
Here is my sender, i practically send all CC over noteOn problem is bankchanges and modulation do not work and i do not understand why?
var synth = new Synth();
//To string 16 converts number to hexadecimal value
function Synth() {
this.sy = null;
this.Load = function(url) {
this.sy = window.open(url, "extSynth", "width=700,height=700,scrollbars=yes,resizable=yes");
this.sy.focus();
}
this.NoteOn = function(SFM,note, velo) {
SFM=parseInt(SFM);
note=parseInt(note);
velo=parseInt(velo);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+"," + note.toString(16) + "," + velo.toString(16));
}
this.NoteOff = function(SFM,note) {
SFM=parseInt(SFM);
note=parseInt(note);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+","+ note.toString(16) + ",0");
}
this.PGMchange = function(SFchan,SFprg) {
SFprg=parseInt(SFprg);
SFchan=parseInt(SFchan);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFprg.toString(16));
}
//////////Is PGMchange above not same message "type, not content" as noteOff two bytes sent?//////////////////////////////////
/////////////////////////////////////////////////////////////////////////WHY SHOULD THESE FUNCTIONS BE NEEDED///////////////////////////////
///////////////////////////////////////Or are the function calls somehow passed as argument over net???//////////////////////////////////
/////////////////////////////////////If so i should probably name them correct, but i don't think they are?///////////////////////////////////
this.MODchange = function(SFchan,SFval) {
SFchan=parseInt(SFchan);
SFval=parseInt(SFval);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFval.toString(16));
}
this.BNKchange = function(SFchan,SFbnk) {
SFchan=parseInt(SFchan);
SFval=parseInt(SFbnk);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFbnk.toString(16));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////This is another type of message 1byte, probably could named it anything or????////////////////////
this.AllSoundOff = function(offCh) {
offCh=parseInt(offCh);
this.SendMessage(this.sy, "midi,"+offCh.toString(16));
}
this.SendMessage = function(sy, s) {
if(this.sy)
this.sy.postMessage(s, "*");
}
}
Here is how you invoke the synth.
synth.Load('https://logue.dev/smfplayer.js/wml.html');
And here is the actual sender of messages to the synth.
Notes, programs and CCmessages seems to work but can't get CC modulation to respond, and sustain that should be a range 0-127 seems to be implemented as a binary state on and off.
But the most important thing to get working is bankchange, and i can not make it work.
var synth = new Synth();
//To string 16 converts number to hexadecimal value
function Synth() {
this.sy = null;
this.Load = function(url) {
this.sy = window.open(url, "extSynth", "width=700,height=700,scrollbars=yes,resizable=yes");
this.sy.focus();
}
this.NoteOn = function(SFM,note, velo) {
SFM=parseInt(SFM);
note=parseInt(note);
velo=parseInt(velo);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+"," + note.toString(16) + "," + velo.toString(16));
}
this.NoteOff = function(SFM,note) {
SFM=parseInt(SFM);
note=parseInt(note);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+","+ note.toString(16) + ",0");
}
this.PGMchange = function(SFchan,SFprg) {
SFprg=parseInt(SFprg);
SFchan=parseInt(SFchan);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFprg.toString(16));
}
this.SendMessage = function(sy, s) {
if(this.sy)
this.sy.postMessage(s, "*");
}
}
https://84.217.163.187:80/
Is there something in it for you? https://www.w3.org/TR/2021/REC-webaudio-20210617/
Jonas Thörnvall schrieb:
torsdag 24 juni 2021 kl. 18:07:33 UTC+2 skrev Jonas Thörnvall:
torsdag 24 juni 2021 kl. 15:35:33 UTC+2 skrev Jonas Thörnvall:Give it a go on my phoneserver so no SSL
torsdag 24 juni 2021 kl. 15:07:40 UTC+2 skrev Jonas Thörnvall:If someone want to try send a bankchange message.
I am building midi messages "interfacing" a software synth. But i am so terrible reading others codes so i am not sure i understand it correct.I think there is something very strange i can not quite wrap my head on with web midi link external synth calls, to me it seem what should be sent over net, rather should be a byte length?
Isn't the bank and modulation messages just checking if byte 1 equal 176 and byte 2 equal 1 if so one should call the modulation function and if byte 2 equal 0 one should call the bnk function?
I will try again but i can't get the bnk and modulation messages to work.
switch (message[0] & 0xf0) {
case 0x80: // NoteOff: 8n kk vv
synth.noteOff(channel, message[1], message[2]);
break;
case 0x90: // NoteOn: 9n kk vv
if (message[2] > 0) {
synth.noteOn(channel, message[1], message[2]);
} else {
synth.noteOff(channel, message[1], 0);
}
break;
case 0xB0: // Control Change: Bn cc dd
/** @type {number} */
const value = message[2];
switch (message[1]) {
case 0x00: // Bank Select MSB: Bn 00 dd
synth.bankSelectMsb(channel, value);
break;
case 0x01: // Modulation Depth
synth.modulationDepth(channel, value);
break;
case 0x05: // Portament Time
break;
case 0x06: // Data Entry(MSB): Bn 06 dd
if (this.rpnMode) {
// RPN
switch (this.RpnMsb[channel]) {
case 0:
switch (this.RpnLsb[channel]) {
case 0: // Pitch Bend Sensitivity
synth.pitchBendSensitivity(channel, value);
break;
case 1:
// console.log("fine");
break;
case 2:
// console.log("coarse");
break;
default:
// console.log("default");
break;
}
break;
default:
// console.log("default:", this.RpnMsb[channel], this.RpnLsb[channel]); >>>> break;
}
The function names are not sent as parameter anyway
So one could just have 3 type of calls/function "3 byte calls", ""2 byte calls" and "sysex calls of variable length?".
The decomposition is done on the receiver side anyway????
Here is my sender, i practically send all CC over noteOn problem is bankchanges and modulation do not work and i do not understand why?
var synth = new Synth();
//To string 16 converts number to hexadecimal value
function Synth() {
this.sy = null;
this.Load = function(url) {
this.sy = window.open(url, "extSynth", "width=700,height=700,scrollbars=yes,resizable=yes");
this.sy.focus();
}
this.NoteOn = function(SFM,note, velo) {
SFM=parseInt(SFM);
note=parseInt(note);
velo=parseInt(velo);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+"," + note.toString(16) + "," + velo.toString(16));
}
this.NoteOff = function(SFM,note) {
SFM=parseInt(SFM);
note=parseInt(note);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+","+ note.toString(16) + ",0");
}
this.PGMchange = function(SFchan,SFprg) {
SFprg=parseInt(SFprg);
SFchan=parseInt(SFchan);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFprg.toString(16));
}
//////////Is PGMchange above not same message "type, not content" as noteOff two bytes sent?//////////////////////////////////
/////////////////////////////////////////////////////////////////////////WHY SHOULD THESE FUNCTIONS BE NEEDED///////////////////////////////
///////////////////////////////////////Or are the function calls somehow passed as argument over net???//////////////////////////////////
/////////////////////////////////////If so i should probably name them correct, but i don't think they are?///////////////////////////////////
this.MODchange = function(SFchan,SFval) {
SFchan=parseInt(SFchan);
SFval=parseInt(SFval);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFval.toString(16));
}
this.BNKchange = function(SFchan,SFbnk) {
SFchan=parseInt(SFchan);
SFval=parseInt(SFbnk);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFbnk.toString(16));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////This is another type of message 1byte, probably could named it anything or????////////////////////
this.AllSoundOff = function(offCh) {
offCh=parseInt(offCh);
this.SendMessage(this.sy, "midi,"+offCh.toString(16));
}
this.SendMessage = function(sy, s) {
if(this.sy)
this.sy.postMessage(s, "*");
}
}
Here is how you invoke the synth.
synth.Load('https://logue.dev/smfplayer.js/wml.html');
And here is the actual sender of messages to the synth.
Notes, programs and CCmessages seems to work but can't get CC modulation to respond, and sustain that should be a range 0-127 seems to be implemented as a binary state on and off.
But the most important thing to get working is bankchange, and i can not make it work.
var synth = new Synth();
//To string 16 converts number to hexadecimal value
function Synth() {
this.sy = null;
this.Load = function(url) {
this.sy = window.open(url, "extSynth", "width=700,height=700,scrollbars=yes,resizable=yes");
this.sy.focus();
}
this.NoteOn = function(SFM,note, velo) {
SFM=parseInt(SFM);
note=parseInt(note);
velo=parseInt(velo);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+"," + note.toString(16) + "," + velo.toString(16));
}
this.NoteOff = function(SFM,note) {
SFM=parseInt(SFM);
note=parseInt(note);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+","+ note.toString(16) + ",0");
}
this.PGMchange = function(SFchan,SFprg) {
SFprg=parseInt(SFprg);
SFchan=parseInt(SFchan);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFprg.toString(16));
}
this.SendMessage = function(sy, s) {
if(this.sy)
this.sy.postMessage(s, "*");
}
}
https://84.217.163.187:80/
fredag 25 juni 2021 kl. 13:57:16 UTC+2 skrev Mostowski Collapse:
Is there something in it for you?There probably is but i am not much of a reader of content, i rather look at things done and see "if i can figure out" what going on.
https://www.w3.org/TR/2021/REC-webaudio-20210617/
Jonas Thörnvall schrieb:
torsdag 24 juni 2021 kl. 18:07:33 UTC+2 skrev Jonas Thörnvall:
torsdag 24 juni 2021 kl. 15:35:33 UTC+2 skrev Jonas Thörnvall:Give it a go on my phoneserver so no SSL
torsdag 24 juni 2021 kl. 15:07:40 UTC+2 skrev Jonas Thörnvall:If someone want to try send a bankchange message.
I am building midi messages "interfacing" a software synth. But i am so terrible reading others codes so i am not sure i understand it correct.I think there is something very strange i can not quite wrap my head on with web midi link external synth calls, to me it seem what should be sent over net, rather should be a byte length?
Isn't the bank and modulation messages just checking if byte 1 equal 176 and byte 2 equal 1 if so one should call the modulation function and if byte 2 equal 0 one should call the bnk function?
I will try again but i can't get the bnk and modulation messages to work.
switch (message[0] & 0xf0) {
case 0x80: // NoteOff: 8n kk vv
synth.noteOff(channel, message[1], message[2]);
break;
case 0x90: // NoteOn: 9n kk vv
if (message[2] > 0) {
synth.noteOn(channel, message[1], message[2]);
} else {
synth.noteOff(channel, message[1], 0);
}
break;
case 0xB0: // Control Change: Bn cc dd
/** @type {number} */
const value = message[2];
switch (message[1]) {
case 0x00: // Bank Select MSB: Bn 00 dd
synth.bankSelectMsb(channel, value);
break;
case 0x01: // Modulation Depth
synth.modulationDepth(channel, value);
break;
case 0x05: // Portament Time
break;
case 0x06: // Data Entry(MSB): Bn 06 dd
if (this.rpnMode) {
// RPN
switch (this.RpnMsb[channel]) {
case 0:
switch (this.RpnLsb[channel]) {
case 0: // Pitch Bend Sensitivity
synth.pitchBendSensitivity(channel, value);
break;
case 1:
// console.log("fine");
break;
case 2:
// console.log("coarse");
break;
default:
// console.log("default");
break;
}
break;
default:
// console.log("default:", this.RpnMsb[channel], this.RpnLsb[channel]); >>>>>> break;
}
The function names are not sent as parameter anyway
So one could just have 3 type of calls/function "3 byte calls", ""2 byte calls" and "sysex calls of variable length?".
The decomposition is done on the receiver side anyway????
Here is my sender, i practically send all CC over noteOn problem is bankchanges and modulation do not work and i do not understand why?
var synth = new Synth();
//To string 16 converts number to hexadecimal value
function Synth() {
this.sy = null;
this.Load = function(url) {
this.sy = window.open(url, "extSynth", "width=700,height=700,scrollbars=yes,resizable=yes");
this.sy.focus();
}
this.NoteOn = function(SFM,note, velo) {
SFM=parseInt(SFM);
note=parseInt(note);
velo=parseInt(velo);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+"," + note.toString(16) + "," + velo.toString(16));
}
this.NoteOff = function(SFM,note) {
SFM=parseInt(SFM);
note=parseInt(note);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+","+ note.toString(16) + ",0");
}
this.PGMchange = function(SFchan,SFprg) {
SFprg=parseInt(SFprg);
SFchan=parseInt(SFchan);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFprg.toString(16));
}
//////////Is PGMchange above not same message "type, not content" as noteOff two bytes sent?//////////////////////////////////
/////////////////////////////////////////////////////////////////////////WHY SHOULD THESE FUNCTIONS BE NEEDED///////////////////////////////
///////////////////////////////////////Or are the function calls somehow passed as argument over net???//////////////////////////////////
/////////////////////////////////////If so i should probably name them correct, but i don't think they are?///////////////////////////////////
this.MODchange = function(SFchan,SFval) {
SFchan=parseInt(SFchan);
SFval=parseInt(SFval);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFval.toString(16));
}
this.BNKchange = function(SFchan,SFbnk) {
SFchan=parseInt(SFchan);
SFval=parseInt(SFbnk);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFbnk.toString(16));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////This is another type of message 1byte, probably could named it anything or????////////////////////
this.AllSoundOff = function(offCh) {
offCh=parseInt(offCh);
this.SendMessage(this.sy, "midi,"+offCh.toString(16));
}
this.SendMessage = function(sy, s) {
if(this.sy)
this.sy.postMessage(s, "*");
}
}
Here is how you invoke the synth.
synth.Load('https://logue.dev/smfplayer.js/wml.html');
And here is the actual sender of messages to the synth.
Notes, programs and CCmessages seems to work but can't get CC modulation to respond, and sustain that should be a range 0-127 seems to be implemented as a binary state on and off.
But the most important thing to get working is bankchange, and i can not make it work.
var synth = new Synth();
//To string 16 converts number to hexadecimal value
function Synth() {
this.sy = null;
this.Load = function(url) {
this.sy = window.open(url, "extSynth", "width=700,height=700,scrollbars=yes,resizable=yes");
this.sy.focus();
}
this.NoteOn = function(SFM,note, velo) {
SFM=parseInt(SFM);
note=parseInt(note);
velo=parseInt(velo);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+"," + note.toString(16) + "," + velo.toString(16));
}
this.NoteOff = function(SFM,note) {
SFM=parseInt(SFM);
note=parseInt(note);
this.SendMessage(this.sy, "midi,"+SFM.toString(16)+","+ note.toString(16) + ",0");
}
this.PGMchange = function(SFchan,SFprg) {
SFprg=parseInt(SFprg);
SFchan=parseInt(SFchan);
this.SendMessage(this.sy, "midi,"+SFchan.toString(16)+","+SFprg.toString(16));
}
this.SendMessage = function(sy, s) {
if(this.sy)
this.sy.postMessage(s, "*");
}
}
https://84.217.163.187:80/
From the introduction:
"Audio on the web has been fairly primitive up to this point and until
very recently has had to be delivered through plugins such as Flash and QuickTime. The introduction of the audio element in HTML5 is very
important, allowing for basic streaming audio playback.
But, it is not powerful enough to handle more complex audio
applications. For sophisticated web-based games or interactive
applications, another solution is required. It is a goal of this specification to include the capabilities
found in modern game audio engines as well as some of the mixing,
processing, and filtering tasks that are found in modern desktop
audio production applications." https://www.w3.org/TR/2021/REC-webaudio-20210617/
Jonas Thörnvall schrieb:
There probably is but i am not much of a reader of content, i rather
look at things done and see "if i can figure out" what going on.
I tried something very simple with Dogelog:
http://www.dogelog.ch/song.html
Strangely it works in Chrome, but doesn't work in Safari. :-(
Some description how it was done:
Preview: Dogelog plays Mary had a little Lamb. (Jekejeke) https://gist.github.com/jburse/20fff6f056c1f4421874e41769a9c387#gistcomment-3793350
Next step is to use async/await, so that the delay/2
primitive can be replaced by a sleep/1 primitive.
Working on it...
Mostowski Collapse schrieb:
From the introduction:
"Audio on the web has been fairly primitive up to this point and until very recently has had to be delivered through plugins such as Flash and QuickTime. The introduction of the audio element in HTML5 is very important, allowing for basic streaming audio playback.
But, it is not powerful enough to handle more complex audio
applications. For sophisticated web-based games or interactive applications, another solution is required. It is a goal of this specification to include the capabilities
found in modern game audio engines as well as some of the mixing, processing, and filtering tasks that are found in modern desktop
audio production applications." https://www.w3.org/TR/2021/REC-webaudio-20210617/
Jonas Thörnvall schrieb:
There probably is but i am not much of a reader of content, i rather
look at things done and see "if i can figure out" what going on.
lördag 26 juni 2021 kl. 11:19:48 UTC+2 skrev Mostowski Collapse:I have problem understanding this, could someone explain "i think this message should be used to send "variable length" sysex messages over the webmidi interface.
I tried something very simple with Dogelog: http://www.dogelog.ch/song.html
Strangely it works in Chrome, but doesn't work in Safari. :-(
Some description how it was done:
Preview: Dogelog plays Mary had a little Lamb. (Jekejeke) https://gist.github.com/jburse/20fff6f056c1f4421874e41769a9c387#gistcomment-3793350
Next step is to use async/await, so that the delay/2
primitive can be replaced by a sleep/1 primitive.
Working on it...
Mostowski Collapse schrieb:
From the introduction:
"Audio on the web has been fairly primitive up to this point and until very recently has had to be delivered through plugins such as Flash and QuickTime. The introduction of the audio element in HTML5 is very important, allowing for basic streaming audio playback.
But, it is not powerful enough to handle more complex audio applications. For sophisticated web-based games or interactive applications, another solution is required. It is a goal of this specification to include the capabilities
found in modern game audio engines as well as some of the mixing, processing, and filtering tasks that are found in modern desktop
audio production applications." https://www.w3.org/TR/2021/REC-webaudio-20210617/
Jonas Thörnvall schrieb:
There probably is but i am not much of a reader of content, i rather
look at things done and see "if i can figure out" what going on.
A nice little start for Dogelog, but regarding my problems they are on a metalayer "a built on message API" for the web MiDI API, it could even be so simple that the synth do not recognise bnk and modulation changes.
The interface of it use webmidilink that is a simple protocol for send messages.
https://www.g200kg.com/en/docs/webmidilink/spec.html
It seem to me the "synth builder" logue have specified both modulation receive and bank receive, see first post in thread.
The webmidilink protocol specify a sender and receiver approach.
But i simply can't create a bankchange or modulation, and it can be so simple that they really not specified, but i can change programs "sound", set volume, set reverb play notes e t c.
So my question is do i understand what message the receiver wants, maybe i am sending wrong message and that is why i do not hear modulation or manage to change bank for synth.
Regarding Dogelog, i will follow its development, yesterday i had a look at my chess "rule" interface with load and save of chessgames, clock and setup so it is almost there.
And i am thinking maybe Dogelog a suitable platform to build the engine around.
JT
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 469 |
Nodes: | 16 (2 / 14) |
Uptime: | 42:06:55 |
Calls: | 9,449 |
Calls today: | 6 |
Files: | 13,596 |
Messages: | 6,111,760 |
Posted today: | 1 |