fbpx
Skip to main content

MIDI Forum

Program message sta...
 
Notifications
Clear all

Program message standard to midi synth "A software SF2 synth"

4 Posts
2 Users
0 Reactions
4,540 Views
Jonas
Posts: 207
Reputable Member
Topic starter
 

I try send messages to a SF2 synth but it behaves strangely when loading midi files and sending programs/patches, and i probably have something todo with message length.
My sequenser send program/patch messages, i use my Roland SC-7 here as references for patch changes.

Basicly the SF2 synth do want hex so i do a toString(16) on any numeric valued program before sending.
From program 1-10 it maps fine.
But when i send program 11 it suddenly read out 17 on the SF2 synth.
And start evolve from there, then at program 20 it suddenly make another jump to 33 on the SF2 synth.

I get it is something with the message length "bit length?" going wrong, do anyone familiar with MIDI program messages understand this behaviour.
And what i could do to correct the message formatting.

Now to further obfuscate the issue, program 1 is value 0 even on the SC-7 and program 128 is value 127, but that is standard for any midi device.
Should i just accept subtract 6 to program 11 and so on, without understand what is going on.
"Well that wont work out, i am the one sending the message 6 that is interpretated as 11"

Is this something with 7 bit encoding of program messages i have missed, and if so how do i correct it?
My Roland SC-7 quite happy with the messages i send, but that maybe because MIDI API very nice to me and convert my integer based messages to correct format.
But i know for a fact i send messages in the range 0-127 as program messages, so i am a bit stumped by the behaviour of the SF2 synth.
And i really can't see what could go wrong converting them to hex (base 16)

Best regards JT

http://jonasth.ddnsfree.com/
PS no need to panic even if the browser do, i do not think my phone "server" have any dangerous programs on it just my sequencer.
Well one day i may get a SSL certificate if my android app support it.

 
Posted : 17/06/2021 10:52 am
Geoff
Posts: 1043
Noble Member
 

Hello,

Things getting mixed re base 10 and base 16. You are sending data as hex, but the SC-7 is displaying the result as decimal. Numbers you describe are correct.

You send 11 (hex) and SC-7 correctly displays this as 17. Both prob have the 1 added re number range 0-15 or 1-16.

If you need to send literal midi data, then should be hex, 0 to F. By the time this gets to SC-7, this will be 0 to 15, or 1 to 16 if the device numbers patches 1 to 16 etc.

Geoff

 
Posted : 17/06/2021 12:12 pm
Jonas
Posts: 207
Reputable Member
Topic starter
 

Hello Geoff, well i am confused now i must say the Javascript MIDI API is very forgiving so i can chose send either decimal 17 or hex 11 to the SC-7, it make conversion automatically if you do not specify hex. "you can even send bitfromatted string "1011".

But as i understand it the SF2 synth i want to use want hex,
Since i basicly just encode decimals for my sequenser, i take my decimal prgvalue and do prgNbr.toString(16) before i send it to SF2.
That render b, which is sent, but maybe my assumption is wrong?

Click the button to display the formatted number.

function myFunction() {
var num = 11;
var n = num.toString(16);
alert(n);
}

Above work gives b for 11.
Ok now i see apparently toString does not work within my sequenser code, whatever value i am nolding, "it probably already a decimal string".
So it just send out 11 i tried it in code, well one should never have assumptions about what functions do to code......

 
Posted : 17/06/2021 1:21 pm
Jonas
Posts: 207
Reputable Member
Topic starter
 

Honestly i wondered for years why the code did not work i thought it was the other side interpretating the message wrong.
Well thank you Geoff, i should have checked long, long long time ago.

"It was a numeric string and had to be parseInt before toString(16) LoL"

 
Posted : 17/06/2021 1:36 pm
Share: