USB MIDI module
Pages: 1 2
Dave Higton (1515) 3526 posts |
Just a quick update on progress. Rick Murray originated a USB MIDI module, and kindly released the source just a few weeks ago. I have been working on updating it, with some significant help from Colin Granville. It is now capable of time stamping MIDI input with a resolution of 1 millisecond, using Timer 1, if Timer 1 exists in the computer. It can now replay MIDI commands with a resolution of 1 millisecond. I am in the process of adding support for up to 4 USB MIDI devices, mimicking what the old Acorn serial MIDI podules did. I am endeavouring to keep the devices in a consistent relationship with the MIDI port number, even if they are re-plugged. At some stage, I will be glad of help from anyone who can test it, especially with multiple MIDI devices. Ultimately it would be satisfying if it became part of the standard distribution of RISC OS. Note, however, that it will only work with RISC OS 5, since the other branches have a very different USB API. I hope that FastTickerV will soon be supported in RISC OS 5, and that it will no longer be necessary to claim Timer 1. More updates when appropriate! |
David Feugey (2125) 2709 posts |
I have multiple MIDI devices. And multiple USB interfaces too. A good one with 1 port and a crappy one with 1 port. |
Rick Murray (539) 13840 posts |
Ditto. ;-)
Don’t concern yourself with that. Older machines already have a number of MIDI solutions. |
Dave Higton (1515) 3526 posts |
Serial MIDI: yes. USB MIDI: not so much. |
David Feugey (2125) 2709 posts |
USB interfaces: not so much either :/ |
Rick Murray (539) 13840 posts |
. /|\ | | What David said… |
Steffen Huber (91) 1953 posts |
I’m sure after finishing USB MIDI Dave will volunteer to implement that Omega USB stack, as well as USB drivers for RPCEmu :-) |
Dave Higton (1515) 3526 posts |
You’re dreaming again, Steffen :-) |
Rick Murray (539) 13840 posts |
They way I see it, you can use old style (serial) MIDI devices with old style (26 bit) machines. As to USB to serial convertors, you’ll probably pay more for one of those than for a Pi and the odds and ends to set it up. |
Dave Higton (1515) 3526 posts |
I’ve clonked in almost all the obvious code related to multiple devices. Whether any of it actually works, though, is entirely another matter. As soon as I can get another USB MIDI device, I’ll start testing. And, bearing in mind that that looks expensive, and I have no reason to actually use this module after I’ve written it, it may be a while. |
Andrew Rawnsley (492) 1445 posts |
Not sure if this is helpful, but MIDI came up when Richard did his talk for the BCS a couple of weeks ago, as Stephen Borrill was also there. He mentioned offering ROD the MIDI source code for open sourcing. However, I’m not clear if he meant Acorn MIDI or the rather more useful MIDISupport/MIDI4 (?) system that Andy @ ESP was involved with. I guess I need to have a chat with him? Let me know if this would be useful in terms of a source release. |
Rick Murray (539) 13840 posts |
He might have meant this (though note the date): |
Ed Smale (7762) 6 posts |
This sounds really interesting. I’m considering buying a new RISC OS machine to use in my MIDI setup, to use with software I have been writing in BASIC and assembler. Currently I’m using an A4000 with the MIDI expansion podule, which works well, but I’d like to get a faster and smaller machine, such as the laptop Andrew Rawnsley demoed at the London Show, as this would be more portable and would look neater during performances. The 1ms resolution improvement would be quite important, I think. My program has two purposes: firstly it receives notes from MIDI IN, and sends them to MIDI OUT on different channels (to give dual-voice and split-keyboard effects). Ideally there would be minimal delay between me pressing a key and it being received and transmitted. The A4000 works well for this. There must of course be some latency, not only in the MIDI transmission etc, but also in my code, but it’s not noticeable. The program also plays back pre-programmed sequences of notes, such as drum beats. It’s not scheduling notes on the MIDI interface though; it is just sending note on/off commands to the MIDI interface for immediate execution, as and when the program determines they are ‘due’. My program uses the MIDI_FastClock SWI for this, but it could use any 1ms clock, not necessarily from MIDI, as long as, when my program sends a MIDI command, it gets transmitted more or less straight away. Is there any significant latency involved with the USB MIDI module, or with USB itself on RISC OS machines? If I do buy a new RISC OS computer, would I be able to download your code and try it? I have got a USB MIDI interface from around 2000, which I’ve used with a Windows PC over the years, called Midiman MIDISport 2×2. I’m not sure whether it falls under the ‘cheap n nasty’ category or not, but I’d be happy to buy something more advanced if necessary, if you could point me in the right direction as to what I should buy. I also have several MIDI keyboards and would be very happy to try the USB MIDI module code out with multiple ports. I could also provide the source code for the sequencer I’m coding if that would be of interest. Thanks :) |
Dave Higton (1515) 3526 posts |
There shouldn’t be. Transmission via USB has a similar latency to sending a complete serial MIDI command. If you send more than one MIDI command at the same time (which you’ll only be able to do by scheduling them, I think), USB wins because they will all go out together, whereas serial requires typically 960 microseconds per command – but that delay is too short to be perceptible to human ears.
Yes. I’ve still got loads of checking and testing to do, but I’d be happy to have some early testers who would be prepared to feed back about anything wrong or missing. |
Ed Smale (7762) 6 posts |
Okay great, sounds like latency wouldn’t be an issue then. That would be amazing to try out an early version. I’d be happy to do some testing and give feedback. At the moment, though, I’m still working out which machine to buy with Andrew’s help. Ideally a laptop but the mini.m might be a suitable alternative if a laptop isn’t available now or in the near future. Anyway thanks for that; I’ll keep you posted. |
Dave Higton (1515) 3526 posts |
I owe you all a quick update. Because of decorating, my Yamaha ME50 and the computers are not in the same room, which has temporarily stopped development of the USB MIDI module. It will be a few weeks before everything is together again and development can restart. |
Ed Smale (7762) 6 posts |
Thanks for the update. For my part I’m not in a rush; I haven’t purchased a computer yet as I’m still deciding which to buy and also waiting on stock availability and the possibility of the laptop machine. I hope to speak with Andrew Rawnsley again at some point, perhaps some time after the Wakefield show as I understand he is busy preparing for that. For now I’m still using an A4000 which is working fine, but longer-term I’d like a smaller, more portable machine that I could take along to rehearsals. Anyway, thanks for working on this. Hopefully I’ll be able to give it a try before too long. |
Jean-Michel BRUCK (3009) 359 posts |
Thanks for the update, and to Rick Murray. I use his module every day on my ARMX6. I have a Steinberg UR22MkII which is a good MIDI interface with a real buffer ( ans also stéréo audio in and out). So I can play lots of notes at the same time without problems. Thanks |
Ed Smale (7762) 6 posts |
Hope the decorating went well Dave :) I’ve finally purchased myself a mini.m (at the London Show today) to replace my A4000, and would love to try and get MIDI working on it. Would it be possible to have a copy of your module to try out? I’m happy to experiment and act as a tester for it if you’re still interested. I’m not sure what format the module takes, is it something you would email? Thanks |
Dave Higton (1515) 3526 posts |
You should have email. If you have, please respond by return; if you haven’t, please respond here. |
Ed Smale (7762) 6 posts |
Thanks for the module Dave. After my initial hangups over email about a tiny bit of latency between an input note being received and immediately transmitted, what I’ve realised is that in practice it doesn’t matter. I’ve been using it intensively for over a month now, and I don’t really notice it. So apologies for moaning about that. It has proved rock-solid for what I’m doing, which is receiving MIDI input from a piano, and transmitting to a sound module. It’s sending large numbers of note and effect events at the same time without any problems. So I’m happily able now to use my new mini.m computer that I bought instead of an old A4000. I’m enjoying the massive speed increase! It makes it much easier to work with. I’ll also be able to take the small computer to rehearsals more easily than the A4000. So thanks to you and Colin Granville for your work on this, and Rick Murray too for the original implementation :) |
Rick Murray (539) 13840 posts |
You’re welcome. ;-) Dave, could you put the module and its source up somewhere so it’s more easily available? |
Dave Higton (1515) 3526 posts |
Firstly, I apologise in a big way to Ed for completely failing to respond to your emails. You should find the source at https://davehigton.me.uk/USBMIDI/USBMIDI.zip Please bear in mind that I haven’t worked on the code for a long time, other than to check just now that it still appears to build under the current Acorn C tools, though I haven’t tested the resulting module to see if it works. If there’s a problem, or if anything’s missing, I’ll see what I can do. |
Dave Higton (1515) 3526 posts |
Rick was concerned about having too much code running on a 1ms tick, and I followed his path. I now think that any modern machine will execute the required bit of code in just a few microseconds, so there really isn’t any point in deferring execution to the next 1cs tick. The changes should be easy, but I’ve got so much to do that’s higher priority to me that I won’t be doing it any time soon. The source is available! |
Rick Murray (539) 13840 posts |
It wasn’t so much the amount of code running in 1ms ticks (reading the MIDI bytes, tagging with a timestamp, and dumping into buffer isn’t a complicated operation), the main problem was the lack of a standard millisecond ticker. That’s why I stuck with the centisecond timer. However, it seems as if your code (browsed it quickly on my phone the other evening) looks for and uses a hardware timer. So, yeah, if that works…
Please, people, remember to update the “Versions” file! ;-) |
Pages: 1 2