USB MIDI Interface

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) :( :o :shock: :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: USB MIDI Interface

Re: USB MIDI Interface

Post by winelight » Wed Aug 05, 2015 11:45 pm

I am guessing (it is only a guess) that it will be similar to 7 and Vista; but at a different location and with a slightly different byte sequence. Next week I may have time to take a look if that will help (and if I remember!).

USB MIDI Interface - W10?

Post by jasmin » Wed Aug 05, 2015 11:02 am

Ok, there's a solution for Vista and W10, what's about W10?

jasmin

Re: USB MIDI Interface

Post by winelight » Mon Jan 19, 2015 10:00 pm

Thanks for that - looks great. I imagine it must be similar on Vista; will do some work on that when I get a chance.

(edit) On Vista the location is different (on mine it was 01f824) and the byte sequence is slightly different too:

3C 08 73 09 C6 86 1E 01 00 00 08

Note the two 08s are in the same relative position.

Re: USB MIDI Interface

Post by Eye » Mon Jan 19, 2015 8:04 pm

I've found a solution for the latency (slow interrupt transfer) problem in Windows 7 32-bit.
You have to patch usbport.sys file. USBPORT_OpenEndpoint() function in the USB port driver limits polling period to 8-32 range. Here is the lower limit checking code:

Code: Select all

00009e18: 3c08            cmp al, 8                    // compare with 8
00009e1a: 7309            jnc loc_00009e25             // skip if greater than or equal to 8
00009e1c: c6831a01000008  mov byte ptr [ebx+11ah], 8   // set interval to 8

So, for example, to change the limit to 1, search for the sequence:
3C 08 73 09 C6 83 1A 01 00 00 08
and change to:
3C 01 73 09 C6 83 1A 01 00 00 01

Tested with usbport.sys 6.1.7601.18251 and .18328 (offset for the sequence = 00009e18).

Warning: Windows 7 allows only signed drivers to be loaded, so you have to sign modified usbport.sys before replacing the original file.
1. copy C:\Windows\System32\drivers\usbport.sys to some folder
2. patch the copy of the file with a hex editor
3. run Driver Signature Enforcement Overrider (DSEO) and enable test mode
4. run DSEO again and sign the patched file (check if the file has changed its size after signing)
5. replace the original usbport.sys with the signed copy (use Se7en File Replacer)


Don't forget to change bInterval values in your project's Interrupt IN/OUT Endpoint Descriptors. bInterval=1 seems to work fine - tested with long sysex dumps.

Re: USB MIDI Interface

Post by winelight » Tue Apr 08, 2014 1:40 pm

There is nothing that can be done on Windows 7. I don't know about Windows 8.

Re: USB MIDI Interface

Post by Fabian » Tue Apr 08, 2014 1:25 pm

Hi,

any improvements of the 8ms problem on windows? I saw tests some pages above with linux, but how is windows performing?

Thank you
Fabian

Re: USB MIDI Interface

Post by winelight » Tue Jun 18, 2013 9:56 pm

Unfortunately that patch only helps mice, I eventually discovered. This is a real problem on Windows and really the only option is to use something else in most cases. Windows XP has a higher polling speed, but the application I run needs a minimum of Windows 7 and ideally Windows 7 64-bit.

Re: USB MIDI Interface

Post by Guest » Tue Jun 18, 2013 9:27 pm

I've used this library to build a little CV/Gate interface and it's working great on OS X (>= 10.6.3+ when they removed the "sanity check" on the poll interval), iOS and Linux, but on windows we are limited by the 8ms poll time. I am wondering if someone has successfully tried to patch system drivers to overcome this limitation - looks like it's a common practice among gamers who want to increase the poll rate of their mice.

Re: USB MIDI Interface

Post by Guest » Mon May 27, 2013 4:13 pm

hello,

how do usb midi work with windows 8?

thx georgiu

Re: USB MIDI Interface

Post by winelight » Mon Jan 14, 2013 12:10 pm

Hi thanks for that. Nice to have it confirmed that I wasn't doing something wrong!

I have my project all working now but the latency is too high. I'm using Windows 7 and know it would be better with Linux and its 2mS poll time, but to be honest I will probably go to a USB hardware solution like the Teensy in the end.

Re: USB MIDI Interface

Post by horo » Wed Jan 02, 2013 6:57 pm

winelight wrote:How many MIDI Event Packets can you send in one go?
...
So I guess I have my answer, but I'd like to know where it's documented please!

Hi winelight,

You're right, two packets with a total of eight bytes is the maximum.
USB MIDI transfers are defined as bulk transfers which are not allowed for low speed devices - but it's possible to change them into interrupt transfers in the device descriptor (see my post above http://forums.obdev.at/viewtopic.php?f=8&t=1352&start=15#p9104).

I've found a very good documentation (USB in a NutShell) which states about package size:
Interrupt Transfers
The maximum data payload size for low-speed devices is 8 bytes.

I've printed the NutShell docs along with the official USB MIDI docs and used them while I developed the VUSB MIDI interface. These papers are now quite crinkled and bear notes in different colors - but hey - the software works.

Ciao, Martin

Re: USB MIDI Interface

Post by winelight » Tue Dec 04, 2012 8:50 pm

Hi everyone

Thanks to everyone who's worked on V-USB and V-USB-MIDI and had posted great tips in this thread and other places. My MIDI project is now working, however, like everyone else I would love it to go faster!

One thing I cannot seem to find an answer on is:

How many MIDI Event Packets can you send in one go?

I've seen:
    Most (nearly all) examples only sending one packet
    A very few examples (and a couple of comments) suggesting two (for a total of 8 bytes) is OK
    Suggestions that you can have multiple packets - although this may only apply to bulk transfers.

Does anyone have a definitive answer please?

(edit) Well I've found by experimentation that if I return two packets, it's fine, but more than that, something somewhere goes wrong.

So I guess I have my answer, but I'd like to know where it's documented please!

Re: USB MIDI Interface

Post by Dex » Fri Jul 27, 2012 8:56 pm

Hi!

This V-USB-MIDI project is great!
I want to make some MIDI controllers with it, but i dont know how to program in other languages than the used in the Arduino IDE...I saw that some guys installed the V-USB library for using it with the Arduino IDE, anyone here knows how to do this with the V-USB_MIDI library?

Thanks in advance!
Dex

Re: USB MIDI Interface

Post by horo » Thu May 31, 2012 10:07 am

Hi,

some days ago I had an email discussion with Philipp (in german) about my hardware, maybe the conclusion will be helpful so I'll give a rough translation:

Q: what does the inductor do?
A: it formes a lowpass together with the two capacitors to filter out noise from 5v usb.

Q: what about 3.3V and 12MHz - aren't you out of spec?
A: I use ATMega16A - the data sheet (figure 27.1, Maximum frequency vs. Vcc) shows that we are slight out of spec at 3.3V but I measured Vcc to be in the range of 3.5..3.8V so it's ok again. I also use ATMega168A which is full in spec (figure 29.1). As these are worst case values over the full temperature range there is sufficent margin (up to 16 MHz).

Warning:
The ATMegas work at incredible low Vcc (<1V), if you use the internal eeprom you MUST set the brown out detection fuses to avoid spurious data corruption due to (slowly) dropping Vcc (I learned it the hard way).

Ciao, Martin

Re: USB MIDI Interface

Post by Dallum » Sat Feb 04, 2012 7:05 am

Sorry for my English, it's not my native language :)

I want to create USB MIDI controller based on this project: http://cryptomys.de/horo/V-USB-MIDI/
But i want to use encoders instead of potentiometers.
I need to get information about controllers position in host to display it on my device.

I know that i should use usbFunctionWriteOut, but don't understand how... Small number of examples does not give the right information about this.
Can somebody give a little piece of code for this function? How can i get this information from "data"?

I try to do this:

Code: Select all

void usbFunctionWriteOut(uchar * data, uchar len)
{

  uchar cable= (*data)
  uchar channel = (*(data+1))
  uchar CC = *(data+2);
 
   if (CC == 77){
         PORTB = 0x00;
    }
}


I expect that if in host control number 77 is changed then my LEDs are light up. That's don't work.
Where is my mistake?

Thanks.
Evgeny

Top