Writing Cubase drivers! (new MIDI interface)

Somewhere to chat about MIDI music creation, sequencers and related hardware

Moderators: Mug UK, lotek_style, Moderator Team

User avatar
Foxie
Captain Atari
Captain Atari
Posts: 354
Joined: Wed Feb 03, 2016 7:12 pm

Writing Cubase drivers! (new MIDI interface)

Postby Foxie » Wed Jan 17, 2018 4:22 pm

Does anyone know if any documentation is available on the inner workings of Cubase MIDI drivers? I disassembled one, but it hooks into quite a few things (MROS?) that I can't figure out. I don't have any documentation on MROS.

Why, you ask? Well, I'd like to create a new MIDI interface for the ST. SMP24s and Midexes are getting harder to find (and don't have that many ports anyway). Wouldn't it be nice to have a very inexpensive parallel port device that breaks out 8 outputs, and a few inputs too? With rock-solid timing unlike Mac interfaces.

I have also mostly designed (still need to finish it off) a serial port MIDI interface that uses a software MFP tweak to run at a very high baud rate. It gives you four outputs, with over 100kb/s total bandwidth (much tighter timing than export). If my sequencer project ever gets off the ground I'll support it there. But it would be furtastic if it could work in Cubase too.

And just imagine. With both a parallel port device and a serial port device, you could get a total of 13 outputs on a 1040ST. You could really make the ST the hub of a massive MIDI studio without ugly MIDI thru chains. The only missing link is figuring out how the drivers work.

I did consider cloning the SMP24. This would allow it to work with existing driver software. But that's a whole lot of reverse engineering, and I'd need to track down an SMP24 first. Also, 2 inputs and 4 outputs doesn't satisfy me for the price. A completely clean design would be far better.

User avatar
Atari74user
Captain Atari
Captain Atari
Posts: 297
Joined: Mon Aug 10, 2009 8:00 pm

Re: Writing Cubase drivers! (new MIDI interface)

Postby Atari74user » Wed Jan 17, 2018 8:41 pm

I can't help you on the inner workings of MROS, but here is an old thread with the same idea:

http://www.atari-forum.com/viewtopic.php?t=25067

A new midi expander would always be welcome. Presently I am am fortunate to have a few of those expanders offering a 11 outs (potential of up to 15 which I want to try out now that I am setting my studio up again) with 8 midi ins, however to have a new kid on the block would be a nice addition.
The serial port midi device project is interesting, currently I am utilising an Export for extra midi outs.
Atari Falcon 14mb, 68882, Dual 8gb CF, Steinberg FDI & Analog 8
Atari Jaguar, Rotary controller, Skunkboard & Cat Box
Atari 520STFM 4mb, TOS 2.06 switcher, OverScan, GigaFile, PARCP-USB, Unicorn-USB, System Solutions MiniS HD, SyQuest drives, ICD Link II, PhatBoy MIDI Controller, Philip Rees 5M MIDI merge box, SoundPool MO4, Steinberg MIDEX, SMP II, Emagic Log 3, C-Lab Unitor 2, Combiner & Export expanders

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2371
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: Writing Cubase drivers! (new MIDI interface)

Postby charles » Thu Jan 18, 2018 12:25 am

hey foxie , what languages are you using , asm and c ?
do u have a sequencer written too?
or just some hooks into the os for midi calls?
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!

User avatar
Foxie
Captain Atari
Captain Atari
Posts: 354
Joined: Wed Feb 03, 2016 7:12 pm

Re: Writing Cubase drivers! (new MIDI interface)

Postby Foxie » Thu Jan 18, 2018 1:22 am

Atari74user wrote:I can't help you on the inner workings of MROS, but here is an old thread with the same idea:

http://www.atari-forum.com/viewtopic.php?t=25067


There looks to be some resources there, including an MROS SDK. Thanks ^.^

Not sure if it covers writing drivers yet. I think it's a pretty niche thing.


Atari74user wrote:A new midi expander would always be welcome. Presently I am am fortunate to have a few of those expanders offering a 11 outs (potential of up to 15 which I want to try out now that I am setting my studio up again) with 8 midi ins, however to have a new kid on the block would be a nice addition.


Are you able to use the Log3 in Cubase? I had a look at a picture of the internals of the Log3 and it seems quite simple. A couple of GALs for the dongle (I'm guessing) and a PIC for the MIDI I/O. Could perhaps reverse-engineer the workings of that. The main issue with the Log3 is the cartridge port has no interrupt pin. That's going to affect performance, particularly for MIDI input. Then again, if MROS or Notator just poll it every 0.3ms it won't matter. I feel the parallel port is a nicer solution because of its interrupt pin.

Atari74user wrote:The serial port midi device project is interesting, currently I am utilising an Export for extra midi outs.


There's a possibility I might be able to hack the Export driver to support the new interface. The changes aren't too drastic. I'd need to convert it to use interrupts triggered by the handshaking lines instead of transmit buffer empty. Not sure if MROS even uses transmit interrupts.

One shortcoming of the ST's serial port is it can't support MIDI input. On the other paw, that does simplify driver hacking.

charles wrote:hey foxie , what languages are you using , asm and c ?
do u have a sequencer written too?
or just some hooks into the os for midi calls?


I've mostly used assembly on the ST, but I do a bit of C too. If I write a sequencer, it will be in C (with some assembly for the MIDI I/O handling). I need to learn some more about GEM programming first. I never really got deep into that back in the day - I was more interested in messing around with game development. It would be nice if it were cleanly-written GEM so it runs under MiNT too. Not too sure how feasible that is. I don't think the OS provides too many useful hooks for a sequencer, so I'll probably need to hit the hardware for timers and interrupts.

Even if I do succeed in writing a sequencer, I don't expect a very large audience. So I'd really like to get some Cubase drivers up and running too for those who prefer Cubase. A MIDI interface device without software support is a bit useless!

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2371
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: Writing Cubase drivers! (new MIDI interface)

Postby charles » Thu Jan 18, 2018 2:07 am

well I have a sequencer written and many other midi programs , I do lack in asm and need a timer routine made in asm .
up for it?

I will try to help anyway I can , let me know
im expressing interest because using my midex I found some deal of latency once I got over 32 tracks worth of data...
be nice to see what you have to uncover for us us midi maniacs..
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!

User avatar
Foxie
Captain Atari
Captain Atari
Posts: 354
Joined: Wed Feb 03, 2016 7:12 pm

Re: Writing Cubase drivers! (new MIDI interface)

Postby Foxie » Thu Jan 18, 2018 2:51 am

charles wrote:well I have a sequencer written and many other midi programs , I do lack in asm and need a timer routine made in asm .
up for it?


What sort of thing does it need to do? Just program the MFP timer to interrupt after a certain number of clocks? I'm still deciding how best to implement a sequencer timer. I thought I could use one timer as a programmable one-shot to fire when the next event is due. But then you get accumulated errors due to interrupt handling time. That causes the playback to be slower than intended - a big problem if you're synchronising to something else. So you need another timer keeping count of total elapsed time.

I think some sequencers are much more crude. For instance just interrupting every 1ms and driving all timing from that. Downside is, you get a 1ms jitter on everything. You might be able to crank it up to 0.3ms or faster. You can interrupt the CPU every 0.064ms and lose less than 50% of the CPU time. So I guess it's possible to go faster. The big advantage is you can then just poll all the MIDI ports, no need to handle interrupts specially. As long as you poll faster than 0.3ms (the time of a MIDI byte), you won't lose data.

Another option is to set the timer frequency to the tick frequency of the sequencer. The timer frequency will vary with tempo. But then you have the headache of round-off error and you need to write a routine to handle it. Otherwise you might not be able to set 120.000bpm, only 121.4 or 119.8 for example. You'd also need to handle MIDI input interrupts to avoid losing data because the timer tick might go below 0.3ms for slow tempos. That could be a big problem for Midex type devices which can't give you an interrupt.

I know practically nothing about MiNT. Would a polling timer scheme work under MiNT reliably? What timers does MiNT "own" for its own scheduling?

charles wrote:I will try to help anyway I can , let me know
im expressing interest because using my midex I found some deal of latency once I got over 32 tracks worth of data...
be nice to see what you have to uncover for us us midi maniacs..


Have you managed to drive the Midex from your own code?

I think there does come a point where the 8MHz 68000 is too slow to keep up. How busy are those 32 tracks?

A potential source of slowdown is track scanning. Each time there's a sequencer tick, you might walk through all the tracks to find out which one has the earliest event due next. The more tracks you have, the longer this takes. Maybe you could get around that by putting all the tracks in one giant linked list? It would make editing them an absolute pain, but playback would be faster.

Once I've completed the design of my modem port interface, I'll give you the protocol details in case you want to implement support in your sequencer. ^.^

mikro
Atari God
Atari God
Posts: 1686
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Writing Cubase drivers! (new MIDI interface)

Postby mikro » Thu Jan 18, 2018 9:56 am

Foxie, before starting a joint venture with charles, I'd recommend to read some of the posts he'd made in the past. ;)

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2371
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: Writing Cubase drivers! (new MIDI interface)

Postby charles » Thu Jan 18, 2018 11:24 am

nothing wrong with being a novice is there?

but what id like to see is someone make steem usable with other ports for midi
so if someone installs the serial port driver in Cubase , now we have 16 channels out regular midi port and 16 new channels out the pc's other usb port joystick , or joystick.

so a new driver might be needed for steem too
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12420
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: Writing Cubase drivers! (new MIDI interface)

Postby wongck » Thu Jan 18, 2018 12:07 pm

give the guy a chance
My Stuff: FB/Falcon CT63/CTPCI+ATI+RTL8139+USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

User avatar
Atari74user
Captain Atari
Captain Atari
Posts: 297
Joined: Mon Aug 10, 2009 8:00 pm

Re: Writing Cubase drivers! (new MIDI interface)

Postby Atari74user » Thu Jan 18, 2018 7:54 pm

As far as the Log 3, it cannot be used with Cubase if I remember correctly without checking. Unitor 2 is fine, Export fine, but not the Log 3! I'll double check the weekend, but I am sure there are no MROS drivers for it.
Atari Falcon 14mb, 68882, Dual 8gb CF, Steinberg FDI & Analog 8
Atari Jaguar, Rotary controller, Skunkboard & Cat Box
Atari 520STFM 4mb, TOS 2.06 switcher, OverScan, GigaFile, PARCP-USB, Unicorn-USB, System Solutions MiniS HD, SyQuest drives, ICD Link II, PhatBoy MIDI Controller, Philip Rees 5M MIDI merge box, SoundPool MO4, Steinberg MIDEX, SMP II, Emagic Log 3, C-Lab Unitor 2, Combiner & Export expanders

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2371
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: Writing Cubase drivers! (new MIDI interface)

Postby charles » Thu Jan 18, 2018 11:34 pm

don't get me started or he will have more to read
moody mikro? , its not very encouraging,,, it feels very negative
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!

User avatar
Foxie
Captain Atari
Captain Atari
Posts: 354
Joined: Wed Feb 03, 2016 7:12 pm

Re: Writing Cubase drivers! (new MIDI interface)

Postby Foxie » Fri Jan 19, 2018 4:31 am

charles wrote:but what id like to see is someone make steem usable with other ports for midi


I think you can do this with Hatari already. I haven't tried it. Go to devices, enable RS232 emulation and point it to a MIDI device.

Atari74user wrote:As far as the Log 3, it cannot be used with Cubase if I remember correctly without checking. Unitor 2 is fine, Export fine, but not the Log 3! I'll double check the weekend, but I am sure there are no MROS drivers for it.


I wonder if the reason is down to the dongle? I can imagine there would be NDAs involved in getting the specs back in the day. I thought the dongle part was quite separate to the MIDI output circuitry, but it might not be.

I seem to recall there being a program which would route the ST's BIOS MIDI output to one of the ports on the Log3. Or was that the Unitor? Might be easier to disassemble such a program to figure out what it's doing.

Incidentally, does anyone hardware-inclined know of a faster alternative to the MAX232? I'd rather not deal with the power supply hassles of the MC1488. This would allow me to use a baud rate of 307.2k for the modem port MIDI interface instead of the current 102.4k. It might seem overkill for driving only four ports. But it might be easier to deal with the higher baud rate in MROS. It won't need to poll for very long before it's ready for the next byte. Assuming MROS actually does polling that is. I had a look at the SDK and it looks like it exposes a very simple function call for writing a MIDI byte - and you do need to poll that.

Update - I'm going to use a transistor level shifter with a baker clamp for the data input. The MAX232 is just used for data output and handshaking. It looks like it will be fast enough in simulation.

User avatar
Atari74user
Captain Atari
Captain Atari
Posts: 297
Joined: Mon Aug 10, 2009 8:00 pm

Re: Writing Cubase drivers! (new MIDI interface)

Postby Atari74user » Fri Jan 19, 2018 7:59 am

It could be because of the dongle, but I am sure it doesn't interfere with Cubase plugged in, providing you have a Combiner and have the Cubase dongle inserted on an official Cubase copy. Also, the Log 3 essentially 'replaced' ports B,C and D offered by Export in Notator SL, but in Logic you can use it alongside Export. Now I am sure there are no Log 3 MROS drivers for Cubase, but what I don't think I have tried is if it can use the Export drivers given the way Log 3 works using Notator SL? I don't think so, but I wanted to see with my own eyes this weekend.

Yep, there is a program where you can re-route MIDI for the Emagic / C-Lab interfaces, it is called Director: http://www.notator.org/html/software.html

Again, can't remember if it can re-route to the Log 3, but the suggestion with ports B, C, D, E and F is Export (B, C and D) and Unitor (E and F).

The FAQ section here is useful for information:
http://www.notator.org/html/notator_faq.html
Atari Falcon 14mb, 68882, Dual 8gb CF, Steinberg FDI & Analog 8
Atari Jaguar, Rotary controller, Skunkboard & Cat Box
Atari 520STFM 4mb, TOS 2.06 switcher, OverScan, GigaFile, PARCP-USB, Unicorn-USB, System Solutions MiniS HD, SyQuest drives, ICD Link II, PhatBoy MIDI Controller, Philip Rees 5M MIDI merge box, SoundPool MO4, Steinberg MIDEX, SMP II, Emagic Log 3, C-Lab Unitor 2, Combiner & Export expanders

User avatar
Atari74user
Captain Atari
Captain Atari
Posts: 297
Joined: Mon Aug 10, 2009 8:00 pm

Re: Writing Cubase drivers! (new MIDI interface)

Postby Atari74user » Fri Jan 19, 2018 9:57 pm

So yes indeed, you really cannot use the Log 3 with Cubase as there are no drivers, and Director re-routes MIDI to Unitor and Export only.
Atari Falcon 14mb, 68882, Dual 8gb CF, Steinberg FDI & Analog 8
Atari Jaguar, Rotary controller, Skunkboard & Cat Box
Atari 520STFM 4mb, TOS 2.06 switcher, OverScan, GigaFile, PARCP-USB, Unicorn-USB, System Solutions MiniS HD, SyQuest drives, ICD Link II, PhatBoy MIDI Controller, Philip Rees 5M MIDI merge box, SoundPool MO4, Steinberg MIDEX, SMP II, Emagic Log 3, C-Lab Unitor 2, Combiner & Export expanders

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2371
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: Writing Cubase drivers! (new MIDI interface)

Postby charles » Fri Jan 19, 2018 10:58 pm

foxie:
I think you can do this with Hatari already. I haven't tried it. Go to devices, enable RS232 emulation and point it to a MIDI device.


you try it and tell me how it works , im sorry but im a STEem guy
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!


Return to “MIDI Software and Hardware”

Who is online

Users browsing this forum: No registered users and 2 guests