dagargo / microdude

Editor for Arturia MicroBrute

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help on midi ports

the-wasters-of-time opened this issue · comments

Hi dagargo,

I have installed microdude and tried to run the app, but it quits on startup. If I run it from the terminal, I get:

python3  ✔
Python 3.10.8 (main, Oct 13 2022, 21:13:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

from microdude import connector
connector.get_ports()
['MicroBrute:MicroBrute MicroBrute 28:0', 'MicroBrute:MicroBrute MicroBrute MIDI Inte 28:1', 'MicroBrute:MicroBrute MicroBrute 28:0', 'MicroBrute:MicroBrute MicroBrute MIDI Inte 28:1']
c = connector.Connector()
c.connect('MicroBrute:MicroBrute MIDI 1 28:0')
IOError while connecting: "unknown port 'MicroBrute:MicroBrute MIDI 1 28:0'"


I got this far by running sudo modprobe snd-seq-dummy ports=4. Before that I got a bunch of other errors after >>>connector.get ports().

Are you able to help with this error? I'm a relative newb when it comes to linux.

Regards,

Mal Smith.

You shouldn't need the dummy ports.

I'll take a proper look tomorrow but, in the meantime, are you in the audio group? Looks you can list the ports but cannot access them.

$ id -nG
username dialout cdrom [...] audio [...] ibvirt

If not, do this.

sudo adduser username audio

You'll need to restart to apply this change.

Hi dagargo,

Seems to imply that I'm in the audio group:

id -nG
mal sys network power realtime lp audio wheel

Hi dagargo,

Did you have any more ideas as to how to solve my problem?

Regards,

Mal Smith.

Sorry for taking so long to answer.

I took a look at the code and my setup and saw nothing wrong.
However, rereading this, I noticed the port name is.

connector.get_ports()
['MicroBrute:MicroBrute MicroBrute 28:0', 'MicroBrute:MicroBrute MicroBrute MIDI Inte 28:1', 'MicroBrute:MicroBrute MicroBrute 28:0', 'MicroBrute:MicroBrute MicroBrute MIDI Inte 28:1']
c = connector.Connector()
c.connect('MicroBrute:MicroBrute MIDI 1 28:0') 
IOError while connecting: "unknown port 'MicroBrute:MicroBrute MIDI 1 28:0'"

Instead of

'MicroBrute:MicroBrute MIDI 1 28:0,

use

MicroBrute:MicroBrute MicroBrute 28:0

The error is "unknown port 'MicroBrute:MicroBrute MIDI 1 28:0'". Sorry for not seeing this before

OTOH, if you want to manage the sequences, I suggest you to try https://github.com/dagargo/elektroid. There is a GUI and also a CLI in there. In the short term, I'd like to add the MicroBrute setup window there too.

The reason I am running the CLI version of microdude is to try to find out why the GUI version is not working. Your latest suggestion did get it to connect, so thanks for that. However , I then ran into other errors when testing out the example commands. I first tried to get sequence 0, which I assume should be able to get the existing pattern 1:

c.get_sequence(0)
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/connector.py", line 233, in get_sequence
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/connector.py", line 247, in get_sequence_fragment
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/connector.py", line 325, in tx_message
AttributeError: 'NoneType' object has no attribute 'send'

I then tried setting a sequence:

c.set_sequence('7:36xx37x38')
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/connector.py", line 359, in create_set_sequence_messages
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/connector.py", line 378, in create_set_sequence_message
ValueError: invalid literal for int() with base 10: '36xx37x38'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/connector.py", line 226, in set_sequence
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/connector.py", line 366, in create_set_sequence_messages
ValueError: Error in sequences file

Is this an issue with my installed version of Python? BTW, I'm using the Manjaro distro.

This is on a quite fresh Manjaro VM with Python 3.10

This is how I installed the python related packages.

$ pip install mido python-rtmidi setproctitle

The remaining packages were provided by the distro.

It's true that the port names are duplicated but it's working well on my Debian stable.

Let's focus on the get_sequence method.

$ python3
Python 3.10.8 (main, Nov  1 2022, 14:18:21) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from microdude import connector
>>> connector.get_ports()
['MicroBrute:MicroBrute MicroBrute 20:0', 'MicroBrute:MicroBrute MicroBrute MIDI Inte 20:1', 'MicroBrute:MicroBrute MicroBrute 20:0', 'MicroBrute:MicroBrute MicroBrute MIDI Inte 20:1']
>>> c = connector.Connector()
>>> c.connect('MicroBrute:MicroBrute MicroBrute 20:0')
>>> c.get_sequence(6)
'7:57 62 65 69'

It can connect to the MicroBrute and download a sequence.

What rtmidi package did you install? There are 4 packages for rtmidi. See https://pypi.org/search/?q=rtmidi&o=. It must be python-rtmidi.

It looks like I had python-rtmidi. Here is the result:

pip install mido python-rtmidi setproctitle  ✔
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: mido in ./.local/lib/python3.10/site-packages (1.2.10)
Requirement already satisfied: python-rtmidi in ./.local/lib/python3.10/site-packages (1.4.9)
Collecting setproctitle
Downloading setproctitle-1.3.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (30 kB)
Installing collected packages: setproctitle
Successfully installed setproctitle-1.3.2
   ~  python3  ✔
Python 3.10.8 (main, Oct 13 2022, 21:13:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

from microdude import connector
connector.get_ports()
['MicroBrute:MicroBrute MicroBrute 24:0', 'MicroBrute:MicroBrute MicroBrute MIDI Inte 24:1', 'MicroBrute:MicroBrute MicroBrute 24:0', 'MicroBrute:MicroBrute MicroBrute MIDI Inte 24:1']
c = connector.Connector()
c.connect('MicroBrute:MicroBrute MicroBrute 24:0')
c.get_sequence(0)
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/connector.py", line 233, in get_sequence
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/connector.py", line 248, in get_sequence_fragment
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/connector.py", line 345, in rx_message
microdude.connector.ConnectorError: Connection error

So, still not connecting in the CLI. However, I did get a window up on the UI, which is further than I got before, but it still seems to be getting a connection error.

image

Just to be sure that we're facing the same issue from the GUI and the Python module, could you run microdude -v and post here the output?

It's weird. A look at this implies that you're having a timeout issue when requesting a sequence.

File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/connector.py", line 345, in rx_message

def rx_message(self):
try:
for i in range(0, RECEIVE_RETRIES):
for msg in self.port.iter_pending():
if msg.type == 'sysex':
logger.debug('Receiving message %s...',
self.get_hex_data(msg.data))
data_array = []
data_array.extend(msg.data)
return data_array
time.sleep(RETRY_SLEEP_TIME)
except IOError:
self.disconnect()
raise ConnectorError()
self.disconnect()
raise ConnectorError()

So it's either that MicroDude is sending some data and the device isn't replying or there is more general issue when sending -or receiving- the response.

But since the connect method works and is rx_message I'd say there is no general issue.

Please, try this or run microdude -v to see if the connect method is working well.

$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.basicConfig(level=logging.DEBUG)
>>> from microdude import connector
>>> c = connector.Connector()
DEBUG:microdude.connector:Initializing...
>>> c.connect ('MicroBrute:MicroBrute MIDI 1 20:0')
DEBUG:microdude.connector:Connecting to MicroBrute:MicroBrute MIDI 1 20:0...
DEBUG:microdude.connector:Mido backend: <backend mido.backends.rtmidi (loaded)>
DEBUG:microdude.connector:Handshaking...
DEBUG:microdude.connector:Sending message 0x7e, 0x7f, 0x6, 0x1...
DEBUG:microdude.connector:Receiving message 0x7e, 0x1, 0x6, 0x2, 0x0, 0x20, 0x6b, 0x4, 0x0, 0x2, 0x1, 0x1, 0x0, 0x4, 0x0...
DEBUG:microdude.connector:Handshake ok. Version 1.0.4.0.
DEBUG:microdude.connector:Sending message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x0, 0x0, 0x6...
DEBUG:microdude.connector:Receiving message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x0, 0x1, 0x5, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1...

Hi dagargo,

Thanks for staying with this, I would really like to get this working if I can. Below are the results for both methods (I answered 'y' to the zhs messages just in case it helps):

$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.

import logging
logging.basicConfig(level=logging.DEBUG)
from microdude import connector
c = connector.Connector()
DEBUG:microdude.connector:Initializing...
c.connect ('MicroBrute:MicroBrute MIDI 1 20:0')
DEBUG:microdude.connector:Connecting to MicroBrute:MicroBrute MIDI 1 20:0...
DEBUG:microdude.connector:Mido backend: <backend mido.backends.rtmidi (loaded)>
DEBUG:microdude.connector:Handshaking...
DEBUG:microdude.connector:Sending message 0x7e, 0x7f, 0x6, 0x1...
DEBUG:microdude.connector:Receiving message 0x7e, 0x1, 0x6, 0x2, 0x0, 0x20, 0x6b, 0x4, 0x0, 0x2, 0x1, 0x1, 0x0, 0x4, 0x0...
DEBUG:microdude.connector:Handshake ok. Version 1.0.4.0.
DEBUG:microdude.connector:Sending message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x0, 0x0, 0x6...
DEBUG:microdude.connector:Receiving message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x0, 0x1, 0x5, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1...

zsh: correct 'Python' to 'python' [nyae]? y
zsh: correct 'Type' to 'type' [nyae]? y
zsh: parse error near `>'

microdude -v

(microdude:3689): Gtk-CRITICAL **: 11:55:34.370: gtk_assistant_set_page_has_padding: assertion 'child != NULL' failed
DEBUG:microdude.connector:Initializing...
DEBUG:microdude.utils:Reading config file...
DEBUG:microdude.utils:Config file read.
INFO:microdude.editor:Not connected

I just realized that the MicroBrute wasn't switched on. However the result for the first method was the same. The result for the second method is below:

microdude -v  ✔

(microdude:4476): Gtk-CRITICAL **: 12:05:52.335: gtk_assistant_set_page_has_padding: assertion 'child != NULL' failed
DEBUG:microdude.connector:Initializing...
DEBUG:microdude.utils:Reading config file...
DEBUG:microdude.utils:Config file read.
DEBUG:microdude.editor:Adding port MicroBrute:MicroBrute MicroBrute 24:0...
DEBUG:microdude.editor:Port MicroBrute:MicroBrute MicroBrute 24:0 is active
DEBUG:microdude.editor:Adding port MicroBrute:MicroBrute MicroBrute MIDI Inte 24:1...
DEBUG:microdude.editor:Adding port MicroBrute:MicroBrute MicroBrute 24:0...
DEBUG:microdude.editor:Port MicroBrute:MicroBrute MicroBrute 24:0 is active
DEBUG:microdude.editor:Adding port MicroBrute:MicroBrute MicroBrute MIDI Inte 24:1...
DEBUG:microdude.connector:Connecting to MicroBrute:MicroBrute MicroBrute 24:0...
DEBUG:microdude.connector:Mido backend: <backend mido.backends.rtmidi (loaded)>
DEBUG:microdude.connector:Handshaking...
DEBUG:microdude.connector:Sending message 0x7e, 0x7f, 0x6, 0x1...
DEBUG:microdude.connector:Receiving message 0x7e, 0x1, 0x6, 0x2, 0x0, 0x20, 0x6b, 0x4, 0x0, 0x2, 0x1, 0x1, 0x0, 0x0, 0x0...
DEBUG:microdude.connector:Handshake ok. Version 1.0.0.0.
DEBUG:microdude.connector:Sending message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x0, 0x0, 0x6...
DEBUG:microdude.connector:Receiving message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x0, 0x1, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0...
DEBUG:microdude.editor:Loading status...
DEBUG:microdude.connector:Sending message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x1, 0x0, 0x6...
DEBUG:microdude.connector:Receiving message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x1, 0x1, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0...
DEBUG:microdude.connector:Sending message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x2, 0x0, 0x8...
DEBUG:microdude.connector:Receiving message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x2, 0x1, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0...
DEBUG:microdude.connector:Sending message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x3, 0x0, 0x35...
DEBUG:microdude.connector:Receiving message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x3, 0x1, 0x34, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1...
DEBUG:microdude.connector:Sending message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x4, 0x0, 0x10...
DEBUG:microdude.connector:Receiving message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x4, 0x1, 0xf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0...
DEBUG:microdude.connector:Sending message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x5, 0x0, 0x2f...
DEBUG:microdude.connector:Receiving message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x5, 0x1, 0x2e, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1...
DEBUG:microdude.connector:Sending message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x6, 0x0, 0xc...
DEBUG:microdude.connector:Receiving message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x6, 0x1, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0...
DEBUG:microdude.connector:Sending message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x7, 0x0, 0xe...
DEBUG:microdude.connector:Receiving message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x7, 0x1, 0xd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0...
DEBUG:microdude.connector:Sending message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x8, 0x0, 0x12...
DEBUG:microdude.connector:Receiving message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x8, 0x1, 0x11, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0...
DEBUG:microdude.connector:Sending message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x9, 0x0, 0x33...
DEBUG:microdude.connector:Receiving message 0x0, 0x20, 0x6b, 0x5, 0x1, 0x9, 0x1, 0x32, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0...
DEBUG:microdude.connector:Sending message 0x0, 0x20, 0x6b, 0x5, 0x1, 0xa, 0x0, 0x2d...
DEBUG:microdude.connector:Disconnecting...
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/editor.py", line 138, in
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/editor.py", line 247, in set_device
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/editor.py", line 214, in ui_reconnect
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/editor.py", line 277, in set_ui
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/connector.py", line 270, in get_parameter
File "/usr/lib/python3.10/site-packages/MicroDude-2.2-py3.10.egg/microdude/connector.py", line 345, in rx_message
microdude.connector.ConnectorError: Connection error
DEBUG:microdude.editor:Quitting...
DEBUG:microdude.utils:Writing config file...
DEBUG:microdude.utils:Configuration: {'device': 'MicroBrute:MicroBrute MicroBrute 24:0', 'persistent': True}
DEBUG:microdude.utils:Config file written.

Thanks for staying with this, I would really like to get this working if I can. Below are the results for both methods (I answered 'y' to the zhs messages just in case it helps):

Happy to help. 😃

It's definitely weird.

DEBUG:microdude.connector:Handshaking...
DEBUG:microdude.connector:Sending message 0x7e, 0x7f, 0x6, 0x1...
DEBUG:microdude.connector:Receiving message 0x7e, 0x1, 0x6, 0x2, 0x0, 0x20, 0x6b, 0x4, 0x0, 0x2, 0x1, 0x1, 0x0, 0x0, 0x0...
DEBUG:microdude.connector:Handshake ok. Version 1.0.0.0.

Some messages are received and others are not. For instance, the handshake message above is received successfully.

I've noticed that your firmware version is quite old. Last is 1.0.4.0 and fixes all the issues I know of. I totally recommend you to upgrade. Also, perhaps it's the real issue.

MicroDude does not support firmware upgrade so you'll need to use whatever Arturia provides.

Upgrade the firmware and let me know if that helps.

Hi dagargo,

Yes, that was it! The firmware update did the trick. Thank you so much.

Best regards,

Mal.

Anytime!

Closing as solved.