Closed dagargo closed 2 weeks ago
is there a chance that this will support Digitak2 ?
We don't know this yet but i think it could work.
Fortunately, if the Digitakt II uses the same USB packets, it is not difficult to try and see.
Only two things need to be done.
The first part deals with the USB devices just above the kernel level. This information is in the udev
directory where a new entry must be added for the Digitakt II.
udev$ head -n 5 20-usb-elektron.hwdb
usb:v1935*
ID_VENDOR_FROM_DATABASE=Elektron Music Machines
usb:v1935p000A*
ID_MODEL_FROM_DATABASE=Analog Heat Overbridge
First entry is the vendor (Elektron) and next entries are the devices. Copy a device at the end, give it a name and use the vendor ID and product ID from lsusb
.
Don't forget to put your Digitakt II into Overbridge mode before running this command as there are different IDs for the different USB modes.
udev$ lsusb | grep Heat
Bus 001 Device 002: ID 1935:000A Analog Heat
First 4 hexadecimal digits 1935
is the vendor ID; the next 4 000A
is the product ID. You need to use these 8 digits to conform the line usb:v1935p000A*
that you added in the previous step.
You'll need to install the new rules by running sudo make install
from that directory every time you make changes to this file.
The second part deals with the Overbridge definition of the device. This definition includes the ID, the name and the input and output tracks. Follow the explanation here.
Basically, copy the file res/devices.json
into the user configuration directory, add a new definition for the Digitakt II and fill the JSON object. The amount of tracks must match the amount that the Digitakt sends and receives. The names are up to you.
Notice the ID is in decimal, so in the example above, the ID for the Analog Heat is 10
.
Don't hesitate to ask in case of doubt.
I'm not sure if the same code is gonna work anymore.
I've just updated my Digitak (not Digitakt II) and it has changed quite a lot in Overbridge mode regarding the USB descriptors.
I'm still investigating this.
On the positive side of things, MIDI seems to be class compliant even in Overbridge mode.
@dagargo thank you. I followed your instructions, and I run into the below error. As you mentioned, I think it's related to the USB descriptors but might be something else not properly setup in my side.
ERROR:engine.c:727:ow_engine_init: Error while initializing device: LIBUSB_ERROR_BUSY ERROR:jclient.c:703:jclient_init: Overwitch error: can't set usb config
Fortunately, only 2 lines need to be added to make it work with my Digitakt I at least.
diff --git a/src/engine.c b/src/engine.c
index 0374132..9ca9a50 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -643,6 +643,9 @@ ow_engine_init (struct ow_engine *engine, unsigned int blocks_per_transfer,
engine->usb.xfr_timeout = xfr_timeout;
debug_print (1, "USB transfer timeout: %u", engine->usb.xfr_timeout);
+ libusb_detach_kernel_driver (engine->usb.device_handle, 4);
+ libusb_detach_kernel_driver (engine->usb.device_handle, 5);
+
err = libusb_set_configuration (engine->usb.device_handle, 1);
if (LIBUSB_SUCCESS != err)
{
With this you could test the device definition in the JSON file and see if the JACK client appears, has the right ports and works.
However, if the USB MIDI is confirmed to be class compliant in Overbridge mode, all the MIDI related code in Overwitch will not be needed anymore and could be wiped out, letting the MIDI kernel modules do their job.
I'm still thinking on the proper approach to this situation but I would probably be like this.
I won't support devices with older OSes but version 1.2 will be there in case anybody needs it.
Amazing thank you, really impressive work.
I have added the kernel detach driver and the error above got fixed.
I'm having another error now:
overwitch-record -n 0
ERROR:engine.c:322:cb_xfr_audio_in: o2h: Error on USB audio transfer: LIBUSB_TRANSFER_OVERFLOW
when looking at dmesg
output I see:
usbfs: process 131666 (overwitch-recor) did not claim interface 5 before use
In the engine code I see you claim 3 interfaces but when listing DGII USB interfaces I see 5 of them, 2 of which are class audio. interface_number: 0 class: 255 protocol: 0 interface_number: 1 class: 255 protocol: 0 interface_number: 2 class: 255 protocol: 0 interface_number: 3 class: 255 protocol: 0 interface_number: 4 class: 1 protocol: 0 interface_number: 5 class: 1 protocol: 0
would that be reason? or may be I misconfigured the device audio output?
I just know the very basics of USB but LIBUSB_TRANSFER_OVERFLOW
makes me think the definition of the device in the devices.json
file is not right. Too much data is coming in overflowing the buffer.
How many tracks have you defined? Could you post the device here?
Regarding the interfaces, this is what's in use.
As you noticed, interfaces 4 and 5 are for the class compliant MIDI. libusb
requires libusb_detach_kernel_driver
to be called before claiming other interfaces. This call will disable the MIDI driver in the kernel.
The interesting thing is that I have a working draft that removes all the MIDI code in Overwitch, does not claim the interface 3 and restores the MIDI driver in the kernel with calls to libusb_attach_kernel_driver
.
But let's focus on solving the LIBUSB_TRANSFER_OVERFLOW
first.
here is the device definition, I have experimented with more output tracks, but no luck.
{ "pid": 2859, "name": "Digitakt2", "input_track_names": [ "Main L Input", "Main R Input" ], "output_track_names": [ "Track 1", "Track 2", "Track 3", "Track 4", "Track 5", "Track 6", "Track 7", "Track 8", "Track 9", "Track 10", "Track 11", "Track 12", "Track 13", "Track 14", "Track 15", "Track 16" ] }
and some logs from verbose run DEBUG:overwitch.c:392:ow_get_device_desc_from_vid_pid: Device with PID 2859 found DEBUG:overwitch.c:254:ow_get_usb_device_list: Found Digitakt2 (bus 001, address 005, ID 1935:0b2b) DEBUG:overwitch.c:392:ow_get_device_desc_from_vid_pid: Device with PID 2859 found DEBUG:engine.c:644:ow_engine_init: USB transfer timeout: 10 DEBUG:engine.c:544:ow_engine_init_mem: Blocks per transfer: 24 DEBUG:engine.c:1385:ow_engine_load_overbridge_name: USB control in data (32 B): Digitakt II DEBUG:engine.c:1405:ow_engine_load_overbridge_name: USB control in data (16 B): 0041 1.03A DEBUG:jclient.c:218:jclient_set_sample_rate_cb: JACK sample rate: 48000 DEBUG:resampler.c:626:ow_resampler_set_samplerate: Setting resampler sample rate to 48000 DEBUG:jclient.c:828:jclient_run: Using RT priority -828408246... DEBUG:jclient.c:830:jclient_run: Registering ports... DEBUG:engine.c:1211:ow_engine_start: Starting h2o MIDI thread... ERROR:jclient.c:674:set_rt_priority: Could not set real time priority DEBUG:engine.c:1224:ow_engine_start: Starting audio and o2h MIDI thread... ERROR:jclient.c:674:set_rt_priority: Could not set real time priority DEBUG:jclient.c:208:jclient_set_buffer_size_cb: JACK buffer size: 1024 DEBUG:resampler.c:613:ow_resampler_set_buffer_size: Setting resampler buffer size to 1024 ERROR:engine.c:322:cb_xfr_audio_in: o2h: Error on USB audio transfer: LIBUSB_TRANSFER_OVERFLOW ERROR:engine.c:322:cb_xfr_audio_in: o2h: Error on USB audio transfer: LIBUSB_TRANSFER_OVERFLOW ERROR:engine.c:322:cb_xfr_audio_in: o2h: Error on USB audio transfer: LIBUSB_TRANSFER_OVERFLOW ERROR:engine.c:322:cb_xfr_audio_in: o2h: Error on USB audio transfer: LIBUSB_TRANSFER_OVERFLOW ERROR:engine.c:322:cb_xfr_audio_in: o2h: Error on USB audio transfer: LIBUSB_TRANSFER_OVERFLOW Digitakt2 @ 001,005: o2h latency: -1.0 [-1.0, -1.0] ms; h2o latency: -1.0 [-1.0, -1.0] ms, o2h ratio: 1.000000, avg. 1.000000
All tracks need to be mono and other tracks are missing for sure. I don't know exactly how many but I've seen some videos where they claim that Digitakt II has 42 output tracks and 2 input tracks.
I couldn't find a document explaining this but based on the images and videos I've watched this is what you should try.
{
"pid": 2859,
"name": "Digitakt II",
"input_track_names": [
"Main L Input",
"Main R Input"
],
"output_track_names": [
"Track 1 L",
"Track 1 R",
"Track 2 L",
"Track 2 R",
"Track 3 L",
"Track 3 R",
"Track 4 L",
"Track 4 R",
"Track 5 L",
"Track 5 R",
"Track 6 L",
"Track 6 R",
"Track 7 L",
"Track 7 R",
"Track 8 L",
"Track 8 R",
"Track 9 L",
"Track 9 R",
"Track 10 L",
"Track 10 R",
"Track 11 L",
"Track 11 R",
"Track 12 L",
"Track 12 R",
"Track 13 L",
"Track 13 R",
"Track 14 L",
"Track 14 R",
"Track 15 L",
"Track 15 R",
"Track 16 L",
"Track 16 R",
"Delay L",
"Delay R",
"Reverb L",
"Reverb R",
"Chorus L",
"Chorus R",
"Pattern L",
"Pattern R",
"Input L",
"Input R"
]
}
This is probably better. Same amount of tracks but main output pair first instead of that weird "pattern" tracks before the inputs.
{
"pid": 2859,
"name": "Digitakt II",
"input_track_names": [
"Main L Input",
"Main R Input"
],
"output_track_names": [
"Main L",
"Main R",
"Track 1 L",
"Track 1 R",
"Track 2 L",
"Track 2 R",
"Track 3 L",
"Track 3 R",
"Track 4 L",
"Track 4 R",
"Track 5 L",
"Track 5 R",
"Track 6 L",
"Track 6 R",
"Track 7 L",
"Track 7 R",
"Track 8 L",
"Track 8 R",
"Track 9 L",
"Track 9 R",
"Track 10 L",
"Track 10 R",
"Track 11 L",
"Track 11 R",
"Track 12 L",
"Track 12 R",
"Track 13 L",
"Track 13 R",
"Track 14 L",
"Track 14 R",
"Track 15 L",
"Track 15 R",
"Track 16 L",
"Track 16 R",
"Delay L",
"Delay R",
"Reverb L",
"Reverb R",
"Chorus L",
"Chorus R",
"Input L",
"Input R"
]
}
thank you, what you shared makes a lot of sense. I have tried both but unfortunately I still get the same error.
A couple of things to mention.
You seem to not be using a RT kernel. This value comes from JACK. This should have nothing to do with the LIBUSB_TRANSFER_OVERFLOW
.
DEBUG:jclient.c:828:jclient_run: Using RT priority -828408246...
Please, post here the full output of overwitch-cli -vv
till the LIBUSB_TRANSFER_OVERFLOW
error appears. I want to check a couple of things that don't appear in the log above.
Yes, I forgot to mention, I'm not using the RT kernel. here's the logs:
overwitch-cli -vv DEBUG:overwitch.c:392:ow_get_device_desc_from_vid_pid: Device with PID 2859 found DEBUG:overwitch.c:254:ow_get_usb_device_list: Found Digitakt II (bus 007, address 003, ID 1935:0b2b) DEBUG:overwitch.c:392:ow_get_device_desc_from_vid_pid: Device with PID 2859 found DEBUG:engine.c:644:ow_engine_init: USB transfer timeout: 10 DEBUG:engine.c:544:ow_engine_init_mem: Blocks per transfer: 24 DEBUG:engine.c:557:ow_engine_init_mem: o2h: USB in frame size: 168 B DEBUG:engine.c:558:ow_engine_init_mem: h2o: USB out frame size: 8 B DEBUG:engine.c:567:ow_engine_init_mem: o2h: USB in block size: 1208 B DEBUG:engine.c:569:ow_engine_init_mem: h2o: USB out block size: 88 B DEBUG:engine.c:577:ow_engine_init_mem: o2h: audio transfer size: 28224 B DEBUG:engine.c:579:ow_engine_init_mem: h2o: audio transfer size: 1344 B DEBUG:engine.c:1385:ow_engine_load_overbridge_name: USB control in data (32 B): Digitakt II DEBUG:engine.c:1405:ow_engine_load_overbridge_name: USB control in data (16 B): 0041 1.03A DEBUG:dll.c:162:ow_dll_host_init: Initializing host side of DLL... DEBUG:jclient.c:218:jclient_set_sample_rate_cb: JACK sample rate: 48000 DEBUG:resampler.c:626:ow_resampler_set_samplerate: Setting resampler sample rate to 48000 DEBUG:jclient.c:828:jclient_run: Using RT priority -775979446... DEBUG:jclient.c:830:jclient_run: Registering ports... DEBUG:jclient.c:835:jclient_run: Registering output port Main L... DEBUG:jclient.c:835:jclient_run: Registering output port Main R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 1 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 1 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 2 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 2 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 3 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 3 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 4 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 4 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 5 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 5 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 6 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 6 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 7 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 7 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 8 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 8 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 9 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 9 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 10 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 10 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 11 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 11 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 12 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 12 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 13 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 13 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 14 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 14 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 15 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 15 R... DEBUG:jclient.c:835:jclient_run: Registering output port Track 16 L... DEBUG:jclient.c:835:jclient_run: Registering output port Track 16 R... DEBUG:jclient.c:835:jclient_run: Registering output port Delay L... DEBUG:jclient.c:835:jclient_run: Registering output port Delay R... DEBUG:jclient.c:835:jclient_run: Registering output port Reverb L... DEBUG:jclient.c:835:jclient_run: Registering output port Reverb R... DEBUG:jclient.c:835:jclient_run: Registering output port Chorus L... DEBUG:jclient.c:835:jclient_run: Registering output port Chorus R... DEBUG:jclient.c:835:jclient_run: Registering output port Input L... DEBUG:jclient.c:835:jclient_run: Registering output port Input R... DEBUG:jclient.c:853:jclient_run: Registering input port Main L Input... DEBUG:jclient.c:853:jclient_run: Registering input port Main R Input... DEBUG:engine.c:1211:ow_engine_start: Starting h2o MIDI thread... ERROR:jclient.c:674:set_rt_priority: Could not set real time priority DEBUG:engine.c:1224:ow_engine_start: Starting audio and o2h MIDI thread... ERROR:jclient.c:674:set_rt_priority: Could not set real time priority DEBUG:dll.c:56:ow_dll_overbridge_init: Initializing Overbridge side of DLL... DEBUG:jclient.c:208:jclient_set_buffer_size_cb: JACK buffer size: 1024 DEBUG:resampler.c:613:ow_resampler_set_buffer_size: Setting resampler buffer size to 1024 DEBUG:resampler.c:136:ow_resampler_reset_buffers: Resetting buffers... DEBUG:resampler.c:117:ow_resampler_clear_buffers: Clearing buffers... DEBUG:dll.c:174:ow_dll_host_reset: Resetting the DLL... DEBUG:resampler.c:199:ow_resampler_reset_dll: DLL target delay: 1872 frames (39.000000 ms) ERROR:engine.c:322:cb_xfr_audio_in: o2h: Error on USB audio transfer: LIBUSB_TRANSFER_OVERFLOW ERROR:engine.c:322:cb_xfr_audio_in: o2h: Error on USB audio transfer: LIBUSB_TRANSFER_OVERFLOW DEBUG:resampler.c:402:ow_resampler_compute_ratios: Starting up resampler... Digitakt II @ 007,003: o2h latency: -1.0 [-1.0, -1.0] ms; h2o latency: -1.0 [-1.0, -1.0] ms, o2h ratio: 1.000000, avg. 1.000000
I have produced the below log from playing around with rust nusb.
endpoint address: 131 In, interval:1 packets_per_microframe:1 max_packet_size:1012 transfer_type: Interrupt
it seems that max_packet_size = 1012
.
When setting a multiple of 1012 as buffer size, I managed to receive packets using rust nusb crate.
any number other then that it fails. Now I'm not sure how to map every packet to different audio channel.
1012 is a divisor of 44, shall I assume there is 44 channel ?
1012 is a divisor of 44, shall I assume there is 44 channel ?
Trying that wouldn't hurt, would it? Add the tracks to the JSON definition and see.
I watched the Exploring Syntakt OS 1.30 and Digitakt II with Overbridge // Live Dispatch video and the track "Pattern" is here but not here.
Take a look at this for more information about the higher level packets.
Perhaps, with the new devices, the unknown section at the top had changed its size or is not used anymore. (I believe this is the low level Overbridge messages.)
The package is defined here.
I'm about to try the new Overbridge update on Windows.
I will report back on the number of channels that I see.
I am attaching some screenshots.
I see the 16 tracks with panning, so those must be stereo tracks. That makes 32 mono channels for the tracks.
Then I see the Delay
, Reverb
and Chorus
channels without panning but the VU meter still has two bars so they must be stereo. That means 6 additional mono channels. The total is 32 + 6 = 38 so far.
Then there is the main output which is two more mono channels. 38 + 2 = 40.
And then there is the external input, which is two more mono channels as well. That makes 40 + 2 = 42 output channels.
Both the OB app and the OB manual suggests that there are 4 stereo inputs: D.7 DIGITAKT II CHANNELS
If we go with that then there are 42 output channels and 8 input channels, or a total of 50.
I remember that when the Syntakt came out, it actually had fewer channels than what the manual or the OB app suggested so I don't know if we can trust the manual.
I am not sure if it matters but the USB descriptors look different.
I've just created the fix-overbridge-cc-midi
branch to work on this issue and on #66.
I am comparing the USB endpoints of the DT1 and DT2. They both have the same descriptors but two endpoints on the DT2 have a larger max packet size.
One endpoint is 0x83
which went from 368 to 1012 bytes and another is 0x03
which from 88 to 256 bytes.
0x83
is for data coming from the DT.
0x03
is for data going towards the DI.
I cannot see a correlation between the packet size and the number of channels between the two devices.
I don't think the error is related to the incorrect inputs but that is surely wrong.
This is a Overbridge-to-host transfer error. But perhaps it's caused by the incorrect inputs and we don't see the relation.
Keep in mind that this was caused by the code at master not the code in fix-overbridge-cc-midi
.
ERROR:engine.c:322:cb_xfr_audio_in: o2h: Error on USB audio transfer: LIBUSB_TRANSFER_OVERFLOW
Have any of you tested this configuration?
{
"pid": 2859,
"name": "Digitakt II",
"input_track_names": [
"Main L Input",
"Main R Input",
"Delay L Input",
"Delay R Input",
"Reverb L Input",
"Reverb R Input",
"Chorus L Input",
"Chorus R Input"
],
"output_track_names": [
"Main L",
"Main R",
"Track 1 L",
"Track 1 R",
"Track 2 L",
"Track 2 R",
"Track 3 L",
"Track 3 R",
"Track 4 L",
"Track 4 R",
"Track 5 L",
"Track 5 R",
"Track 6 L",
"Track 6 R",
"Track 7 L",
"Track 7 R",
"Track 8 L",
"Track 8 R",
"Track 9 L",
"Track 9 R",
"Track 10 L",
"Track 10 R",
"Track 11 L",
"Track 11 R",
"Track 12 L",
"Track 12 R",
"Track 13 L",
"Track 13 R",
"Track 14 L",
"Track 14 R",
"Track 15 L",
"Track 15 R",
"Track 16 L",
"Track 16 R",
"Delay L",
"Delay R",
"Reverb L",
"Reverb R",
"Chorus L",
"Chorus R",
"Input L",
"Input R"
]
}
I have and I just get a barrage of ERROR:engine.c:295:cb_xfr_audio_in: o2h: Error on USB audio transfer: LIBUSB_TRANSFER_OVERFLOW
error messages.
My DT1 works fine on the same USB port and via the same cable so at least it should not be an issue with my system configuration.
The error is also present on fix-overbridge-cc-midi
. I just don't MIDI errors.
We get 8832 bytes from the DT1 which is 24 368 or in other words 24 the packet size of the 0x83
endpoint.
By applying the same logic, I would expect to have 24288 bytes coming from the DT2 but it is only 2112 instead.
Ignore that. I forgot that I made some changes to my devices.json
file.
I think there are 21 blocks sent in 0x83
for DTII. I see 21252 bytes in the interrupt response through wireshark, 21252/1012 = 21, does that make sense?
audio_in_blk_len
seems to come out too high. It is 1208
for the DT2 but it is 368
for the DT1. I was actually able to make the errors disappear by reducing the number of output channels to 35. That way audio_in_blk_len
was 1012
The only sound I got was noise from a single channel, but there were no errors at least.
devices.json
updated.
@szszoke, there is no relation between Max Packet Size and the transfer size at usblevel
AFAIK.
The library takes care of this and splits a high level transfer into as many USB packet transfers as needed.
But... https://libusb.sourceforge.io/api-1.0/libusb_packetoverflow.html
You mention 1012 but I don't see that number in the device descriptors.
@dagargo 1012 is mentioned here:
I can confirm what @nchouba has found that there only seem to be 21 frames sent. This is also true for the DT1. I guess this depends on how many frames is asked for by OB/OW.
I did some more thinking and testing.
We have 1012 bytes for a frame. He first 2 bytes are for a fixed header. The second two are for the frame counter. That leaves us with 1008 bytes. The calculated frame size by OW is 168 bytes. OW is calculating with 7 frames but I figured that was too much.
I tried to play around with OB_PADDING_LEN
and OB_FRAMES_PER_BLOCK
OB_PADDING_LEN |
OB_FRAMES_PER_BLOCK |
Overflow errors | Sound from main outputs | |
---|---|---|---|---|
0 | 6 | no | disted sound even when nothing playing | |
168 | 5 | no | distorted sound but it seems to resemble what is actually playing | |
336 | 4 | no | distorted sound but it seems to resemble what is actually playing |
The channel names do not seem to reflect the actual channels that can be heard. I need to do more digging.
A few things to mention.
I've pushed 71ec6c6c244c4f3d149365758b18f0cec9131484 to print the actual transfer length in case of error.
This is an explanation for the log and the calculated sizes.
This is the amount of channels times the sample size (4 B).
DEBUG:engine.c:557:ow_engine_init_mem: o2h: USB in frame size: 168 B
DEBUG:engine.c:558:ow_engine_init_mem: h2o: USB out frame size: 8 B
This is block header (32 B or 4 B plus OB_PADDING_LEN
) plus 7 times (7 frames) the frame size.
DEBUG:engine.c:567:ow_engine_init_mem: o2h: USB in block size: 1208 B
DEBUG:engine.c:569:ow_engine_init_mem: h2o: USB out block size: 88 B
This is the previous value times the amount of blocks.
DEBUG:engine.c:577:ow_engine_init_mem: o2h: audio transfer size: 28224 B
DEBUG:engine.c:579:ow_engine_init_mem: h2o: audio transfer size: 1344 B
The calculated USB block size for the DT1 is the same as the packet length for the 0x31
USB endpoint but for the DT2 it ends up being larger. When I tweaked things to get that number to 1012 then the overflow errors went away but even then the sound is very distorted.
@dagargo xfr->actual_length
seems to be 0
so the lines you added print 0 B
. xfr->length
seems to hold non-zero values.
I missed this log line (there are a lot of them):
DEBUG:resampler.c:263:resampler_o2h_reader: o2h: Audio ring buffer underflow (0 < 16800). Replicating last samples...
I also noticed that If I just play a trig, some of them don't make any sound but some of them do, and those start out more like noise but near the end they sound very close to what they should be sounding.
I think I've understood you both now.
Looks that you're right and wMaxPacketSize
is the Overwitch block size. I never realized about it!
The amount of tracks can be inferred then from the block size.
Digitakt (368 B):
>>> (368 - 32) / 7 / 4
12.0
Digitakt II (1012 B):
>>> ((1012 - 32) / 7) / 4
35.0
Digitakt II input (256 B) matches too.
Perhaps some tracks are 16 bits and other 32 bits or even 24 bits. However, the frame size should be 140 B.
Enough for today.
I am comparing data packets of silence and then the individual tracks playing. 8 additional bytes after the 28 bytes of padding don't seem to respond any way when I am playing some tracks.
The next 8 bytes light up however when I play track 1. Then the next 8 bytes light up when I play track 2.
This to me suggests that the outputs from the tracks are 4 bytes for each channel.
I will test all the channels just to confirm.
I had to do some extra checks with panning the tracks to left and right to make sure but based on what bytes are changing when individual tracks are played some tracks send 4 bytes per channel and some send 3 bytes per channel.
Track 1- 6 has 4 bytes / channel. Track 7 - 16 has 3 bytes / channel.
There are some sections that never go back to zero when I am not playing anything so I'm guessing they are not containing any audio.
I am attaching a ZIP file with my captured packets.
@szszoke and I have been working a solution to make the Digitakt II to work with Overwitch. We have tested and it's fully working now.
@nchouba, could you please give it a try and report here?
Once you confirm this, I'll merge the branch into master.
The solution is in the fix-overbridge-cc-midi
branch, which has been rebased.
wow, you are really amazing guys it works :). just curios about the change, is the first 14th channels require a bit shift?
is the first 14th channels require a bit shift?
Yes, it's exactly that. The remaining channels are 3 bytes only.
Branch merged into master.
It's still unknown if the protocol is the same.
USB product definitions for all the possible Digitakt II USB configurations should be added to
udev/20-usb-elektron.hwdb
.