ojacques/SynthesiaKontrol

MacOSX Installation - msvcrt module

m0tabh opened this issue · 13 comments

MacOS does not have the msvcrt:

$ python3 SynthesiaKontrol.py
Traceback (most recent call last):
File "SynthesiaKontrol.py", line 10, in
from msvcrt import getch
ModuleNotFoundError: No module named 'msvcrt'

I try to fix it changing the "from msvcrt import getch" from SynthesiaKontrol.py to only "import getch"

Hey @ojacques,
thank you very much for taking the time to put this together!
I am too using a Mac, and it seems like there are some Windows-specific libraries.
I'd just like to know if there's any workaround, or if you maybe should update the information to clarify that it doesn't work on MacOS?
And Happy New Year! 🎆 🙏

To me it seems like SynthesiaKontrol.py doesn't need msvcrt. It seems to start when I comment that line out.

However once I do I get:

$ python SynthesiaKontrol.py
Connecting to Komplete Kontrol Keyboard
Traceback (most recent call last):
File "SynthesiaKontrol.py", line 100, in
connected = init()
File "SynthesiaKontrol.py", line 21, in init
device.open(0x17cc, 0x1620)
File "hid.pyx", line 66, in hid.device.open
IOError: open failed

@m0tabh, @lessing, @norbertmocsnik , you are totally right: SynthesiaKontrol.py does not need msvcrt per say. It was left out to handle keypress to exit the program.
I just removed it.

Now, can you all help me with your config? What KK keyboard are you trying to use?

Dear all, I just added support for KK MK2 S88 and KK MK1. Can you try it out and report?
I also removed msvcrt import, which should let it run on MacOS (but untested)

hi i have S8 MK2 + mac mini
and im trying to to build the program but im getting error at "pip install hidapi "
its my first time using python so maybe im doing something wrong
1 - i start with download Python 3.7.3 ( macOS 64-bit installer ) from https://www.python.org/downloads/release/python-373/
2 - i open my Terminal and start type : sudo pip install hidapi ( I tyed sudo because without it i get promotion error )
after that i get a big red error msg

Could not install packages due to an EnvironmentError: 
[('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/private/var/folders/bv/k3trr_310l58f9x824j7k5xw0000gn/T/pip-uninstall-Ug48oi/markers.pyc', "[Errno 1] Operation not permitted: '/private/var/folders/bv/k3trr_310l58f9x824j7k5xw0000gn/T/pip-uninstall-Ug48oi/markers.pyc'"), 
('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/private/var/folders/bv/k3trr_310l58f9x824j7k5xw0000gn/T/pip-uninstall-Ug48oi/__init__.py', "[Errno 1] Operation not permitted: '/private/var/folders/bv/k3trr_310l58f9x824j7k5xw0000gn/T/pip-uninstall-Ug48oi/__init__.py'"), 
('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/private/var/folders/bv/k3trr_310l58f9x824j7k5xw0000gn/T/pip-uninstall-Ug48oi/markers.py', "[Errno 1] Operation not permitted: '/private/var/folders/bv/k3trr_310l58f9x824j7k5xw0000gn/T/pip-uninstall-Ug48oi/markers.py'"), 
('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/private/var/folders/bv/k3trr_310l58f9x824j7k5xw0000gn/T/pip-uninstall-Ug48oi/__init__.pyc', "[Errno 1] Operation not permitted: '/private/var/folders/bv/k3trr_310l58f9x824j7k5xw0000gn/T/pip-uninstall-Ug48oi/__init__.pyc'"), 
('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/private/var/folders/bv/k3trr_310l58f9x824j7k5xw0000gn/T/pip-uninstall-Ug48oi', "[Errno 1] Operation not permitted: '/private/var/folders/bv/k3trr_310l58f9x824j7k5xw0000gn/T/pip-uninstall-Ug48oi'")]

sorry for my noob reply but i hope u can guide me with python because its my first time T_T'

@firecrafts - thanks for the info.
I see something weird in your log: it looks like it is trying to interact with a Python 2.7 install.
Can you try instead: sudo pip3 install hidapi ?

I was able to run the script on macOS, but no lights changed on the S88 MK1. Seemed to have no effect. Not sure where to start on troubleshooting. Any ideas?

I found out that if I run the Komplete Kontrol application in the background, it works. :)

@audionerd - thanks for the report. But help me understand: I think KK has the ability to light notes per midi events.
Are those notes illuminated when using Synthesia? Is this with or without SynthesiaKontrol?
Looking at the code, SynthesiaKontrol looks for a special midi port "LoopBe". But LoopBe1 is not available on MAC - https://www.nerds.de/en/loopbe1.html. So, how did you achieve this?

I'm running the built-in IAC Driver, and I’ve modified SynthesiaKontrol to accept it as a portName. (It might even work if I just name the IAC Driver "LoopBe", but I didn't try that)

Synthesia outputs to IAC MIDI, which outputs to SynthesiaKontrol, which can access the keyboard so long as Komplete Kontrol is running.

With both the Komplete Kontrol app and SynthesiaKontrol running, I'm able to see each keyboard key light up as notes arrive from Synthesia.

There is a bug: often, especially right after multiple notes arrive at the same time, one or more of the lights doesn't appear. So it's not very useful until I can find a way to fix that bug.

I think KK has the ability to light notes per midi events.

I wasn't able to get this to work from Synthesia alone in the past. Maybe there are new instructions for it I haven't seen?

The IAC Driver works for me on a S88 MK2. I had to add 15 to the note value though to make the lights line up with the proper key: LightNote(message.note+15, message.type, message.channel, message.velocity)

Instructions updated in #14 . It also should be good for all known MK1 and MK2 keyboards.
Closing this issue, but don't hesitate to open a new if that's not the case.
And thanks everyone for helping out!