Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SysEx messages #55

Open
dagargo opened this issue Apr 29, 2024 · 32 comments
Open

Add support for SysEx messages #55

dagargo opened this issue Apr 29, 2024 · 32 comments
Assignees
Milestone

Comments

@dagargo
Copy link
Owner

dagargo commented Apr 29, 2024

SysEx messages are ignored by Overwitch.

@dagargo
Copy link
Owner Author

dagargo commented May 4, 2024

The code for this issue is in the feat-add-sysex branch.

Until now, Overwitch was ignoring the SysEx messages flowing both ways but now these messages are processed too.

AFAIK, the MIDI events in Overbridge follow the same specification as the USB MIDI one. This means that messages are always 4 byte packets where the first byte indicates the type of message. Messages with less than 3 bytes use less bytes but the packet itself has still 4 bytes. SysEx messages are split into many of these packets. Overbridge sends this packets in blocks of 512 bytes (128 messages at most) in each USB MIDI block.

So these conversions need to be done in both directions and this is our goal here.

In order to mix JACK (or PipeWire) messages with the MIDI ports that Elektroid uses, the snd-virmidi Linux module is used.

This is the result.

qpwgraph capture

Keep in mind that adding all this things and using long SysEx messages might impact the latency of MIDI messages.

Although it works, some MIDI messages are lost.

$ elektroid-cli -vv elektron-data-ls 3:/soundbanks/A
DEBUG:elektroid-cli.c:833:(main): Connector: "elektron"; filesystem: "data"; operation: "ls"
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:1 (name 'Virtual Raw MIDI', subname '')...
[...]
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:1 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend.c:306:(backend_init): Initializing backend (ALSA) to 'hw:1,0,2'...
DEBUG:backend_alsa.c:84:(backend_init_int): Setting blocking mode...
DEBUG:backend.c:626:(backend_rx_drain): Draining buffers...
DEBUG:backend.c:395:(backend_rx_raw_loop): Timeout (1000)
DEBUG:backend.c:317:(backend_init): Stopping device...
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (6): f0 7e 7f 06 01 f7
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (6): f0 7e 00 7c 00 f7
DEBUG:backend.c:144:(backend_midi_handshake): Illegal SUB-ID2
DEBUG:connector.c:178:(connector_init_backend): Testing elektron connector...
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (13): f0 00 20 3c 10 00 00 00 00 00 00 01 f7
DEBUG:connectors/elektron.c:751:(elektron_tx): Message sent (5): 00 00 00 00 01
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (75): f0 00 20 3c 10 00 04 00 19 00 00 01 0c 2b 00 01 02 03 05 04 06 07 00 50 52 51 10 13 11 12 00 20 21 22 23 28 30 31 00 32 36 40 41 42 46 17 00 18 19 29 53 54 55 56 00 57 58 59 5a 5b 5c 5d 00 5e...
DEBUG:connectors/elektron.c:796:(elektron_rx): Message received (59): 00 19 00 00 81 0c 2b 01 02 03 05 04 06 07 50 52 51 10 13 11 12 20 21 22 23 28 30 31 32 36 40 41 42 46 17 18 19 29 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 44 69 67 69 74 61 6b 74 00
DEBUG:connectors/elektron.c:3158:(elektron_configure_device): Failed to open file “/home/david/.config/elektroid/elektron/devices.json”: No such file or directory
DEBUG:connectors/elektron.c:3164:(elektron_configure_device): Falling back to /usr/local/share/elektroid/elektron/devices.json...
DEBUG:connectors/elektron.c:3223:(elektron_configure_device): Device 12 found
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (13): f0 00 20 3c 10 00 00 00 01 00 00 02 f7
DEBUG:connectors/elektron.c:751:(elektron_tx): Message sent (5): 00 01 00 00 02
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (26): f0 00 20 3c 10 00 04 00 1a 00 01 02 30 30 00 38 39 00 31 2e 35 31 00 41 00 f7
DEBUG:connectors/elektron.c:796:(elektron_rx): Message received (16): 00 1a 00 01 82 30 30 38 39 00 31 2e 35 31 41 00
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (13): f0 00 20 3c 10 00 00 00 02 00 00 03 f7
DEBUG:connectors/elektron.c:751:(elektron_tx): Message sent (5): 00 02 00 00 03
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (18): f0 00 20 3c 10 00 06 00 1b 00 02 03 09 5c 60 0e 38 f7
DEBUG:connectors/elektron.c:796:(elektron_rx): Message received (9): 00 1b 00 02 83 89 5c 8e b8
DEBUG:connectors/elektron.c:3372:(elektron_handshake): UID: b88e5c89
DEBUG:connector.c:182:(connector_init_backend): Using elektron connector...
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (39): f0 00 20 3c 10 00 00 00 03 00 00 53 2f 73 00 6f 75 6e 64 62 61 6e 00 6b 73 2f 41 00 00 00 00 00 00 00 00 00 00 01 f7
DEBUG:connectors/elektron.c:751:(elektron_tx): Message sent (28): 00 03 00 00 53 2f 73 6f 75 6e 64 62 61 6e 6b 73 2f 41 00 00 00 00 00 00 00 00 00 01
DEBUG:backend.c:395:(backend_rx_raw_loop): Timeout (5000)
DEBUG:backend.c:332:(backend_destroy): Destroying backend...
DEBUG:backend.c:223:(backend_destroy_data): Destroying backend data...
ERROR:elektroid-cli.c:897:(main): Error: Input/output error

Despite of being lost, this are received by the JACK client. This can be seen in the log. The full SysEx message is there and is queued without errors.

DEBUG:jclient.c:323:(jclient_o2j_midi): o2j: F0 MIDI message processed @ 53 (1643): f0 00 20 3c 10 00 04 00 1c 00 03 53 01 00 00 00 00 00 00 00 00 41 00 00 00 00 40 53 4e 41 00 52 45 20 4a 41 59 00 00 00 02 00 00 00 01 00 10 00 00 20 00 12 01 01 00 4d 4f 56 45 4d 45 4e 00 54 00 00 02 00 00 00 04 02 00 00 00 20 00 12 00 01 01 52 45 56 48 41 00 54 00 00 02 00 00 00 04 03 00 00 00 20 00 12 00 01 01 53 49 4e 45 4b 00 49 4b 00 00 02 00 00 02 00 04 00 00 00 20 00 00 12 01 01 53 49 4e 45 00 44 4f 4e 47 00 00 02 00 00 00 00 05 00 00 00 40 20 00 12 01 01 4f 42 00 45 4e 00 00 02 00 00 02 00 06 00 00 00 20 00 00 12 01 01 47 55 49 4c 00 54 59 00 00 02 00 00 02 00 07 00 00 00 20 00 00 12 01 01 54 48 45 42 00 41 53 53 00 00 02 00 01 00 00 08 00 00 00 20 00 00 12 01 01 54 48 45 00 53 59 4e 54 48 00 00 00 02 00 00 00 09 00 00 20 00 20 00 12 01 01 41 00 43 49 44 00 00 02 00 01 00 00 0a 00 00 00 20 00 00 12 01 01 42 52 55 00 53 48 53 4e 41 52 45 00 00 00 02 00 00 00 0b 08 00 00 00 20 00 12 01 00 01 48 45 41 56 59 4b 00 49 43 4b 00 00 02 00 01 00 00 0c 00 00 00 20 00 00 12 01 01 42 4f 55 00 4e 43 45 00 00 02 00 01 00 00 0d 00 00 00 20 00 00 12 01 01 44 52 4f 00 4e 45 00 00 02 00 00 02 00 0e 00 00 00 20 00 00 12 01 01 4e 41 53 54 00 59 42 41 53 53 00 00 00 02 00 00 00 0f 00 00 20 00 20 00 12 01 01 52 00 45 56 4b 49 4b 00 00 00 02 00 00 00 10 00 00 20 00 20 00 12 01 01 42 00 49 54 4b 49 4b 00 00 00 02 00 00 00 11 00 00 20 00 20 00 12 01 01 41 00 4c 41 52 4d 00 00 02 00 00 00 00 12 00 00 00 40 20 00 12 01 01 53 57 00 45 45 54 50 41 44 00 00 00 02 00 00 00 13 00 10 00 00 20 00 12 01 01 00 42 4f 58 45 44 00 00 00 02 00 00 00 14 00 00 20 00 20 00 12 01 01 42 00 41 42 41 4c 4f 47 00 00 00 02 00 00 00 15 00 10 00 00 20 00 12 01 01 00 45 52 52 4f 4c 00 00 00 02 00 00 00 16 00 00 20 00 20 00 12 01 01 4b 00 56 41 43 4b 20 42 44 00 00 00 02 00 00 00 17 08 00 00 00 20 00 12 01 00 01 44 4a 55 50 20 42 00 44 00 00 02 00 00 00 04 18 00 00 00 20 00 12 00 01 01 46 4d 20 52 53 00 00 00 02 00 00 00 19 08 00 00 00 20 00 12 01 00 01 53 4c 41 50 20 43 00 50 00 00 02 00 00 00 04 1a 00 00 00 20 00 12 00 01 01 54 49 4e 4e 59 00 20 43 42 00 00 02 00 01 00 00 1b 00 00 00 20 00 00 12 01 01 4c 49 54 00 45 4e 20 48 48 00 00 00 02 00 00 00 1c 00 00 20 00 20 00 12 01 01 53 00 50 52 45 41 44 20 48 00 48 00 00 02 00 00 00 04 1d 00 00 00 20 00 12 08 01 01 4c 45 47 20 43 00 59 00 00 02 00 00 00 04 1e 00 00 00 20 00 12 00 01 01 4e 49 43 45 20 00 53 44 00 00 02 00 00 02 00 1f 00 00 00 20 00 00 12 01 01 46 4d 20 4b 00 4c 4f 4e 4b 20 54 4f 00 4d 00 00 02 00 00 00 04 20 00 00 00 20 00 12 00 01 01 53 4e 41 50 50 00 59 20 53 44 00 00 02 00 00 00 00 21 00 00 00 40 20 00 12 01 01 44 4f 00 4e 4b 44 20 54 4f 4d 00 00 00 02 00 00 00 22 08 00 00 00 20 00 12 01 00 01 46 41 54 20 53 49 00 4e 45 20 42 44 00 00 00 02 00 00 00 23 00 00 20 00 20 00 12 01 01 42 00 49 54 54 45 52 20 53 00 44 00 00 02 00 00 00 04 24 00 00 00 20 00 12 00 01 01 53 49 4e 45 44 00 20 48 48 00 00 02 00 01 00 00 25 00 00 00 20 00 00 12 01 01 48 41 54 00 20 48 48 00 00 02 00 01 00 00 26 00 00 00 20 00 00 12 01 01 53 54 45 00 52 45 4f 20 53 51 55 00 41 52 45 00 00 02 00 01 00 00 27 00 00 00 20 00 00 12 01 01 46 4d 20 00 54 4f 4d 00 00 02 00 01 00 00 28 00 00 00 20 00 00 12 01 01 4e 4f 49 00 53 45 20 43 50 00 00 00 02 00 00 00 29 00 00 20 00 20 00 12 01 01 54 00 4f 4d 4b 49 4b 00 00 00 02 00 00 00 2a 00 00 20 00 20 00 12 01 01 4c 00 41 4e 44 49 4e 47 00 00 00 02 00 00 00 2b 00 10 00 00 20 00 12 01 01 00 55 50 4c 49 46 54 00 00 00 02 00 00 00 2c 00 10 00 00 20 00 12 01 01 00 46 4c 41 53 48 42 41 00 43 4b 00 00 02 00 00 02 00 2d 00 00 00 20 00 00 12 01 01 44 49 52 54 00 59 00 00 02 00 00 00 04 2e 00 00 00 20 00 12 00 01 01 4a 55 4d 50 00 00 00 02 00 00 00 2f 00 10 00 00 20 00 12 01 01 00 44 49 53 54 55 52 42 00 00 00 02 00 00 00 30 08 00 00 00 20 00 12 01 00 01 53 50 4f 54 00 00 00 02 00 00 00 31 00 00 20 00 20 00 12 01 01 50 00 55 52 45 4e 45 53 53 00 00 00 02 00 00 00 32 08 00 00 00 20 00 12 01 00 01 53 4c 4f 57 54 49 00 4d 45 00 00 02 00 00 02 00 33 00 00 00 20 00 00 12 01 01 43 52 45 45 00 50 00 00 02 00 00 00 04 34 00 00 00 20 00 12 00 01 01 42 55 42 42 4c 00 45 00 00 02 00 00 00 04 35 00 00 00 20 00 12 00 01 01 43 41 56 45 00 00 00 02 00 00 00 36 00 10 00 00 20 00 12 01 01 00 46 4f 4c 4c 4f 57 00 00 00 02 00 00 00 37 00 10 00 00 20 00 12 01 01 00 4c 4f 57 44 49 52 54 00 00 00 02 00 00 00 38 08 00 00 00 20 00 12 01 00 01 48 49 50 53 4e 41 00 52 45 00 00 02 00 00 02 00 39 00 00 00 20 00 00 12 01 01 52 45 56 4c 00 49 46 45 00 00 02 00 01 00 00 3a 00 00 00 20 00 00 12 01 01 44 45 53 00 50 41 49 52 00 00 02 00 00 00 00 3b 00 00 00 40 20 00 12 01 01 43 55 00 54 45 00 00 02 00 00 02 00 3c 00 00 00 20 00 00 12 01 01 43 52 55 4e 00 43 48 00 00 02 00 00 02 00 3d 00 00 00 20 00 00 12 01 01 47 41 4d 45 00 4c 41 4e 00 00 02 00 01 00 00 3e 00 00 00 20 00 00 12 01 01 56 49 42 00 52 41 4c 49 42 52 41 00 00 00 02 00 00 00 3f 08 00 00 00 20 00 12 01 00 01 4e 4f 54 41 4c 4f 00 4e 45 00 00 02 00 00 02 00 40 00 00 00 20 00 00 12 01 01 f7

I suspect the problem is either in the PipeWire bridge or in the snd-virmidi module.

@dagargo
Copy link
Owner Author

dagargo commented May 4, 2024

I can confirm that the issue is not in Overwitch.

When using pw-mididump and connecting its port this way, the message is there.

qpwgraph

$ pw-mididump 
  15: track: 0 sec:4,984313 SysEx: f0 7e 00 7c 00 f7 
  22: track: 0 sec:5,041791 SysEx: f0 00 20 3c 10 00 04 00 05 00 00 01 0c 2b 00 01 02 03 05 04 06 07 00 50 52 51 10 13 11 12 00 20 21 22 23 28 30 31 00 32 36 40 41 42 46 17 00 18 19 29 53 54 55 56 00 57 58 59 5a 5b 5c 5d 00 5e 44 69 67 69 74 61 00 6b 74 00 f7 
  15: track: 0 sec:5,097646 SysEx: f0 00 20 3c 10 00 04 00 06 00 01 02 30 30 00 38 39 00 31 2e 35 31 00 41 00 f7 
  44: track: 0 sec:5,152916 SysEx: f0 00 20 3c 10 00 06 00 07 00 02 03 09 5c 60 0e 38 f7 
  47: track: 0 sec:5,248979 SysEx: f0 00 20 3c 10 00 04 00 08 00 03 53 01 00 00 00 00 00 00 00 00 41 00 00 00 00 40 53 4e 41 00 52 45 20 4a 41 59 00 00 00 02 00 00 00 01 00 10 00 00 20 00 12 01 01 00 4d 4f 56 45 4d 45 4e 00 54 00 00 02 00 00 00 04 02 00 00 00 20 00 12 00 01 01 52 45 56 48 41 00 54 00 00 02 00 00 00 04 03 00 00 00 20 00 12 00 01 01 53 49 4e 45 4b 00 49 4b 00 00 02 00 00 02 00 04 00 00 00 20 00 00 12 01 01 53 49 4e 45 00 44 4f 4e 47 00 00 02 00 00 00 00 05 00 00 00 40 20 00 12 01 01 4f 42 00 45 4e 00 00 02 00 00 02 00 06 00 00 00 20 00 00 12 01 01 47 55 49 4c 00 54 59 00 00 02 00 00 02 00 07 00 00 00 20 00 00 12 01 01 54 48 45 42 00 41 53 53 00 00 02 00 01 00 00 08 00 00 00 20 00 00 12 01 01 54 48 45 00 53 59 4e 54 48 00 00 00 02 00 00 00 09 00 00 20 00 20 00 12 01 01 41 00 43 49 44 00 00 02 00 01 00 00 0a 00 00 00 20 00 00 12 01 01 42 52 55 00 53 48 53 4e 41 52 45 00 00 00 02 00 00 00 0b 08 00 00 00 20 00 12 01 00 01 48 45 41 56 59 4b 00 49 43 4b 00 00 02 00 01 00 00 0c 00 00 00 20 00 00 12 01 01 42 4f 55 00 4e 43 45 00 00 02 00 01 00 00 0d 00 00 00 20 00 00 12 01 01 44 52 4f 00 4e 45 00 00 02 00 00 02 00 0e 00 00 00 20 00 00 12 01 01 4e 41 53 54 00 59 42 41 53 53 00 00 00 02 00 00 00 0f 00 00 20 00 20 00 12 01 01 52 00 45 56 4b 49 4b 00 00 00 02 00 00 00 10 00 00 20 00 20 00 12 01 01 42 00 49 54 4b 49 4b 00 00 00 02 00 00 00 11 00 00 20 00 20 00 12 01 01 41 00 4c 41 52 4d 00 00 02 00 00 00 00 12 00 00 00 40 20 00 12 01 01 53 57 00 45 45 54 50 41 44 00 00 00 02 00 00 00 13 00 10 00 00 20 00 12 01 01 00 42 4f 58 45 44 00 00 00 02 00 00 00 14 00 00 20 00 20 00 12 01 01 42 00 41 42 41 4c 4f 47 00 00 00 02 00 00 00 15 00 10 00 00 20 00 12 01 01 00 45 52 52 4f 4c 00 00 00 02 00 00 00 16 00 00 20 00 20 00 12 01 01 4b 00 56 41 43 4b 20 42 44 00 00 00 02 00 00 00 17 08 00 00 00 20 00 12 01 00 01 44 4a 55 50 20 42 00 44 00 00 02 00 00 00 04 18 00 00 00 20 00 12 00 01 01 46 4d 20 52 53 00 00 00 02 00 00 00 19 08 00 00 00 20 00 12 01 00 01 53 4c 41 50 20 43 00 50 00 00 02 00 00 00 04 1a 00 00 00 20 00 12 00 01 01 54 49 4e 4e 59 00 20 43 42 00 00 02 00 01 00 00 1b 00 00 00 20 00 00 12 01 01 4c 49 54 00 45 4e 20 48 48 00 00 00 02 00 00 00 1c 00 00 20 00 20 00 12 01 01 53 00 50 52 45 41 44 20 48 00 48 00 00 02 00 00 00 04 1d 00 00 00 20 00 12 08 01 01 4c 45 47 20 43 00 59 00 00 02 00 00 00 04 1e 00 00 00 20 00 12 00 01 01 4e 49 43 45 20 00 53 44 00 00 02 00 00 02 00 1f 00 00 00 20 00 00 12 01 01 46 4d 20 4b 00 4c 4f 4e 4b 20 54 4f 00 4d 00 00 02 00 00 00 04 20 00 00 00 20 00 12 00 01 01 53 4e 41 50 50 00 59 20 53 44 00 00 02 00 00 00 00 21 00 00 00 40 20 00 12 01 01 44 4f 00 4e 4b 44 20 54 4f 4d 00 00 00 02 00 00 00 22 08 00 00 00 20 00 12 01 00 01 46 41 54 20 53 49 00 4e 45 20 42 44 00 00 00 02 00 00 00 23 00 00 20 00 20 00 12 01 01 42 00 49 54 54 45 52 20 53 00 44 00 00 02 00 00 00 04 24 00 00 00 20 00 12 00 01 01 53 49 4e 45 44 00 20 48 48 00 00 02 00 01 00 00 25 00 00 00 20 00 00 12 01 01 48 41 54 00 20 48 48 00 00 02 00 01 00 00 26 00 00 00 20 00 00 12 01 01 53 54 45 00 52 45 4f 20 53 51 55 00 41 52 45 00 00 02 00 01 00 00 27 00 00 00 20 00 00 12 01 01 46 4d 20 00 54 4f 4d 00 00 02 00 01 00 00 28 00 00 00 20 00 00 12 01 01 4e 4f 49 00 53 45 20 43 50 00 00 00 02 00 00 00 29 00 00 20 00 20 00 12 01 01 54 00 4f 4d 4b 49 4b 00 00 00 02 00 00 00 2a 00 00 20 00 20 00 12 01 01 4c 00 41 4e 44 49 4e 47 00 00 00 02 00 00 00 2b 00 10 00 00 20 00 12 01 01 00 55 50 4c 49 46 54 00 00 00 02 00 00 00 2c 00 10 00 00 20 00 12 01 01 00 46 4c 41 53 48 42 41 00 43 4b 00 00 02 00 00 02 00 2d 00 00 00 20 00 00 12 01 01 44 49 52 54 00 59 00 00 02 00 00 00 04 2e 00 00 00 20 00 12 00 01 01 4a 55 4d 50 00 00 00 02 00 00 00 2f 00 10 00 00 20 00 12 01 01 00 44 49 53 54 55 52 42 00 00 00 02 00 00 00 30 08 00 00 00 20 00 12 01 00 01 53 50 4f 54 00 00 00 02 00 00 00 31 00 00 20 00 20 00 12 01 01 50 00 55 52 45 4e 45 53 53 00 00 00 02 00 00 00 32 08 00 00 00 20 00 12 01 00 01 53 4c 4f 57 54 49 00 4d 45 00 00 02 00 00 02 00 33 00 00 00 20 00 00 12 01 01 43 52 45 45 00 50 00 00 02 00 00 00 04 34 00 00 00 20 00 12 00 01 01 42 55 42 42 4c 00 45 00 00 02 00 00 00 04 35 00 00 00 20 00 12 00 01 01 43 41 56 45 00 00 00 02 00 00 00 36 00 10 00 00 20 00 12 01 01 00 46 4f 4c 4c 4f 57 00 00 00 02 00 00 00 37 00 10 00 00 20 00 12 01 01 00 4c 4f 57 44 49 52 54 00 00 00 02 00 00 00 38 08 00 00 00 20 00 12 01 00 01 48 49 50 53 4e 41 00 52 45 00 00 02 00 00 02 00 39 00 00 00 20 00 00 12 01 01 52 45 56 4c 00 49 46 45 00 00 02 00 01 00 00 3a 00 00 00 20 00 00 12 01 01 44 45 53 00 50 41 49 52 00 00 02 00 00 00 00 3b 00 00 00 40 20 00 12 01 01 43 55 00 54 45 00 00 02 00 00 02 00 3c 00 00 00 20 00 00 12 01 01 43 52 55 4e 00 43 48 00 00 02 00 00 02 00 3d 00 00 00 20 00 00 12 01 01 47 41 4d 45 00 4c 41 4e 00 00 02 00 01 00 00 3e 00 00 00 20 00 00 12 01 01 56 49 42 00 52 41 4c 49 42 52 41 00 00 00 02 00 00 00 3f 08 00 00 00 20 00 12 01 00 01 4e 4f 54 41 4c 4f 00 4e 45 00 00 02 00 00 02 00 40 00 00 00 20 00 00 12 01 01 f7 

Running elektroid-cli this way can make things clearer.

$ elektroid-cli -vv elektron-data-ls 3:/soundbanks/A 2>&1 | grep "Raw message"
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (6): f0 7e 7f 06 01 f7
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (6): f0 7e 00 7c 00 f7
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (13): f0 00 20 3c 10 00 00 00 00 00 00 01 f7
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (75): f0 00 20 3c 10 00 04 00 15 00 00 01 0c 2b 00 01 02 03 05 04 06 07 00 50 52 51 10 13 11 12 00 20 21 22 23 28 30 31 00 32 36 40 41 42 46 17 00 18 19 29 53 54 55 56 00 57 58 59 5a 5b 5c 5d 00 5e...
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (13): f0 00 20 3c 10 00 00 00 01 00 00 02 f7
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (26): f0 00 20 3c 10 00 04 00 16 00 01 02 30 30 00 38 39 00 31 2e 35 31 00 41 00 f7
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (13): f0 00 20 3c 10 00 00 00 02 00 00 03 f7
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (18): f0 00 20 3c 10 00 06 00 17 00 02 03 09 5c 60 0e 38 f7
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (39): f0 00 20 3c 10 00 00 00 03 00 00 53 2f 73 00 6f 75 6e 64 62 61 6e 00 6b 73 2f 41 00 00 00 00 00 00 00 00 00 00 01 f7

The 5th message has no response but pw-mididump shows it's there.

@szszoke
Copy link

szszoke commented May 6, 2024

I didn't even get as far as you did so I did a sanity check.

sudo modprobe snd-virmidi enable=1 midi_devs=1

Run pw-mididump and connect it to the virtual MIDI device via Helvum or Qpwgraph.

Open Ardour in Jack mode and select the virtual MIDI port in the MIDI tracer (Window > MIDI tracer).

(replace XX with your HW identifier)

amidi -p hw:XX -S "fc"
amidi -p hw:XX -S "f0 7e 7f 06 01 f7"

The first message shows up in the MIDI tracer but the second doesn't.
pw-mididump shows everything.

Can you repeat the same steps and report back what response you got?

@dagargo
Copy link
Owner Author

dagargo commented May 6, 2024

I had to leave any Overwith off, right?

I see both messages in pw-mididump and Ardour.

$ pw-mididump 
  33: track: 0 sec:99,064690 Stop Sequence
  63: track: 0 sec:116,697311 SysEx: f0 7e 7f 06 01 f7 

Ardour MIDI tracer

     6231009            Stop
     7077375           Sysex (6) = [f0 7e 7f 06 01 f

As the message in Ardour looked a bit odd, I sent another fc command and the output of Ardour MIDI tracer looked worse.

     6231009            Stop
     7077375           Sysex (6) = [f0 7e 7f 06 01 f    14051408            Stop

Sending the fc message once more gave this output, which makes me believe the issue is just a visualization glitch.

     6231009            Stop
     7077375           Sysex (6) = [f0 7e 7f 06 01 f    14051408            Stop
    19267253            Stop

Tested on Ardour 8.4.0~ds1 (Debian testing).

@dagargo
Copy link
Owner Author

dagargo commented May 6, 2024

I forgot to mention that when using Overwitch, only the 5th SysEx message is skipped. Following messages sent from my Digitakt are shown in pw-mididump and no other MIDI event is lost.

$ pw-mididump
  33: track: 0 sec:394,119324 SysEx: f0 7e 00 7c 00 f7 
   5: track: 0 sec:394,176086 SysEx: f0 00 20 3c 10 00 04 00 36 00 00 01 0c 2b 00 01 02 03 05 04 06 07 00 50 52 51 10 13 11 12 00 20 21 22 23 28 30 31 00 32 36 40 41 42 46 17 00 18 19 29 53 54 55 56 00 57 58 59 5a 5b 5c 5d 00 5e 44 69 67 69 74 61 00 6b 74 00 f7 
  35: track: 0 sec:394,231415 SysEx: f0 00 20 3c 10 00 04 00 37 00 01 02 30 30 00 38 39 00 31 2e 35 31 00 41 00 f7 
  35: track: 0 sec:394,287415 SysEx: f0 00 20 3c 10 00 06 00 38 00 02 03 09 5c 60 0e 38 f7 
  12: track: 0 sec:394,381592 SysEx: f0 00 20 3c 10 00 04 00 39 00 03 53 01 00 00 00 00 00 00 00 00 41 00 00 00 00 40 53 4e 41 00 52 45 20 4a 41 59 00 00 00 02 00 00 00 01 00 10 00 00 20 00 12 01 01 00 4d 4f 56 45 4d 45 4e 00 54 00 00 02 00 00 00 04 02 00 00 00 20 00 12 00 01 01 52 45 56 48 41 00 54 00 00 02 00 00 00 04 03 00 00 00 20 00 12 00 01 01 53 49 4e 45 4b 00 49 4b 00 00 02 00 00 02 00 04 00 00 00 20 00 00 12 01 01 53 49 4e 45 00 44 4f 4e 47 00 00 02 00 00 00 00 05 00 00 00 40 20 00 12 01 01 4f 42 00 45 4e 00 00 02 00 00 02 00 06 00 00 00 20 00 00 12 01 01 47 55 49 4c 00 54 59 00 00 02 00 00 02 00 07 00 00 00 20 00 00 12 01 01 54 48 45 42 00 41 53 53 00 00 02 00 01 00 00 08 00 00 00 20 00 00 12 01 01 54 48 45 00 53 59 4e 54 48 00 00 00 02 00 00 00 09 00 00 20 00 20 00 12 01 01 41 00 43 49 44 00 00 02 00 01 00 00 0a 00 00 00 20 00 00 12 01 01 42 52 55 00 53 48 53 4e 41 52 45 00 00 00 02 00 00 00 0b 08 00 00 00 20 00 12 01 00 01 48 45 41 56 59 4b 00 49 43 4b 00 00 02 00 01 00 00 0c 00 00 00 20 00 00 12 01 01 42 4f 55 00 4e 43 45 00 00 02 00 01 00 00 0d 00 00 00 20 00 00 12 01 01 44 52 4f 00 4e 45 00 00 02 00 00 02 00 0e 00 00 00 20 00 00 12 01 01 4e 41 53 54 00 59 42 41 53 53 00 00 00 02 00 00 00 0f 00 00 20 00 20 00 12 01 01 52 00 45 56 4b 49 4b 00 00 00 02 00 00 00 10 00 00 20 00 20 00 12 01 01 42 00 49 54 4b 49 4b 00 00 00 02 00 00 00 11 00 00 20 00 20 00 12 01 01 41 00 4c 41 52 4d 00 00 02 00 00 00 00 12 00 00 00 40 20 00 12 01 01 53 57 00 45 45 54 50 41 44 00 00 00 02 00 00 00 13 00 10 00 00 20 00 12 01 01 00 42 4f 58 45 44 00 00 00 02 00 00 00 14 00 00 20 00 20 00 12 01 01 42 00 41 42 41 4c 4f 47 00 00 00 02 00 00 00 15 00 10 00 00 20 00 12 01 01 00 45 52 52 4f 4c 00 00 00 02 00 00 00 16 00 00 20 00 20 00 12 01 01 4b 00 56 41 43 4b 20 42 44 00 00 00 02 00 00 00 17 08 00 00 00 20 00 12 01 00 01 44 4a 55 50 20 42 00 44 00 00 02 00 00 00 04 18 00 00 00 20 00 12 00 01 01 46 4d 20 52 53 00 00 00 02 00 00 00 19 08 00 00 00 20 00 12 01 00 01 53 4c 41 50 20 43 00 50 00 00 02 00 00 00 04 1a 00 00 00 20 00 12 00 01 01 54 49 4e 4e 59 00 20 43 42 00 00 02 00 01 00 00 1b 00 00 00 20 00 00 12 01 01 4c 49 54 00 45 4e 20 48 48 00 00 00 02 00 00 00 1c 00 00 20 00 20 00 12 01 01 53 00 50 52 45 41 44 20 48 00 48 00 00 02 00 00 00 04 1d 00 00 00 20 00 12 08 01 01 4c 45 47 20 43 00 59 00 00 02 00 00 00 04 1e 00 00 00 20 00 12 00 01 01 4e 49 43 45 20 00 53 44 00 00 02 00 00 02 00 1f 00 00 00 20 00 00 12 01 01 46 4d 20 4b 00 4c 4f 4e 4b 20 54 4f 00 4d 00 00 02 00 00 00 04 20 00 00 00 20 00 12 00 01 01 53 4e 41 50 50 00 59 20 53 44 00 00 02 00 00 00 00 21 00 00 00 40 20 00 12 01 01 44 4f 00 4e 4b 44 20 54 4f 4d 00 00 00 02 00 00 00 22 08 00 00 00 20 00 12 01 00 01 46 41 54 20 53 49 00 4e 45 20 42 44 00 00 00 02 00 00 00 23 00 00 20 00 20 00 12 01 01 42 00 49 54 54 45 52 20 53 00 44 00 00 02 00 00 00 04 24 00 00 00 20 00 12 00 01 01 53 49 4e 45 44 00 20 48 48 00 00 02 00 01 00 00 25 00 00 00 20 00 00 12 01 01 48 41 54 00 20 48 48 00 00 02 00 01 00 00 26 00 00 00 20 00 00 12 01 01 53 54 45 00 52 45 4f 20 53 51 55 00 41 52 45 00 00 02 00 01 00 00 27 00 00 00 20 00 00 12 01 01 46 4d 20 00 54 4f 4d 00 00 02 00 01 00 00 28 00 00 00 20 00 00 12 01 01 4e 4f 49 00 53 45 20 43 50 00 00 00 02 00 00 00 29 00 00 20 00 20 00 12 01 01 54 00 4f 4d 4b 49 4b 00 00 00 02 00 00 00 2a 00 00 20 00 20 00 12 01 01 4c 00 41 4e 44 49 4e 47 00 00 00 02 00 00 00 2b 00 10 00 00 20 00 12 01 01 00 55 50 4c 49 46 54 00 00 00 02 00 00 00 2c 00 10 00 00 20 00 12 01 01 00 46 4c 41 53 48 42 41 00 43 4b 00 00 02 00 00 02 00 2d 00 00 00 20 00 00 12 01 01 44 49 52 54 00 59 00 00 02 00 00 00 04 2e 00 00 00 20 00 12 00 01 01 4a 55 4d 50 00 00 00 02 00 00 00 2f 00 10 00 00 20 00 12 01 01 00 44 49 53 54 55 52 42 00 00 00 02 00 00 00 30 08 00 00 00 20 00 12 01 00 01 53 50 4f 54 00 00 00 02 00 00 00 31 00 00 20 00 20 00 12 01 01 50 00 55 52 45 4e 45 53 53 00 00 00 02 00 00 00 32 08 00 00 00 20 00 12 01 00 01 53 4c 4f 57 54 49 00 4d 45 00 00 02 00 00 02 00 33 00 00 00 20 00 00 12 01 01 43 52 45 45 00 50 00 00 02 00 00 00 04 34 00 00 00 20 00 12 00 01 01 42 55 42 42 4c 00 45 00 00 02 00 00 00 04 35 00 00 00 20 00 12 00 01 01 43 41 56 45 00 00 00 02 00 00 00 36 00 10 00 00 20 00 12 01 01 00 46 4f 4c 4c 4f 57 00 00 00 02 00 00 00 37 00 10 00 00 20 00 12 01 01 00 4c 4f 57 44 49 52 54 00 00 00 02 00 00 00 38 08 00 00 00 20 00 12 01 00 01 48 49 50 53 4e 41 00 52 45 00 00 02 00 00 02 00 39 00 00 00 20 00 00 12 01 01 52 45 56 4c 00 49 46 45 00 00 02 00 01 00 00 3a 00 00 00 20 00 00 12 01 01 44 45 53 00 50 41 49 52 00 00 02 00 00 00 00 3b 00 00 00 40 20 00 12 01 01 43 55 00 54 45 00 00 02 00 00 02 00 3c 00 00 00 20 00 00 12 01 01 43 52 55 4e 00 43 48 00 00 02 00 00 02 00 3d 00 00 00 20 00 00 12 01 01 47 41 4d 45 00 4c 41 4e 00 00 02 00 01 00 00 3e 00 00 00 20 00 00 12 01 01 56 49 42 00 52 41 4c 49 42 52 41 00 00 00 02 00 00 00 3f 08 00 00 00 20 00 12 01 00 01 4e 4f 54 41 4c 4f 00 4e 45 00 00 02 00 00 02 00 40 00 00 00 20 00 00 12 01 01 f7 
  59: track: 0 sec:401,902588 Note On    (channel  1): note   A3, velocity 100
   0: track: 0 sec:402,001343 Note On    (channel  1): note   A3, velocity   0

@dagargo
Copy link
Owner Author

dagargo commented May 6, 2024

Tested with this.

$ uname -a
Linux asuka 6.7.12-rt-amd64 #1 SMP PREEMPT_RT Debian 6.7.12-1 (2024-04-24) x86_64 GNU/Linux
$ pactl info | grep "Server Name"
Server Name: PulseAudio (on PipeWire 1.0.3)

@szszoke
Copy link

szszoke commented May 7, 2024

I have different versions. I think we have to consider that this might really be a bug with PipeWire, or specifically its Jack implementation.

pw-mididump is using the native PipeWire API and it seems to work.

I will try to compile the latest development version of PipeWire and if it doesn't work with that then I will open an issue on their GitLab.

@dagargo
Copy link
Owner Author

dagargo commented May 7, 2024

@szszoke, I agree with you.
The issue almost certainly has to be in the PipeWire MIDI-Bridge.
I'll try to compile PipeWire too.

However,. I've decided to run one last test to prove this.

I've created this minimal setup.

qpwgraph

With amidi, I've written a stop command, a long SysEx and the stop command again.

$ amidi -p hw:0,0 -S "fc"
$ amidi -p hw:0,0 -S "f0 00 20 3c 10 00 04 00 08 00 03 53 01 00 00 00 00 00 00 00 00 41 00 00 00 00 40 53 4e 41 00 52 45 20 4a 41 59 00 00 00 02 00 00 00 01 00 10 00 00 20 00 12 01 01 00 4d 4f 56 45 4d 45 4e 00 54 00 00 02 00 00 00 04 02 00 00 00 20 00 12 00 01 01 52 45 56 48 41 00 54 00 00 02 00 00 00 04 03 00 00 00 20 00 12 00 01 01 53 49 4e 45 4b 00 49 4b 00 00 02 00 00 02 00 04 00 00 00 20 00 00 12 01 01 53 49 4e 45 00 44 4f 4e 47 00 00 02 00 00 00 00 05 00 00 00 40 20 00 12 01 01 4f 42 00 45 4e 00 00 02 00 00 02 00 06 00 00 00 20 00 00 12 01 01 47 55 49 4c 00 54 59 00 00 02 00 00 02 00 07 00 00 00 20 00 00 12 01 01 54 48 45 42 00 41 53 53 00 00 02 00 01 00 00 08 00 00 00 20 00 00 12 01 01 54 48 45 00 53 59 4e 54 48 00 00 00 02 00 00 00 09 00 00 20 00 20 00 12 01 01 41 00 43 49 44 00 00 02 00 01 00 00 0a 00 00 00 20 00 00 12 01 01 42 52 55 00 53 48 53 4e 41 52 45 00 00 00 02 00 00 00 0b 08 00 00 00 20 00 12 01 00 01 48 45 41 56 59 4b 00 49 43 4b 00 00 02 00 01 00 00 0c 00 00 00 20 00 00 12 01 01 42 4f 55 00 4e 43 45 00 00 02 00 01 00 00 0d 00 00 00 20 00 00 12 01 01 44 52 4f 00 4e 45 00 00 02 00 00 02 00 0e 00 00 00 20 00 00 12 01 01 4e 41 53 54 00 59 42 41 53 53 00 00 00 02 00 00 00 0f 00 00 20 00 20 00 12 01 01 52 00 45 56 4b 49 4b 00 00 00 02 00 00 00 10 00 00 20 00 20 00 12 01 01 42 00 49 54 4b 49 4b 00 00 00 02 00 00 00 11 00 00 20 00 20 00 12 01 01 41 00 4c 41 52 4d 00 00 02 00 00 00 00 12 00 00 00 40 20 00 12 01 01 53 57 00 45 45 54 50 41 44 00 00 00 02 00 00 00 13 00 10 00 00 20 00 12 01 01 00 42 4f 58 45 44 00 00 00 02 00 00 00 14 00 00 20 00 20 00 12 01 01 42 00 41 42 41 4c 4f 47 00 00 00 02 00 00 00 15 00 10 00 00 20 00 12 01 01 00 45 52 52 4f 4c 00 00 00 02 00 00 00 16 00 00 20 00 20 00 12 01 01 4b 00 56 41 43 4b 20 42 44 00 00 00 02 00 00 00 17 08 00 00 00 20 00 12 01 00 01 44 4a 55 50 20 42 00 44 00 00 02 00 00 00 04 18 00 00 00 20 00 12 00 01 01 46 4d 20 52 53 00 00 00 02 00 00 00 19 08 00 00 00 20 00 12 01 00 01 53 4c 41 50 20 43 00 50 00 00 02 00 00 00 04 1a 00 00 00 20 00 12 00 01 01 54 49 4e 4e 59 00 20 43 42 00 00 02 00 01 00 00 1b 00 00 00 20 00 00 12 01 01 4c 49 54 00 45 4e 20 48 48 00 00 00 02 00 00 00 1c 00 00 20 00 20 00 12 01 01 53 00 50 52 45 41 44 20 48 00 48 00 00 02 00 00 00 04 1d 00 00 00 20 00 12 08 01 01 4c 45 47 20 43 00 59 00 00 02 00 00 00 04 1e 00 00 00 20 00 12 00 01 01 4e 49 43 45 20 00 53 44 00 00 02 00 00 02 00 1f 00 00 00 20 00 00 12 01 01 46 4d 20 4b 00 4c 4f 4e 4b 20 54 4f 00 4d 00 00 02 00 00 00 04 20 00 00 00 20 00 12 00 01 01 53 4e 41 50 50 00 59 20 53 44 00 00 02 00 00 00 00 21 00 00 00 40 20 00 12 01 01 44 4f 00 4e 4b 44 20 54 4f 4d 00 00 00 02 00 00 00 22 08 00 00 00 20 00 12 01 00 01 46 41 54 20 53 49 00 4e 45 20 42 44 00 00 00 02 00 00 00 23 00 00 20 00 20 00 12 01 01 42 00 49 54 54 45 52 20 53 00 44 00 00 02 00 00 00 04 24 00 00 00 20 00 12 00 01 01 53 49 4e 45 44 00 20 48 48 00 00 02 00 01 00 00 25 00 00 00 20 00 00 12 01 01 48 41 54 00 20 48 48 00 00 02 00 01 00 00 26 00 00 00 20 00 00 12 01 01 53 54 45 00 52 45 4f 20 53 51 55 00 41 52 45 00 00 02 00 01 00 00 27 00 00 00 20 00 00 12 01 01 46 4d 20 00 54 4f 4d 00 00 02 00 01 00 00 28 00 00 00 20 00 00 12 01 01 4e 4f 49 00 53 45 20 43 50 00 00 00 02 00 00 00 29 00 00 20 00 20 00 12 01 01 54 00 4f 4d 4b 49 4b 00 00 00 02 00 00 00 2a 00 00 20 00 20 00 12 01 01 4c 00 41 4e 44 49 4e 47 00 00 00 02 00 00 00 2b 00 10 00 00 20 00 12 01 01 00 55 50 4c 49 46 54 00 00 00 02 00 00 00 2c 00 10 00 00 20 00 12 01 01 00 46 4c 41 53 48 42 41 00 43 4b 00 00 02 00 00 02 00 2d 00 00 00 20 00 00 12 01 01 44 49 52 54 00 59 00 00 02 00 00 00 04 2e 00 00 00 20 00 12 00 01 01 4a 55 4d 50 00 00 00 02 00 00 00 2f 00 10 00 00 20 00 12 01 01 00 44 49 53 54 55 52 42 00 00 00 02 00 00 00 30 08 00 00 00 20 00 12 01 00 01 53 50 4f 54 00 00 00 02 00 00 00 31 00 00 20 00 20 00 12 01 01 50 00 55 52 45 4e 45 53 53 00 00 00 02 00 00 00 32 08 00 00 00 20 00 12 01 00 01 53 4c 4f 57 54 49 00 4d 45 00 00 02 00 00 02 00 33 00 00 00 20 00 00 12 01 01 43 52 45 45 00 50 00 00 02 00 00 00 04 34 00 00 00 20 00 12 00 01 01 42 55 42 42 4c 00 45 00 00 02 00 00 00 04 35 00 00 00 20 00 12 00 01 01 43 41 56 45 00 00 00 02 00 00 00 36 00 10 00 00 20 00 12 01 01 00 46 4f 4c 4c 4f 57 00 00 00 02 00 00 00 37 00 10 00 00 20 00 12 01 01 00 4c 4f 57 44 49 52 54 00 00 00 02 00 00 00 38 08 00 00 00 20 00 12 01 00 01 48 49 50 53 4e 41 00 52 45 00 00 02 00 00 02 00 39 00 00 00 20 00 00 12 01 01 52 45 56 4c 00 49 46 45 00 00 02 00 01 00 00 3a 00 00 00 20 00 00 12 01 01 44 45 53 00 50 41 49 52 00 00 02 00 00 00 00 3b 00 00 00 40 20 00 12 01 01 43 55 00 54 45 00 00 02 00 00 02 00 3c 00 00 00 20 00 00 12 01 01 43 52 55 4e 00 43 48 00 00 02 00 00 02 00 3d 00 00 00 20 00 00 12 01 01 47 41 4d 45 00 4c 41 4e 00 00 02 00 01 00 00 3e 00 00 00 20 00 00 12 01 01 56 49 42 00 52 41 4c 49 42 52 41 00 00 00 02 00 00 00 3f 08 00 00 00 20 00 12 01 00 01 4e 4f 54 41 4c 4f 00 4e 45 00 00 02 00 00 02 00 40 00 00 00 20 00 00 12 01 01 f7"
$ amidi -p hw:0,0 -S "fc"

amidi doesn't show the SysEx message.

$ amidi -p hw:0,1 -d

FC
FC

pw-mididump shows all the message. (It's split in parts but all the bytes are there.)

$ pw-mididump 
 177: track: 0 sec:128,387680 Stop Sequence
 114: track: 0 sec:130,498383 SysEx: f0 00 20 3c 10 00 04 00 08 00 03 53 01 00 00 00 00 00 00 00 00 41 00 00 00 00 40 53 4e 41 00 52 45 20 4a 41 59 00 00 00 02 00 00 00 01 00 10 00 00 20 00 12 01 01 00 4d 4f 56 45 4d 45 4e 00 54 00 00 02 00 00 00 04 02 00 00 00 20 00 12 00 01 01 52 45 56 48 41 00 54 00 00 02 00 00 00 04 03 00 00 00 20 00 12 00 01 01 53 49 4e 45 4b 00 49 4b 00 00 02 00 00 02 00 04 00 00 00 20 00 00 12 01 01 53 49 4e 45 00 44 4f 4e 47 00 00 02 00 00 00 00 05 00 00 00 40 20 00 12 01 01 4f 42 00 45 4e 00 00 02 00 00 02 00 06 00 00 00 20 00 00 12 01 01 47 55 49 4c 00 54 59 00 00 02 00 00 02 00 07 00 00 00 20 00 00 12 01 01 54 48 45 42 00 41 53 53 00 00 02 00 01 00 00 08 00 00 00 20 00 00 12 01 01 54 48 45 00 53 59 4e 54 48 00 00 00 02 00 00 00 09 00 00 20 00 20 00 12 01 01 41 00 43 
 117: track: 0 sec:130,498444 Unknown: 49 44 00 00 02 00 01 00 00 0a 00 00 00 20 00 00 12 01 01 42 52 55 00 53 48 53 4e 41 52 45 00 00 00 02 00 00 00 0b 08 00 00 00 20 00 12 01 00 01 48 45 41 56 59 4b 00 49 43 4b 00 00 02 00 01 00 00 0c 00 00 00 20 00 00 12 01 01 42 4f 55 00 4e 43 45 00 00 02 00 01 00 00 0d 00 00 00 20 00 00 12 01 01 44 52 4f 00 4e 45 00 00 02 00 00 02 00 0e 00 00 00 20 00 00 12 01 01 4e 41 53 54 00 59 42 41 53 53 00 00 00 02 00 00 00 0f 00 00 20 00 20 00 12 01 01 52 00 45 56 4b 49 4b 00 00 00 02 00 00 00 10 00 00 20 00 20 00 12 01 01 42 00 49 54 4b 49 4b 00 00 00 02 00 00 00 11 00 00 20 00 20 00 12 01 01 41 00 4c 41 52 4d 00 00 02 00 00 00 00 12 00 00 00 40 20 00 12 01 01 53 57 00 45 45 54 50 41 44 00 00 00 02 00 00 00 13 00 10 00 00 20 00 12 01 01 00 42 4f 58 45 44 00 00 00 02 
 120: track: 0 sec:130,498505 Unknown: 00 00 00 14 00 00 20 00 20 00 12 01 01 42 00 41 42 41 4c 4f 47 00 00 00 02 00 00 00 15 00 10 00 00 20 00 12 01 01 00 45 52 52 4f 4c 00 00 00 02 00 00 00 16 00 00 20 00 20 00 12 01 01 4b 00 56 41 43 4b 20 42 44 00 00 00 02 00 00 00 17 08 00 00 00 20 00 12 01 00 01 44 4a 55 50 20 42 00 44 00 00 02 00 00 00 04 18 00 00 00 20 00 12 00 01 01 46 4d 20 52 53 00 00 00 02 00 00 00 19 08 00 00 00 20 00 12 01 00 01 53 4c 41 50 20 43 00 50 00 00 02 00 00 00 04 1a 00 00 00 20 00 12 00 01 01 54 49 4e 4e 59 00 20 43 42 00 00 02 00 01 00 00 1b 00 00 00 20 00 00 12 01 01 4c 49 54 00 45 4e 20 48 48 00 00 00 02 00 00 00 1c 00 00 20 00 20 00 12 01 01 53 00 50 52 45 41 44 20 48 00 48 00 00 02 00 00 00 04 1d 00 00 00 20 00 12 08 01 01 4c 45 47 20 43 00 59 00 00 02 00 00 00 04 1e 
 123: track: 0 sec:130,498566 Unknown: 00 00 00 20 00 12 00 01 01 4e 49 43 45 20 00 53 44 00 00 02 00 00 02 00 1f 00 00 00 20 00 00 12 01 01 46 4d 20 4b 00 4c 4f 4e 4b 20 54 4f 00 4d 00 00 02 00 00 00 04 20 00 00 00 20 00 12 00 01 01 53 4e 41 50 50 00 59 20 53 44 00 00 02 00 00 00 00 21 00 00 00 40 20 00 12 01 01 44 4f 00 4e 4b 44 20 54 4f 4d 00 00 00 02 00 00 00 22 08 00 00 00 20 00 12 01 00 01 46 41 54 20 53 49 00 4e 45 20 42 44 00 00 00 02 00 00 00 23 00 00 20 00 20 00 12 01 01 42 00 49 54 54 45 52 20 53 00 44 00 00 02 00 00 00 04 24 00 00 00 20 00 12 00 01 01 53 49 4e 45 44 00 20 48 48 00 00 02 00 01 00 00 25 00 00 00 20 00 00 12 01 01 48 41 54 00 20 48 48 00 00 02 00 01 00 00 26 00 00 00 20 00 00 12 01 01 53 54 45 00 52 45 4f 20 53 51 55 00 41 52 45 00 00 02 00 01 00 00 27 00 00 00 20 00 00 
 126: track: 0 sec:130,498627 Unknown: 12 01 01 46 4d 20 00 54 4f 4d 00 00 02 00 01 00 00 28 00 00 00 20 00 00 12 01 01 4e 4f 49 00 53 45 20 43 50 00 00 00 02 00 00 00 29 00 00 20 00 20 00 12 01 01 54 00 4f 4d 4b 49 4b 00 00 00 02 00 00 00 2a 00 00 20 00 20 00 12 01 01 4c 00 41 4e 44 49 4e 47 00 00 00 02 00 00 00 2b 00 10 00 00 20 00 12 01 01 00 55 50 4c 49 46 54 00 00 00 02 00 00 00 2c 00 10 00 00 20 00 12 01 01 00 46 4c 41 53 48 42 41 00 43 4b 00 00 02 00 00 02 00 2d 00 00 00 20 00 00 12 01 01 44 49 52 54 00 59 00 00 02 00 00 00 04 2e 00 00 00 20 00 12 00 01 01 4a 55 4d 50 00 00 00 02 00 00 00 2f 00 10 00 00 20 00 12 01 01 00 44 49 53 54 55 52 42 00 00 00 02 00 00 00 30 08 00 00 00 20 00 12 01 00 01 53 50 4f 54 00 00 00 02 00 00 00 31 00 00 20 00 20 00 12 01 01 50 00 55 52 45 4e 45 53 53 00 00 
 129: track: 0 sec:130,498688 Unknown: 00 02 00 00 00 32 08 00 00 00 20 00 12 01 00 01 53 4c 4f 57 54 49 00 4d 45 00 00 02 00 00 02 00 33 00 00 00 20 00 00 12 01 01 43 52 45 45 00 50 00 00 02 00 00 00 04 34 00 00 00 20 00 12 00 01 01 42 55 42 42 4c 00 45 00 00 02 00 00 00 04 35 00 00 00 20 00 12 00 01 01 43 41 56 45 00 00 00 02 00 00 00 36 00 10 00 00 20 00 12 01 01 00 46 4f 4c 4c 4f 57 00 00 00 02 00 00 00 37 00 10 00 00 20 00 12 01 01 00 4c 4f 57 44 49 52 54 00 00 00 02 00 00 00 38 08 00 00 00 20 00 12 01 00 01 48 49 50 53 4e 41 00 52 45 00 00 02 00 00 02 00 39 00 00 00 20 00 00 12 01 01 52 45 56 4c 00 49 46 45 00 00 02 00 01 00 00 3a 00 00 00 20 00 00 12 01 01 44 45 53 00 50 41 49 52 00 00 02 00 00 00 00 3b 00 00 00 40 20 00 12 01 01 43 55 00 54 45 00 00 02 00 00 02 00 3c 00 00 00 20 00 00 12 
 130: track: 0 sec:130,498703 Unknown: 01 01 43 52 55 4e 00 43 48 00 00 02 00 00 02 00 3d 00 00 00 20 00 00 12 01 01 47 41 4d 45 00 4c 41 4e 00 00 02 00 01 00 00 3e 00 00 00 20 00 00 12 01 01 56 49 42 00 52 41 4c 49 42 52 41 00 00 00 02 00 00 00 3f 08 00 00 00 20 00 12 01 00 01 4e 4f 54 41 4c 4f 00 4e 45 00 00 02 00 00 02 00 40 00 00 00 20 00 00 12 01 01 f7 
  67: track: 0 sec:134,486725 Stop Sequence

@dagargo
Copy link
Owner Author

dagargo commented May 7, 2024

I'm pretty sure the issue is around this line.

https://github.com/PipeWire/pipewire/blob/9d94db664655a53e749c32413154efeac0b8dcde/spa/plugins/alsa/alsa-seq.c#L654

The problem is that snd_midi_event_encode might return while having performed a partial read in the case of a SysEx message. If this is not taken into account, the event will not be complete and will be ignored in the snd_seq_event_output call and the parser will be reset in the next iteration so the the read bytes will be lost.

See https://www.alsa-project.org/alsa-doc/alsa-lib/group___m_i_d_i___event.html#gae44531e8091bdd6e97a5b70e7b81ea10.

I haven't found a solution yet and I haven't reported this either.

@szszoke
Copy link

szszoke commented May 8, 2024

Have you been able to trigger this scenario? If you add some log statements and trigger it then I'd say you should report it even before you came up with a solution. You could then come up with a solution together with the PipeWire devs.

Just do it on their GitLab server and not on GitHub.

@dagargo
Copy link
Owner Author

dagargo commented May 8, 2024

Have you been able to trigger this scenario?

Yes.

You're right.

I'll report them my findings later today.

It's just that I don't fully understand a couple of functions in the ALSA API.

@szszoke
Copy link

szszoke commented May 8, 2024

If I understand correctly then the SysEx message is larger than the allocated buffer for snd_midi_event_encode.

Have you tried to increase the buffer size?

@dagargo
Copy link
Owner Author

dagargo commented May 8, 2024

That's not the problem here.

snd_midi_event_encode might need more bytes when returning. This is indicated in the snd_midi_event_encode documentation.

This function tries to use up to count bytes from the beginning of the buffer to encode a sequencer event. If a complete MIDI message has been encoded, the sequencer event is written to ev; otherwise, ev->type is set to SND_SEQ_EVENT_NONE, and further bytes are required to complete a message.

In this case, a new iteration over the pod is needed in their code to keep reading the data and the calls to snd_seq_ev_clear and snd_midi_event_reset_encode need to be skipped in this case.

I'll publish my findings there later but it's not an ALSA issue.

@dagargo
Copy link
Owner Author

dagargo commented May 8, 2024

@szszoke
Copy link

szszoke commented May 9, 2024

The issue you created is now closed with a commit.

@dagargo
Copy link
Owner Author

dagargo commented May 9, 2024

From memory, the solution in that commit is the same thing I proposed and tested. It works but I need to check something.

Have you tested it?

@szszoke
Copy link

szszoke commented May 9, 2024

I just did but it still doesn't work for me. My Digitakt just doesn't seem to respond to any SysEx message, not even the short ones. Playback still stopped when I tried to open it from Elektroid so at least some MIDI messages appear to reach the Digitakt.

I also tried to test with just Alsa and something is not quite right. This is what I get from pw-mididump when I send your long SysEx example:

 691: track: 0 sec:294,542389 SysEx: f0 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 
 691: track: 0 sec:294,542389 Unknown: 7f f7 

amidi -d seems to be fine however.

It is still better however because if I revert my system pipewire then amidi doesn't print anything for the long SysEx message, only for the short ones.

I also tried to connect to my Digitakt in MIDI mode but through the virtual MIDI ports which also worked so at least it is not something with the PipeWire routing itself.

@szszoke
Copy link

szszoke commented May 9, 2024

Could it be that some commits are not pushed?

@dagargo
Copy link
Owner Author

dagargo commented May 9, 2024

Same happens here. Well, not exactly. But I'd say is working worse than before as no SysEx message passes thru.

Could it be that some commits are not pushed?

They've done more things than the fixing commit to address other things around the same lines.

I'll take a fresh look tomorrow and see if there are any more fixes.

@szszoke
Copy link

szszoke commented May 9, 2024

I also noticed that my Digitakt glitches if I send a playback start message. It looks like the sequencer just hangs but then eventually it continues.

I tried the same with the Syntakt but it didn't happen there.

@szszoke
Copy link

szszoke commented May 10, 2024

I am on pipewire@cdc150a2c and it improves things. I found that I need to invoke pw-uninstalled.sh from each shell where I want to use the built version of PipeWire and it also tends to break if I go to a different directory. It's easier to install Overwitch from this branch and then just invoke it directly after pw-uninstalled.sh.

The ls command seems to work but downloading doesn't.

$ elektroid-cli -vv elektron-data-ls 1:/
DEBUG:elektroid-cli.c:833:(main): Connector: "elektron"; filesystem: "data"; operation: "ls"
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend.c:306:(backend_init): Initializing backend (ALSA) to 'hw:0,0,0'...
DEBUG:backend_alsa.c:84:(backend_init_int): Setting blocking mode...
DEBUG:backend.c:626:(backend_rx_drain): Draining buffers...
DEBUG:backend.c:395:(backend_rx_raw_loop): Timeout (1000)
DEBUG:backend.c:317:(backend_init): Stopping device...
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (6): f0 7e 7f 06 01 f7
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (6): f0 7e 00 7c 00 f7
DEBUG:backend.c:144:(backend_midi_handshake): Illegal SUB-ID2
DEBUG:connector.c:178:(connector_init_backend): Testing elektron connector...
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (13): f0 00 20 3c 10 00 00 00 00 00 00 01 f7
DEBUG:connectors/elektron.c:758:(elektron_tx): Message sent (5): 00 00 00 00 01
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (75): f0 00 20 3c 10 00 04 00 7b 00 00 01 0c 2b 00 01 02 03 05 04 06 07 00 50 52 51 10 13 11 12 00 20 21 22 23 28 30 31 00 32 36 40 41 42 46 17 00 18 19 29 53 54 55 56 00 57 58 59 5a 5b 5c 5d 00 5e...
DEBUG:connectors/elektron.c:803:(elektron_rx): Message received (59): 00 7b 00 00 81 0c 2b 01 02 03 05 04 06 07 50 52 51 10 13 11 12 20 21 22 23 28 30 31 32 36 40 41 42 46 17 18 19 29 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 44 69 67 69 74 61 6b 74 00
DEBUG:connectors/elektron.c:3270:(elektron_configure_device): Failed to open file “/home/szabi/.config/elektroid/elektron/devices.json”: No such file or directory
DEBUG:connectors/elektron.c:3276:(elektron_configure_device): Falling back to /usr/local/share/elektroid/elektron/devices.json...
DEBUG:connectors/elektron.c:3335:(elektron_configure_device): Device 12 found
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (13): f0 00 20 3c 10 00 00 00 01 00 00 02 f7
DEBUG:connectors/elektron.c:758:(elektron_tx): Message sent (5): 00 01 00 00 02
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (26): f0 00 20 3c 10 00 04 00 7c 00 01 02 30 30 00 38 39 00 31 2e 35 31 00 41 00 f7
DEBUG:connectors/elektron.c:803:(elektron_rx): Message received (16): 00 7c 00 01 82 30 30 38 39 00 31 2e 35 31 41 00
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (13): f0 00 20 3c 10 00 00 00 02 00 00 03 f7
DEBUG:connectors/elektron.c:758:(elektron_tx): Message sent (5): 00 02 00 00 03
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (18): f0 00 20 3c 10 00 06 00 7d 00 02 03 3a 7c 60 3a 6a f7
DEBUG:connectors/elektron.c:803:(elektron_rx): Message received (9): 00 7d 00 02 83 ba 7c ba ea
DEBUG:connectors/elektron.c:3484:(elektron_handshake): UID: eaba7cba
DEBUG:connector.c:182:(connector_init_backend): Using elektron connector...
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (26): f0 00 20 3c 10 00 00 00 03 00 00 53 2f 00 00 00 00 00 00 00 00 00 00 00 01 f7
DEBUG:connectors/elektron.c:758:(elektron_tx): Message sent (16): 00 03 00 00 53 2f 00 00 00 00 00 00 00 00 00 01
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (65): f0 00 20 3c 10 00 04 00 7e 00 03 53 01 00 00 00 00 00 00 00 00 02 00 00 00 00 02 70 72 6f 00 6a 65 63 74 73 00 01 04 01 00 00 00 00 73 6f 00 75 6e 64 62 61 6e 6b 00 73 00 01 01 00 00 00 00 08...
DEBUG:connectors/elektron.c:803:(elektron_rx): Message received (50): 00 7e 00 03 d3 01 00 00 00 00 00 00 00 02 00 00 00 02 70 72 6f 6a 65 63 74 73 00 01 01 00 00 00 80 73 6f 75 6e 64 62 61 6e 6b 73 00 01 01 00 00 00 08
D 0000 0 0         0B  -1 projects
D 0000 0 0         0B  -1 soundbanks
DEBUG:backend.c:332:(backend_destroy): Destroying backend...
DEBUG:backend.c:223:(backend_destroy_data): Destroying backend data...

@szszoke
Copy link

szszoke commented May 10, 2024

Downloading a project fails however:

$ elektroid-cli -vv elektron-data-dl 1:/projects/1
DEBUG:elektroid-cli.c:833:(main): Connector: "elektron"; filesystem: "data"; operation: "dl"
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend_alsa.c:362:(backend_get_system_subdevices): Adding hw:0 (name 'Virtual Raw MIDI', subname '')...
DEBUG:backend.c:306:(backend_init): Initializing backend (ALSA) to 'hw:0,0,0'...
DEBUG:backend_alsa.c:84:(backend_init_int): Setting blocking mode...
DEBUG:backend.c:626:(backend_rx_drain): Draining buffers...
DEBUG:backend.c:395:(backend_rx_raw_loop): Timeout (1000)
DEBUG:backend.c:317:(backend_init): Stopping device...
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (6): f0 7e 7f 06 01 f7
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (6): f0 7e 00 7c 00 f7
DEBUG:backend.c:144:(backend_midi_handshake): Illegal SUB-ID2
DEBUG:connector.c:178:(connector_init_backend): Testing elektron connector...
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (13): f0 00 20 3c 10 00 00 00 00 00 00 01 f7
DEBUG:connectors/elektron.c:758:(elektron_tx): Message sent (5): 00 00 00 00 01
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (75): f0 00 20 3c 10 00 24 00 03 00 00 01 0c 2b 00 01 02 03 05 04 06 07 00 50 52 51 10 13 11 12 00 20 21 22 23 28 30 31 00 32 36 40 41 42 46 17 00 18 19 29 53 54 55 56 00 57 58 59 5a 5b 5c 5d 00 5e...
DEBUG:connectors/elektron.c:803:(elektron_rx): Message received (59): 00 83 00 00 81 0c 2b 01 02 03 05 04 06 07 50 52 51 10 13 11 12 20 21 22 23 28 30 31 32 36 40 41 42 46 17 18 19 29 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 44 69 67 69 74 61 6b 74 00
DEBUG:connectors/elektron.c:3270:(elektron_configure_device): Failed to open file “/home/szabi/.config/elektroid/elektron/devices.json”: No such file or directory
DEBUG:connectors/elektron.c:3276:(elektron_configure_device): Falling back to /usr/local/share/elektroid/elektron/devices.json...
DEBUG:connectors/elektron.c:3335:(elektron_configure_device): Device 12 found
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (13): f0 00 20 3c 10 00 00 00 01 00 00 02 f7
DEBUG:connectors/elektron.c:758:(elektron_tx): Message sent (5): 00 01 00 00 02
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (26): f0 00 20 3c 10 00 24 00 04 00 01 02 30 30 00 38 39 00 31 2e 35 31 00 41 00 f7
DEBUG:connectors/elektron.c:803:(elektron_rx): Message received (16): 00 84 00 01 82 30 30 38 39 00 31 2e 35 31 41 00
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (13): f0 00 20 3c 10 00 00 00 02 00 00 03 f7
DEBUG:connectors/elektron.c:758:(elektron_tx): Message sent (5): 00 02 00 00 03
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (18): f0 00 20 3c 10 00 26 00 05 00 02 03 3a 7c 60 3a 6a f7
DEBUG:connectors/elektron.c:803:(elektron_rx): Message received (9): 00 85 00 02 83 ba 7c ba ea
DEBUG:connectors/elektron.c:3484:(elektron_handshake): UID: eaba7cba
DEBUG:connector.c:182:(connector_init_backend): Using elektron connector...
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (33): f0 00 20 3c 10 00 00 00 03 00 00 54 2f 70 00 72 6f 6a 65 63 74 73 00 2f 31 00 00 00 20 00 00 01 f7
DEBUG:connectors/elektron.c:758:(elektron_tx): Message sent (22): 00 03 00 00 54 2f 70 72 6f 6a 65 63 74 73 2f 31 00 00 00 20 00 01
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (25): f0 00 20 3c 10 00 24 00 06 00 03 54 01 00 00 00 00 03 00 00 20 00 00 01 f7
DEBUG:connectors/elektron.c:803:(elektron_rx): Message received (15): 00 86 00 03 d4 01 00 00 00 03 00 00 20 00 01
DEBUG:connectors/elektron.c:2237:(elektron_open_datum): Open datum info: job id: 3; chunk size: 8192; compression: 1
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (22): f0 00 20 3c 10 00 00 00 04 00 00 55 00 00 00 00 03 00 00 00 00 f7
DEBUG:connectors/elektron.c:758:(elektron_tx): Message sent (13): 00 04 00 00 55 00 00 00 03 00 00 00 00
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (38): f0 00 20 3c 10 00 24 00 07 00 04 55 01 00 00 00 00 03 40 12 17 78 3b 42 36 7f 60 00 7f 7f 60 7f 7f 00 00 00 00 f7
DEBUG:connectors/elektron.c:803:(elektron_rx): Message received (27): 00 87 00 04 d5 01 00 00 00 03 40 12 17 78 42 b6 ff e0 00 ff ff ff ff 00 00 00 00
DEBUG:connectors/elektron.c:2441:(elektron_download_data_prefix): Read datum info: job id: 3; last: 0, hash: 0xffffffff
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (22): f0 00 20 3c 10 00 00 00 05 00 00 55 00 00 00 00 03 00 00 00 01 f7
DEBUG:connectors/elektron.c:758:(elektron_tx): Message sent (13): 00 05 00 00 55 00 00 00 03 00 00 00 01
DEBUG:backend.c:395:(backend_rx_raw_loop): Timeout (5000)
DEBUG:backend_alsa.c:204:(backend_tx_sysex_internal): Raw message sent (18): f0 00 20 3c 10 00 00 00 06 00 00 56 00 00 00 00 03 f7
DEBUG:connectors/elektron.c:758:(elektron_tx): Message sent (9): 00 06 00 00 56 00 00 00 03
DEBUG:backend.c:606:(backend_rx_sysex): Raw message received (42): f0 00 20 3c 10 00 24 00 09 00 06 56 00 52 00 65 61 64 65 72 20 64 00 69 64 20 6e 6f 74 20 00 63 6f 6d 70 6c 65 74 00 65 00 f7
DEBUG:connectors/elektron.c:803:(elektron_rx): Message received (30): 00 89 00 06 d6 00 52 65 61 64 65 72 20 64 69 64 20 6e 6f 74 20 63 6f 6d 70 6c 65 74 65 00
ERROR:connectors/elektron.c:2306:(elektron_close_datum): Operation not permitted (Reader did not complete)
DEBUG:backend.c:332:(backend_destroy): Destroying backend...
DEBUG:backend.c:223:(backend_destroy_data): Destroying backend data...
ERROR:elektroid-cli.c:897:(main): Error: Operation not permitted

@szszoke
Copy link

szszoke commented May 10, 2024

I got it to work! I had to increase the quantum-limit as it was suggested in the PW issue.

I'm assuming that you followed the build instructions from INSTALL.md.

Uncomment line 48 in builddir/src/daemon/pipewire-uninstalled.conf and update the value from 8192 to 16384. (I guess anything above 9440 should work.

I am so far successfully downloading samples while also having Main L/R routed to my USB sound card and listening to a preset.

@szszoke
Copy link

szszoke commented May 10, 2024

I was able to trip it up a few times by changing connections to the different ports while the samples were downloading. I think ow started to tune for a bit and then MIDI messages didn't go through.

@dagargo
Copy link
Owner Author

dagargo commented May 10, 2024

This is good news.

I'll test all this during the weekend and close the PipeWire issue if everythings goes as said there. BTW, thanks for the tips.

I was able to trip it up a few times by changing connections to the different ports while the samples were downloading. I think ow started to tune for a bit and then MIDI messages didn't go through.

This might need some work though.

Does it make sense to pass the MIDI messages albeit the tuning is running? Perhaps it does. Besides, the time in the SysEx messages is totally useless.

I'll check some things regarding this and come back to you.

@szszoke
Copy link

szszoke commented May 11, 2024

Does it make sense to pass the MIDI messages albeit the tuning is running? Perhaps it does. Besides, the time in the SysEx messages is totally useless.

I think it depends on how MIDI and audio is synchronized.

If that would depend on the tuning then maybe regular MIDI messages would have to wait.

SysEx for transferring samples likely doesn't care about any of that.

@dagargo
Copy link
Owner Author

dagargo commented May 11, 2024

Everything seems to be working quite well.

I've pushed some commits but we aware that I've rewritten the branch to fix a couple of things. Also, MIDI events should pass regardless of the resampler status now.

I've found occasional errors but not sure where the cause is as there are many parts to consider now (Elektroid, Overwitch, the Digitakt and all the PipeWire components). This will need lots of debugging.

Could you try the branch again?

I've seen some errors like this in the PipeWire log but I'm not sure if these are related as some errors occur without this warning.

[W][08365.078654] spa.alsa | [ alsa-seq.c: 703 process_write()] failed to output event: Recurso no disponible temporalmente

@szszoke
Copy link

szszoke commented May 11, 2024

I gave it a try. I do not get errors logged anywhere and it feels much more stable compared to yesterday.

I am yet again trying to download all my samples while having all the individual outputs routed to a USB sound card, and having Elektroid routed into the Digitakt while I play a longer sample on loop.

I forgot to change the standard period size however so it is now at 1024 - not sure if that matters.

@szszoke
Copy link

szszoke commented May 11, 2024

Loading different presets during downloading can make downloading fail. Maybe the Digitakt responds slower during loading. I don't know if it would eventually continue responding but if it does then a longer timeout in Elektroid could make it more immune to this problem.

@dagargo
Copy link
Owner Author

dagargo commented May 11, 2024

I don't know if it would eventually continue responding but if it does then a longer timeout in Elektroid could make it more immune to this problem.

I tried with a much longer timeout and it didn't help.

@dagargo
Copy link
Owner Author

dagargo commented May 12, 2024

Loading different presets during downloading can make downloading fail.

I've realized this too. Changing the filesystems and doing concurrent operations makes things fail. This happens with other devices too when changing the filesystem.

AFAIK, Elektron devices are the only ones that are able to perform several operations SysEx-wise at once (e.g. reading a directory and uploading a file can be done simultaneously). In fact, there is an option in the filesystems to indicate this feature.

But if it's not working well, we can remove this feature. How's behaving Transfer in this regard?

Apart from this, disabling the filesystem combo when other operations are running it something what should be already be implemented for the single operations filesystems. I'd take a look at this.

@dagargo
Copy link
Owner Author

dagargo commented May 12, 2024

I've pushed some commits to Elektroid to disable the filesystem combo for single operation filesystems.

This should not change the behavior with Elektron machines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants