Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How send Sysex without Manufactory code? #117

Closed
henriquegmatos opened this issue Jul 29, 2020 · 9 comments
Closed

How send Sysex without Manufactory code? #117

henriquegmatos opened this issue Jul 29, 2020 · 9 comments
Assignees
Labels
Type: support Question regarding usage
Milestone

Comments

@henriquegmatos
Copy link

How to send a Identity Request Message to device? the standard doesnt include the manufactory code. In fact the command is exactly to find out which manufacturer's code is connected to the interface.
In fact, the command is exactly to find out which manufacturer's code is connected to the interface.

I try to use the sendSysex command anyway including some code, 00 for example,

webMidi.sendSysex (0x00, [0x7E, 0x7F, 0x06,0x01])

But the synthesizer never responds. Monitoring the bytes sent to the device I see. F0 00 7E 7F 06 01 F7. And it should be F0 7E 7F 06 01 F7. That is, the command is including one more byte.

Would there be a way to work well without having to use it below?

webMidi.sendSysex (0x7E, [0x7F, 0x06,0x01])

best regards


Universal Non-realtimeSystemExclusive Messages
Identity Request Message

Status Data byte Status
F0H 7EH, dev, 06H, 01H F7H

Byte Explanation
F0H Exclusive status
7EH ID number (Universal Non-realtime Message)
dev Device ID (dev: 10H - 1FH, 7FH)
06H Sub ID#1 (General Information)
01H Sub ID#2 (Identity Request)
F7H EOX (End Of Exclusive)

@djipco djipco self-assigned this Jul 29, 2020
@djipco
Copy link
Owner

djipco commented Jul 29, 2020

This is an interesting problem which I have not yet stumbled upon. As it is currently, the sendSysex() method expects the manufacturer to be specified. I guess this parameter could be made optional... Perhaps a better solution would be to also add a sendIdentityRequest() method to the library. I added that to my todo list for v3.

Meanwhile, you should be able to use the send() method:

WebMidi.outputs[0].send(0xF0, 0x7E, 0x7F, 0x06, 0x01, 0xF7);

Please confirm that the above code works for you. Thank you!

@djipco djipco added the Type: support Question regarding usage label Jul 29, 2020
@henriquegmatos
Copy link
Author

henriquegmatos commented Jul 29, 2020

Hello,

Yes, This method is working ok. As a workaround is ok.

Your idea to create sendIdentityRequest() sounds fine to me.

Thanks.

@djipco
Copy link
Owner

djipco commented Jul 29, 2020

Your idea to create sendIdentityRequest() sounds fine to me.

The idea has been noted in the wiki. It should make it into v3.

Thanks for reporting this use case to me.

Cheers!

@djipco djipco closed this as completed Jul 29, 2020
@djipco djipco added this to the 3.0 milestone Jul 29, 2020
@henriquegmatos
Copy link
Author

henriquegmatos commented Jul 29, 2020

A last question

What is the difference between .send() and .sendSysex?

@djipco
Copy link
Owner

djipco commented Jul 29, 2020

The send() method sends the raw bytes without any special treatment. The sendSysex() method crafts and sends a valid system exclusive message from the specified parameter. For instance, it adds the first and last byte and parses the manufacturer ID which can be 1 or 3 bytes.

@henriquegmatos
Copy link
Author

ahh Ok.

May be .send() could be more flexible to me. I m developing a website to control synths, but it is in POC step. Soon when it is more developing I will present it to you.

If you have or know of a use case for your webmidi.js, I will be pleased to see it.

The big challenge is to ensure that the site will be able to work correctly in all user environments. Windows, MACos, iOS, Android, Chrome, Firefox, Edge, Safari, etc.

Thank you

@henriquegmatos
Copy link
Author

henriquegmatos commented Jul 29, 2020

Let me correct some information.

The .send () method did not work. what worked was to use .sendSysex (0x7E, [0x7F, 0x06,0x01])

Anyway I managed to trick .sendSysex by putting the command in place of the manufacturer's code.

I tried to use .send () in several ways, and they returned the following errors

.send (0xF0, 0x7E, 0x7F, 0x06, 0x01, 0xF7);
Uncaught (in promise) TypeError: Failed to execute 'send' on 'MIDIOutput': System exclusive message is not ended by end of system exclusive message.

.send ([0xF0, 0x7E, 0x7F, 0x06, 0x01, 0xF7]);
webmidi.min.js: 31 Uncaught (in promise) RangeError: The status byte must be an integer between 128 (0x80) and 255 (0xFF).

.send (128, [0xF0, 0x7E, 0x7F, 0x06, 0x01, 0xF7]);
webmidi.min.js: 31 Uncaught (in promise) TypeError: Failed to execute 'send' on 'MIDIOutput': Unexpected status byte at index 1 (240).

@djipco
Copy link
Owner

djipco commented Jul 31, 2020

If you have or know of a use case for your webmidi.js, I will be pleased to see it.

I have started building a list of projets that use WebMidi.js. It is a very incomplete list but gives you an idea of what is possible. You can see them on the Projects Using WebMidi.js page of the wiki.

@djipco
Copy link
Owner

djipco commented Jul 31, 2020

The .send () method did not work. what worked was to use .sendSysex (0x7E, [0x7F, 0x06,0x01])

I made an error in my earlier example. The send() method takes the status byte as its first parameter and an array of data bytes as its second parameter.

In the case of a system exclusive message, the status byte is 0xF0 (240). So, the first parameter must be 0xF0. Then, the second parameter is an array of the bytes you want to send, followed by the termination byte (0xF7):

WebMidi.outputs[0].send(0xF0, [0x7E, 0x7F, 0x06, 0x01, 0xF7]);

Hope this helps.

P.S. When you have usage questions, I encourage you to use the new forum which was set up not long ago. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: support Question regarding usage
Projects
None yet
Development

No branches or pull requests

2 participants