Midi for Mini vMac

About Mini vMac and all other 68k emulators, including SoftMac, Executor, and MESS.

Moderators: Cat_7, Ronald P. Regensburg

jariseon
Space Cadet
Posts: 7
Joined: Sun Nov 03, 2019 9:11 pm

Midi for Mini vMac

Post by jariseon »

Hi, i've implemented a midi bridge for Mini vMac which exposes emulator modem and printer midi ports to the host OS. so far no stuck notes, and sysex seems to work both ways. there's systematic jitter though which needs to be resolved. i can share an experimental OSX build if there's interest ?

here's a screenshot: https://drive.google.com/file/d/17zGJyV ... FHjlKCbWyi
User avatar
adespoton
Forum All-Star
Posts: 3694
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Midi for Mini vMac

Post by adespoton »

Wow! That's great! I can't guarantee when I'll be able to test it, but I'll definitely fire up DMCS and give it a go. I'll also see if I can patch it through to macOS's Bluetooth MIDI stack and see if it'll cooperate with other MIDI devices :)
User avatar
Cat_7
Expert User
Posts: 5646
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Midi for Mini vMac

Post by Cat_7 »

Please do share a link to a build.

Best
Cat_7
User avatar
adespoton
Forum All-Star
Posts: 3694
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Midi for Mini vMac

Post by adespoton »

I just realized: this solution also means that we have a fully working null modem connection between Mini vMac and the host! That means you can connect the two with a terminal emulator like ZTerm to do file transfers, and even *easily* (since the other LocalTalk bits were already added to Mini vMac years ago) put two or more instances on a LocalTalk network, along with the LocalTalk server one of our forum members created a few years back.

So while the MIDI is a huge boon, the other serial features required to make this work mean that there's more that's functioning properly now too :)

Let me know when it's stable enough for me to put it through its paces on macOS (I'm currently running Catalina, but I can run it in any Mac OS needed).

I have dreams of running DMCS on the back end, and patching it into Garage Band via the Audio/MIDI setup :D
jariseon
Space Cadet
Posts: 7
Joined: Sun Nov 03, 2019 9:11 pm

Re: Midi for Mini vMac

Post by jariseon »

uploaded a zipped osx build v01 to https://drive.google.com/open?id=1OJ2GE ... wJXZDvykxM

any feedback/issues most welcome. would really like to turn it into a usable midi resource, thanks for trying it out!

explored most compilation options and ended up with the flags below: MacII target (because of 68020, please use MacII.ROM instead of vMac.ROM), legacy screen resolution as some early apps did not enjoy 16:10 too much, max emulation accuracy just in case, and background mode active by default. it is an unsigned build. unfortunately i've still been unable to tame the jitter. hope to reach paul c. pratt for more insights on where to look.

Code: Select all

-t mc64 -m II -hres 640 -vres 480 -em-cpu 2 -ta 2 -bg 1 -d s -sgn 0
jariseon
Space Cadet
Posts: 7
Joined: Sun Nov 03, 2019 9:11 pm

Re: Midi for Mini vMac

Post by jariseon »

@adespoton: that's a great idea, didn't think about other serial port use cases. it would be pretty easy to open a tcp socket at Mini vMac side to expose raw serial port byte streams (ie. modem/printer in and out sans midi packet parsing).
User avatar
adespoton
Forum All-Star
Posts: 3694
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Midi for Mini vMac

Post by adespoton »

Might be worth posting on Paul's feedback page; I've sent him my debug details that way before, and he's got back to me in reasonably short order :) Of course, posting on here means he'll look at it eventually... but it could be a month or two.
User avatar
gryphel
Nice Guy
Posts: 106
Joined: Sat Nov 17, 2007 6:46 pm

Re: Midi for Mini vMac

Post by gryphel »

From https://www.gryphel.com/c/mail/v9.html#m176:

I can think of two reasons for such jitter. First, OS X is not a real time operating system. The operating system will give Mini vMac time to run when it feels like it. To get uninterrupted output for the emulation of built in sound, there is a buffer that the operating system can get samples from, even if Mini vMac doesn’t get time for a while. (This buffering results in lag, which can be a problem such as for games, so Mini vMac dynamically tries to figure out just how much buffering is needed.) But this is probably not the main issue you are seeing.

Second, Mini vMac emulates an entire tick, about a sixtieth of a second (more accurately 60.15), all at once. If the operating system feels like it and runs Mini vMac exactly on schedule, this will run every sixtieth (about 0.0167 seconds). Your emulated Midi clock events are supposed to happen somewhat less frequently. So in most ticks one event is emulated, but occasionally there are no events in a tick. Which is exactly what you are observing.

The only way to avoid this would be to have the operating system run Mini vMac much more frequently, and each time emulate small pieces of a tick. This would be much less efficient, and it is doubtful whether many operating systems would even allow this.

If possible, a better option is to buffer output, like the emulation of built sound does.
WizKid
Tinkerer
Posts: 72
Joined: Sun Jul 31, 2016 11:58 pm

Re: Midi for Mini vMac

Post by WizKid »

jariseon wrote:uploaded a zipped osx build v01 to https://drive.google.com/open?id=1OJ2GE ... wJXZDvykxM

any feedback/issues most welcome. would really like to turn it into a usable midi resource, thanks for trying it out!

explored most compilation options and ended up with the flags below: MacII target (because of 68020, please use MacII.ROM instead of vMac.ROM), legacy screen resolution as some early apps did not enjoy 16:10 too much, max emulation accuracy just in case, and background mode active by default. it is an unsigned build. unfortunately i've still been unable to tame the jitter. hope to reach paul c. pratt for more insights on where to look.

Code: Select all

-t mc64 -m II -hres 640 -vres 480 -em-cpu 2 -ta 2 -bg 1 -d s -sgn 0
patch against master?
jariseon
Space Cadet
Posts: 7
Joined: Sun Nov 03, 2019 9:11 pm

Re: Midi for Mini vMac

Post by jariseon »

prepared a patch against v36.04 here
build instructions:

Code: Select all

patch -p0 < midivmac.patch
cd minivmac
gcc setup/tool.c -o setuptool
./setuptool -t mc64 -m II -hres 640 -vres 480 -em-cpu 2 -ta 2 -bg 1 -d s -sgn 0 > setup.sh
sh setup.sh
make
Warty
Student Driver
Posts: 12
Joined: Mon Feb 15, 2021 12:41 am

Re: Midi for Mini vMac

Post by Warty »

Resurrecting this post...

I'm working on an app that will (hopefully) let you sync a folder on computer A (modern Mac, eg.) with a a folder on a retro computer (eg, a Mac Plus or 512K) via serial (only), not TCP/ethernet (imagine very slow rsync). Whether or not you think that's a dumb idea, I shrug at thee: I'm having fun doing the coding, and it will be useful to me. If I get it working (which is ambitious enough), my stretch goals include porting to the Amiga, and figuring out how to get it working via WiFi 232.

But what I wondering is: this Midi MinivMac: could this be extended to expose the simulated Mac's modem/printer ports as /dev/tty* devices on the OS X host? SheepShaver does this. I guess in theory Basilisk II does, but I've never got it working in BII. For testing purposes, it would be SUPER nice to have a working simulator that I could talk to my Mac Plus with (on the other end of a serial <> USB adapter). It works with SheepShaver, but I get a lot of crashes in SheepShaver, and anyway, no one with a PPC Mac needs this program, so developing and testing on it is just kind of pointless.
User avatar
adespoton
Forum All-Star
Posts: 3694
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Midi for Mini vMac

Post by adespoton »

Mini vMac already emulates the modem and printer ports, it just has nothing attached to them by default. Building with the LocalTalk flag binds the modem port to some localtalk bridge software. You could easily bind the ports to tty paths; MIDI is special because it also requires a clock.
Warty
Student Driver
Posts: 12
Joined: Mon Feb 15, 2021 12:41 am

Re: Midi for Mini vMac

Post by Warty »

Well I'm not *I* could easily do that, I don't have the foggiest clue how I would do that. Any hints?
User avatar
adespoton
Forum All-Star
Posts: 3694
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Midi for Mini vMac

Post by adespoton »

Warty wrote: Mon Feb 15, 2021 11:47 pm Well I'm not *I* could easily do that, I don't have the foggiest clue how I would do that. Any hints?
You'd have to play with it a bit to figure it out... with the source code and config script, that is. Track down the serial code section, and you should be able to point it at /dev/ttysX instead of /dev/null.
swordlink1
Tinkerer
Posts: 77
Joined: Fri Jul 05, 2019 10:10 pm

Re: Midi for Mini vMac

Post by swordlink1 »

I'm going to be compiling a Windows build of this soon. I have a Linux VM.
If you need more info, tell me ;)
swordlink1
Tinkerer
Posts: 77
Joined: Fri Jul 05, 2019 10:10 pm

Re: Midi for Mini vMac

Post by swordlink1 »

I tried compiling it on Windows x64 but failed!
Image
Info about my system (its actually kubuntu):
Image
If you need more info, tell me ;)
nsputnik
Student Driver
Posts: 17
Joined: Mon Apr 30, 2012 6:52 pm

Re: Midi for Mini vMac

Post by nsputnik »

Is there any way you can make midi i/o happen for QEMU or SheepShaver?
By the way, jariseon thank you so much for this! Ewan Colsell and I have been trying to find someone to build this for over a year!
Let me know how we can support additional efforts in this direction.
nsputnik
Student Driver
Posts: 17
Joined: Mon Apr 30, 2012 6:52 pm

Re: Midi for Mini vMac

Post by nsputnik »

I have a System 5 app I would like to run with this but it freezes on boot up. Any ideas?
Absov
Space Cadet
Posts: 2
Joined: Fri Jan 07, 2022 11:30 pm

Re: Midi for Mini vMac

Post by Absov »

jariseon wrote: Thu Nov 07, 2019 11:41 pm uploaded a zipped osx build v01 to https://drive.google.com/open?id=1OJ2GE ... wJXZDvykxM

any feedback/issues most welcome. would really like to turn it into a usable midi resource, thanks for trying it out!

explored most compilation options and ended up with the flags below: MacII target (because of 68020, please use MacII.ROM instead of vMac.ROM), legacy screen resolution as some early apps did not enjoy 16:10 too much, max emulation accuracy just in case, and background mode active by default. it is an unsigned build. unfortunately i've still been unable to tame the jitter. hope to reach paul c. pratt for more insights on where to look.

Code: Select all

-t mc64 -m II -hres 640 -vres 480 -em-cpu 2 -ta 2 -bg 1 -d s -sgn 0
Thank you very much for your work! I managed to run the Korg Z1 Editor program on your assembly and it correctly controls the synthesizer Korg Z1, receives and transmits data. Now I can control the synthesizer without having to use an old Mac. I also want to try the program for controlling the Yamaha VL70-m synthesizer. Please tell me, could you compile a version with a resolution of at least 1024x768 pixels? It is not very convenient to work in such a small window. Sorry, I haven't mastered the compilation of the emulator yet. Thanks!
Absov
Space Cadet
Posts: 2
Joined: Fri Jan 07, 2022 11:30 pm

Re: Midi for Mini vMac

Post by Absov »

I figured out the compilation of the emulator, and put together a version with a resolution of 1280x800 and with the speed limit disabled. Everything works fine, but there is an oddity with the display of fonts. In the assembly of the respected @jariseon, the fonts on the retina display look clearer. For some reason, mine is more vague, as you can see in this snapshot .
The rest of the assembly functions normally, if anyone needs it - then here it is .
skate323k137
Space Cadet
Posts: 7
Joined: Tue Mar 29, 2022 10:50 pm

Re: Midi for Mini vMac

Post by skate323k137 »

Absov wrote: Fri Jan 07, 2022 11:51 pm
jariseon wrote: Thu Nov 07, 2019 11:41 pm uploaded a zipped osx build v01 to https://drive.google.com/open?id=1OJ2GE ... wJXZDvykxM

any feedback/issues most welcome. would really like to turn it into a usable midi resource, thanks for trying it out!

explored most compilation options and ended up with the flags below: MacII target (because of 68020, please use MacII.ROM instead of vMac.ROM), legacy screen resolution as some early apps did not enjoy 16:10 too much, max emulation accuracy just in case, and background mode active by default. it is an unsigned build. unfortunately i've still been unable to tame the jitter. hope to reach paul c. pratt for more insights on where to look.

Code: Select all

-t mc64 -m II -hres 640 -vres 480 -em-cpu 2 -ta 2 -bg 1 -d s -sgn 0
Thank you very much for your work! I managed to run the Korg Z1 Editor program on your assembly and it correctly controls the synthesizer Korg Z1, receives and transmits data. Now I can control the synthesizer without having to use an old Mac. I also want to try the program for controlling the Yamaha VL70-m synthesizer. Please tell me, could you compile a version with a resolution of at least 1024x768 pixels? It is not very convenient to work in such a small window. Sorry, I haven't mastered the compilation of the emulator yet. Thanks!
Can you please share what MacOS version, extensions, etc? Are you using the Korg midi driver instead of Apple? Are you using Patchbay? I wasn't able to get this going yet in emulation but the Korg 05R/W editor runs on my SE just fine (6.0.8 / korg midi driver / patchbay)

Edit: I have 6.0.8 booting, patchbay looks right (connects korg midi driver and korg sound editor apps properly).

I'm not seeing serial comms, is this hard coded to a certain /dev/tty for modem/printer? Or how exactly is the app communicating serial to the "real" interface?
skate323k137
Space Cadet
Posts: 7
Joined: Tue Mar 29, 2022 10:50 pm

Re: Midi for Mini vMac

Post by skate323k137 »

Update, I looked through the source of the patch (thanks for posting) and realized this is creating a virtual MIDI interface on MacOS.

My main mac unfortunately for this situation is on Catalina, and won't run the good old Midi Patchbay app. But, I am able to see the midi comms now in renoise, so I just need to tie the vmac modem virtual MIDI device to my USB midi output (Roland).

Edit / another update: I'm able now to run Midi Patchbay thanks to someone posting a patched version; I can play midi files to my GM stack from mini vmac now! But, no sysex support :( which breaks the editor functionality.

If someone is able to get 2 virtual MIDI devices connected in osx (audio midi setup does not show them, but renoise and midi patchbay do) with full sysex passthrough, please please please let me know. I would be really happy to get this 05R/W editor working, and would also most likely post a ready to go 6.0.8 HDD image for it if I can get this up and running w/sysex.

I took a couple screen shots to show the korg editor running, with the KORG driver, and the patchbay config, as well as renoise receiving the MIDI (only configured to route channel 1 of that input to an output for testing, but no way to route sysex this way that I've found). Ignore the volume name, it has multiple system folders, 6.0.8 is active.

https://imgur.com/a/vLnQp4x
Last edited by skate323k137 on Wed Mar 30, 2022 10:30 pm, edited 1 time in total.
User avatar
adespoton
Forum All-Star
Posts: 3694
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Midi for Mini vMac

Post by adespoton »

Boy, I wish I could hook up a KORG like I had back in the System 6.0.8 days. Unfortunately, I don't have the hardware anymore.

https://apps.apple.com/us/app/sysex-base/id1004689966 - not sure if this might be of help?

Also, https://help.apple.com/logicpro/mac/9.1 ... tasks=true indicates Logic can be used to pass through the SysEx calls. Can you see them coming out from Mini vMac, or are they just not there at all?
skate323k137
Space Cadet
Posts: 7
Joined: Tue Mar 29, 2022 10:50 pm

Re: Midi for Mini vMac

Post by skate323k137 »

After some more work and searching I found a couple nice tools, namely MIDI monitor, and MIDI patchbay (not to be confused with patchbay in classic MacOS).

It would appear that MIDI patchbay is actually passing everything right. I have the korg editor in vmac sending sysex and it configures parameters on the 05R/W, but the 05R/W is not answering. I have done the reset and config as suggested so I may need to troubleshoot the synth. If I steal the MIDI input on the roland UM ONE MK2, that input makes it back to vmac.

So now I think I'm just troubleshooting why the 05R/W is not responding over MIDI to the app, yet is accepting configs. The impact is I cannot receive any patches from the unit, I can only edit the ones on there. I need some fool proof way to trigger a midi message on the out port of the 05R/W; the manual states demo songs don't send any midi output :(

At this point, how much time do I want to spend? I have a Mac SE that runs the app, but do I want to break out that machine every time I need to restore or save patches? However... I do have at my disposal the tools to go at this the hard way; that working SE, and a saleae logic analyzer that supports MIDI. That's a lot of commitment for an old midi module, but other people have run into this exact issue with modern editors for the 05R/W (no response from the synth) so just maybe the info can be useful for many folks if I can find the time to capture and correlate it.
Last edited by skate323k137 on Fri Apr 01, 2022 2:07 am, edited 1 time in total.
skate323k137
Space Cadet
Posts: 7
Joined: Tue Mar 29, 2022 10:50 pm

Re: Midi for Mini vMac

Post by skate323k137 »

VICTORY, for the most part. I can use the patch editor without constant communication errors. Trying to throw a whole set of patches on there at once will error out, but, you can load several banks and transmit patches one at a time, and edit them in real time :lol:

The Roland UM-One, which is normally my midi output of choice for things like ScummVM, DosBox, etc due to Roland MT-32 and SC-55 support was actually my problem here! The real problem was actually that the UM-One was not passing SYSEX back TO the mac. It has no problem sending sysex out to the whole midi stack (I have an Akai, Yamaha MU, Sound canvas, and this Korg), but, the Korg's sysex was not making it back.

There was only one other person on the entire googles who could match the sysex message from the Korg where I got stuck, and it was here https://ctrlr.org/forums/topic/please-h ... rk/page/3/

I found a way to force test MIDI out on the 05R/W simply by using program dump; the MIDI light on the UM-ONE didn't even blink. So I knew something was definitely off, outside of emulation etc. I removed the plug from MIDI OUT on the 05R/W, and used a spare cheapo HOSA midi USB cable to route MIDI out from the module back to vMac, and much to my surprise and joy, it works. I'm willing to bet with the right interface, I could get the larger data transmission working, but this is major progress and functionally meets my needs for the time being.

Many thanks to everyone who helped, posted compiled builds, etc., this really made my day. I will get around to posting a HDD image soon if that's not against the rules.
Post Reply