Midi for Mini vMac

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

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
jariseon
Space Cadet
Posts: 5
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: 3555
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: 5545
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: 3555
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: 5
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: 5
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: 3555
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: 5
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: 3555
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: 3555
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: 69
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: 69
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: 15
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: 15
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 .
Post Reply