py-midi
py-midi copied to clipboard
Path to serial device
can you provide an example for windows and raspberry pi. I am using loopbe1 midi and trying to send midi messages the issue that I have is conn = MidiConnector('/dev/serial0')
its not clear what we should insert here or how to find the path
I have never worked on Windows so I won't be able to help you here. What you are looking for it the path to the hardware where MIDI signal flows in and out. Maybe this forum post will help?
On UNIX systems, everything is a file, hence a simple path to the appropriate file will get you the route to the hardware your are looking for. On Rasperrypi 3 running on Raspbian, the path to the serial port is /dev/serial0
.
On Windows, serial port are simply named COMx, where X is a number. You can find the right port number by using this snippet (assuming pyserial is installed) :
import serial.tools.list_ports
ports = serial.tools.list_ports.comports()
for port, desc, hwid in sorted(ports):
print("{}: {} [{}]".format(port, desc, hwid))
I'm working on OSX
from midi import MidiConnector
conn = MidiConnector('/dev/ttys0')
looks it doesn't work.
I'm on Windows as well and having issues. Tried the 'Device Instance Path' property of both the internal LoopBe driver and my Launchpad MK2, both throwing SerialExceptions with message 'The system cannot find the path specified'. Above code by @LoicGRENON doesn't output anything.
I'm on Windows as well and having issues. Tried the 'Device Instance Path' property of both the internal LoopBe driver and my Launchpad MK2, both throwing SerialExceptions with message 'The system cannot find the path specified'. Above code by @LoicGRENON doesn't output anything.
I didn't really understand about what you are talking but my code above just displays the available serial COM interfaces on a Windows system. If it doesn't output anything, it means that you don't have any serial COM interface installed on your system or you have insufficient rights to access on it. Please check on the Windows Device Manager (Win+X keys then choose Device Manager) if a serial COM port is available on your system.
hi, I have the same problem, I can't find the way to my midi controller. I am under linux/debian, in the /dev directory I have several files that appear when I plug in my device, including dmmidi3, midi3. my python script returns the following error: serial.serialutil.SerialException: [Errno 16] could not open port /dev/midi3: [Errno 16] Device or resource busy: '/dev/midi3' I have already tried "chmod +x" on the files
serial.serialutil.SerialException: [Errno 16] could not open port /dev/midi3: [Errno 16] Device or resource busy: '/dev/midi3'
This means a process is already using your device.
You can probably get which one by issuing lsof /dev/midi3
As a side note, adding the proper group (I believe it is dialout
on Debian) to your user is better than changing the permissions on the device.