jean-emmanuel / open-stage-control

Libre and modular OSC / MIDI controller
https://openstagecontrol.ammd.net
GNU General Public License v3.0
720 stars 91 forks source link

[Bug] Possible bug with python/rtmidi ? #572

Closed dpcb0001 closed 5 years ago

dpcb0001 commented 5 years ago
Windows 10
open-stage-control-0.48.2-win32-x64
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
python-rtmidi 1.3.1
>>> os.path.dirname(sys.executable)
'C:\\Program Files (x86)\\Python37-32'

This is very probable that I'm not using the midi options properly but I keep having the following errors in the PowerShell console. Once the errors are printed, o-s-c does start but midi doesn't work.

PS C:\Users\dpcb\Downloads\open-stage-control-0.48.2-win32-x64> .\open-stage-control.exe -m list
PS C:\Users\dpcb\Downloads\open-stage-control-0.48.2-win32-x64>
App available at http://192.168.0.101:8080 & http://127.0.0.1:8080
A JavaScript error occurred in the main process: Uncaught Exception:
Error: spawn py ENOENT
    at exports._errnoException (util.js:1024:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
    at onErrorNT (internal/child_process.js:374:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:607:11)
    at startup (bootstrap_node.js:167:16)
    at bootstrap_node.js:589:3
PS C:\Users\dpcb\Downloads\open-stage-control-0.48.2-win32-x64> .\open-stage-control.exe -m device_name:1,1 path="C:\\Program Files (x86)\\Python37-32"
PS C:\Users\dpcb\Downloads\open-stage-control-0.48.2-win32-x64>
App available at http://192.168.0.101:8080 & http://127.0.0.1:8080
A JavaScript error occurred in the main process: Uncaught Exception:
Error: spawn C:\\Program Files (x86)\\Python37-32 ENOENT
    at exports._errnoException (util.js:1024:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
    at onErrorNT (internal/child_process.js:374:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:607:11)
    at startup (bootstrap_node.js:167:16)
    at bootstrap_node.js:589:3
PS C:\Users\dpcb\Downloads\open-stage-control-0.48.2-win32-x64> .\open-stage-control.exe -m device_name:1,1 path="C:/Program Files (x86)/Python37-32"
PS C:\Users\dpcb\Downloads\open-stage-control-0.48.2-win32-x64>
App available at http://192.168.0.101:8080 & http://127.0.0.1:8080
A JavaScript error occurred in the main process: Uncaught Exception:
Error: spawn C:/Program Files (x86)/Python37-32 ENOENT
    at exports._errnoException (util.js:1024:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
    at onErrorNT (internal/child_process.js:374:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:607:11)
    at startup (bootstrap_node.js:167:16)
    at bootstrap_node.js:589:3
PS C:\Users\dpcb\Downloads\open-stage-control-0.48.2-win32-x64> .\open-stage-control.exe -m device_name:1,1 path="C:\Program Files (x86)\Python37-32"
PS C:\Users\dpcb\Downloads\open-stage-control-0.48.2-win32-x64>
App available at http://192.168.0.101:8080 & http://127.0.0.1:8080
A JavaScript error occurred in the main process: Uncaught Exception:
Error: spawn C:\Program Files (x86)\Python37-32 ENOENT
    at exports._errnoException (util.js:1024:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
    at onErrorNT (internal/child_process.js:374:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:607:11)
    at startup (bootstrap_node.js:167:16)
    at bootstrap_node.js:589:3

In any case, if I close the o-s-c window, the following is printed in the PowerShell window:

Service name is already in use in the network, selecting new one.
Trying with:  MyComputerName_1.local
Service name is already in use in the network, selecting new one.
Trying with:  MyComputerName_1.local

If I don't close the window but instead try to send a midi message using the /note address and the settings from the documentation (push button with address: /note, preArgs: [1, 60], on: 100, off: 0, target: ["midi:device_name"]) I get the following message printed in the PowerShell console:

A JavaScript error occurred in the main process: Uncaught Exception:
Error: This socket is closed
    at Socket._writeGeneric (net.js:721:18)
    at Socket._write (net.js:781:8)
    at doWrite (_stream_writable.js:371:12)
    at writeOrBuffer (_stream_writable.js:357:5)
    at Socket.Writable.write (_stream_writable.js:274:11)
    at Socket.write (net.js:699:40)
    at PythonShell.send (C:\Users\dpcb\Downloads\open-stage-control-0.48.2-win32-x64\resources\app\server\node_modules\python-shell\index.js:285:1)
    at MidiConverter.send (C:\Users\dpcb\Downloads\open-stage-control-0.48.2-win32-x64\resources\app\server\src\server\midi.js:32:1)
    at OscServer.sendOsc (C:\Users\dpcb\Downloads\open-stage-control-0.48.2-win32-x64\resources\app\server\src\server\osc\index.js:157:1)
    at Object.send (C:\Users\dpcb\Downloads\open-stage-control-0.48.2-win32-x64\resources\app\server\src\server\osc\index.js:285:1)

I tried running the rtmidi usage example (https://pypi.org/project/python-rtmidi/) and I do hear the sound produced by Microsoft GS Wavetable Synth but the input midi device created by python-rtmidi doesn't seem to be recognized by the MIDI-OX utility

jean-emmanuel commented 5 years ago

When using the path option in the midi config, you need to pass the full path to the executable file, not just the directory. It should look like path="C:\Program Files (x86)\Python37-32\python3.exe"

dpcb0001 commented 5 years ago

Thanks a lot jean-emmanuel, that was it !

By any chance do you know why o-s-c calls py instead of python when I don't use the path option? python is in my PATH.

Now I don't have errors in PowerShell anymore but the button with settings from the documentation doesn't produce any sound. Whereas a .py file with rtmidi usage example does (https://pypi.org/project/python-rtmidi/). I will investigate more. Thanks again.

EDIT: Also the list option (.\open-stage-control.exe -m list path="C:\Program Files (x86)\Python37-32\python.exe") most often doesn't return anything, although I would have guessed it should because there is always at least the Microsoft GS Wavetable Synth as an output device no?

jean-emmanuel commented 5 years ago

By any chance do you know why o-s-c calls py instead of python when I don't use the path option? python is in my PATH.

The library used to launch python assumes the executable is called this way, unfortunately python installation is very inconsistent accross different windows system. I'll try to make it try both py and python.

I would have guessed it should because there is always at least the Microsoft GS Wavetable Synth as an output device

The issue is documented (https://github.com/thestk/rtmidi/issues/77), I'll try to implement the workaround.