Closed szszoke closed 2 years ago
I was thinking exactly about this.
I'll release both Overwitch and Elektroid once you add the device and check it out.
Thanks for taking care of this!
No worries! I don't have a confirmation on the delivery date yet but hopefully it well be here early next week.
oh great!
I have a tracking number and I'm hoping that I get my delivery this week.
It arrived. The outputs seem to work (including monitoring the two physical inputs). MIDI In and Out needs to be tested. There is something with the OB main inputs. Audio that is routed in via them sounds high pitched.
#define OB_MAX_TRACKS 20
...
static const struct ow_device_desc SYNTAKT_DESC = {
.pid = STAKT_PID,
.name = "Syntakt",
.inputs = 2,
.outputs = 20,
.input_track_names = {
"Main L Input", "Main R Input"},
.output_track_names =
{"Main L", "Main R", "Track 1", "Track 2", "Track 3", "Track 4",
"Track 5", "Track 6", "Track 7", "Track 8", "Track 9", "Track 10",
"Track 11", "Track 12", "FX Track L", "FX Track R", "Delay/Reverb L",
"Delay/Reverb R", "Input L", "Input R"},
.output_track_scales =
{OW_CONV_SCALE_32, OW_CONV_SCALE_32, OW_CONV_SCALE_32, OW_CONV_SCALE_32,
OW_CONV_SCALE_32, OW_CONV_SCALE_32, OW_CONV_SCALE_32, OW_CONV_SCALE_32,
OW_CONV_SCALE_32, OW_CONV_SCALE_32, OW_CONV_SCALE_32, OW_CONV_SCALE_32,
OW_CONV_SCALE_32, OW_CONV_SCALE_32, OW_CONV_SCALE_32, OW_CONV_SCALE_32,
OW_CONV_SCALE_32, OW_CONV_SCALE_32, OW_CONV_SCALE_32, OW_CONV_SCALE_32}
};
Congrats on your new acquisition. That was fast!
20 outputs... It's quite a lot.
I have a hypothesis. If the pitch is increased by a X ratio, it is because Overwitch sends less tracks than expected exactly in the same ratio. If pitch frequency is twice, it is because there should be twice the outputs. Could you try with 4 output tracks?
Perhaps, the analog drums or the FX track are audio destinations too.
I tried with 4 tracks as well but then I get audio overflows. I think there are 4 tracks. On Windows I can route to Main L/R and Pre FX L/R.
Then there are definitely 4 tracks.
The issue is probably in the code. I'll take a look later.
Or perhaps the Overbridge packages are different.
Is there anything interesting in the console output with 4 tracks enabled? If so, post them here, please. Or are the overflows just audible?
When I said Overbridge packages I meant the structure of the Overbridge frames and the layout of the different tracks in them.
I am logging some extra variables:
resampler.c:319:error_print ("j2o: Audio ring buffer overflow. %ld %ld %ld Discarding data...\n", gen_frames, bytes, wsj2o);
This output repeats:
ERROR:resampler.c:319:(ow_resampler_write_audio): j2o: Audio ring buffer overflow. 1024 16384 12991 Discarding data...
ERROR:resampler.c:319:(ow_resampler_write_audio): j2o: Audio ring buffer overflow. 1024 16384 15167 Discarding data...
ERROR:resampler.c:319:(ow_resampler_write_audio): j2o: Audio ring buffer overflow. 1024 16384 14655 Discarding data...
ERROR:resampler.c:319:(ow_resampler_write_audio): j2o: Audio ring buffer overflow. 1024 16384 11199 Discarding data...
ERROR:resampler.c:319:(ow_resampler_write_audio): j2o: Audio ring buffer overflow. 1024 16384 13375 Discarding data...
ERROR:resampler.c:319:(ow_resampler_write_audio): j2o: Audio ring buffer overflow. 1024 16384 15551 Discarding data...
It also makes the Syntakt partially lock up and not react to the play button until a reboot. If I don't connect anything to the inputs then this issue doesn't come up.
Another hypothesis. What if there are 4 tracks of 16 bits values instead of 32 bits?
Was the sound with 2 tracks clean and high pitched or had some distortion in it? If distortion was present, I suspect some digital audio might get into the analog FX.
Could you check if there is audio leaked in the FX track when using 2 tracks?
With two tracks the sound is high pitched and no distortion is present. With four tracks the sound is high pitched and distorted.
With only two tracks, the high pitched sound can be heard from both the Main L/R outputs and the FX Track L/R outputs.
Not sure if it's the right way to do it but nothing changes if I set p2o_frame_size
like this:
engine->p2o_frame_size = 2 * engine->device_desc->inputs
The underlying hypothesis is that they keep the same structure at a USB level as in the case with 2 inputs but they transmit 4 inputs.
This is the block description made by Stefan Rehm in dtdump and included in Overwitch.
As it can be seen, samples are 32 bits. My guessing is that in this case these are 16 bits.
There are 3 possible scenarios here:
Considering that the audio was high pitched and distorted I consider that our best candidate is the first option as we were providing the higher bits as the sample and the lower as just noise and both the audio and the Main and FX tracks would be the same (if mono).
This is the patch for the first scenario. We set 2 32 bits words for every 4 samples from JACK.
$ git diff
diff --git a/src/engine.c b/src/engine.c
index 18dc6c1..6355006 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -269,11 +269,19 @@ set_blocks:
s = blk->data;
for (int j = 0; j < OB_FRAMES_PER_BLOCK; j++)
{
- for (int k = 0; k < engine->device_desc->inputs; k++)
+ for (int k = 0; k < 4; k += 4)
{
- hv = htobe32 ((int32_t) (*f * INT_MAX));
- *s = hv;
+ int32_t hv1 = htobe16 ((int16_t) (*f * SHRT_MAX)) << 16;
f++;
+ int32_t hv2 = htobe16 ((int16_t) (*f * SHRT_MAX)) << 16;
+ f++;
+ hv1 |= 0xffff & htobe16 ((int16_t) (*f * SHRT_MAX));
+ f++;
+ hv2 |= 0xffff & htobe16 ((int16_t) (*f * SHRT_MAX));
+ f++;
+ *s = hv1;
+ s++;
+ *s = hv2;
s++;
}
}
This is the patch for the second scenario, which is easier to implement. For ever track pair, we set 1 32 bits word.
$ git diff
diff --git a/src/engine.c b/src/engine.c
index 18dc6c1..0cc0305 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -269,9 +269,11 @@ set_blocks:
s = blk->data;
for (int j = 0; j < OB_FRAMES_PER_BLOCK; j++)
{
- for (int k = 0; k < engine->device_desc->inputs; k++)
+ for (int k = 0; k < 4; k += 2)
{
- hv = htobe32 ((int32_t) (*f * INT_MAX));
+ hv = htobe16 ((int16_t) (*f * SHRT_MAX)) << 16;
+ f++;
+ hv |= 0xffff & htobe16 ((int16_t) (*f * SHRT_MAX));
*s = hv;
f++;
s++;
Keeping my fingers crossed.
I tried both but it did not make a difference. There is one more variable. Pipewire. I will try to rig up a machine with Jack and see if I'm still getting the buffer overflow.
I forgot to mention that both the above tweaks will only work with Syntakt as a 2 inputs device. With 4 inputs it will behave erratically.
Anyway, let's focus on JACK for now.
Then I did the test wrong. I will test again with just two input devices.
I get a constant static sound with the first patch on Main L and high pitch with some distortion if I apply the second patch.
I performed all the tests with Jack2 and the results are more or less the same. The only difference is that if I apply the second patch then I get static on Main R which I do not get with Pipewire.
Just to be sure, have you tried without any patch with 4 inputs?
I tested the following:
I tested first with Pipewire, then I uninstalled the Jack implementation of Pipewire, installed Jack2 and tested again.
What's the value of STAKT_PID
?
#define STAKT_PID 0x001e
Makes you wonder if some Elektron box is missing from overwitch.c
or there is something in the works based on the skipped PID
#define DKEYS_PID 0x001c
#define STAKT_PID 0x001e
Makes you wonder if some Elektron box is missing from overwitch.c or there is something in the works based on the skipped PID
Yeah, they've skipped some numbers here and there.
I've added support for the Syntakt following the official description found in the Overbridge 2.1 manual, page 40.
It definitely has 8 inputs as the 4 analog drum tracks have an audio input (same as in Analog Rytm).
Looks like it has "only" 16 outputs: main (stereo), Analog FX out (stereo) and the 12 individual tracks. You reported 20 tracks and perhaps there are a couple more being the analog Syntakt inputs. But I'm not sure about the Digital FX output pair. This will never mess with the USB system as the only thing will happen is that packages will not inject audio into those phantom tracks.
Could you try this? Probably the USB packages length, which are calculated on the number of tracks, were messing with the audio.
I redid my testing with 20 individual output tracks and Jack.
There is Main Left and Right. There are the 12 tracks. There are the physical Input L and R tracks. Then there are two more for Reverb/Delay and two more for the FX out.
Main Left and Right outputs the main mix.
The 12 individual track outputs play the 12 individual tracks on the Syntakt if I press their trigger button.
The two physical input tracks play the signal that I inject via the physical input jacks.
The two Reverb/Delay tracks don't play anything unless I increase the Reverb or Delay send on a track and trigger it. If I do that then they just play the wet signal.
The two FX out tracks don't play anything unless I enable the insert for a track via the Routing
page and trigger it.
This reflects how the Overbridge standalone app lists the outputs.
I will pull master and try your changes now.
I get a segmentation fault with the latest master
:
(gdb) exec-file overwitch-cli
(gdb) run -n 0
Starting program: /home/eon/Downloads/overwitch/src/overwitch-cli -n 0
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff71ac640 (LWP 16094)]
[Thread 0x7ffff71ac640 (LWP 16094) exited]
[New Thread 0x7ffff71ac640 (LWP 16095)]
[New Thread 0x7ffff684f640 (LWP 16096)]
[New Thread 0x7ffff604e640 (LWP 16097)]
[New Thread 0x7ffff5e0f640 (LWP 16098)]
Cannot lock down 107341340 byte memory area (Cannot allocate memory)
ERROR:jclient.c:484:(jclient_run): Error while registering JACK port
Thread 4 "overwitch-cli" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff684f640 (LWP 16096)]
0x00007ffff7f42b68 in jack_ringbuffer_free () from /usr/lib/libjack.so.0
The segmentation fault is caused by Analog FX L Input
and Analog FX L
appearing twice.
Regardless, I am getting a ton of errors like this one :point_down: with 8 inputs and 16 outputs:
ERROR:engine.c:292:(cb_xfr_in): o2p: Error on USB audio transfer: Other error
The manual is not very precise about the device outputs as both Digitone and Digitakt do not include either the main or the physical inputs.
It makes sense that it has 20 outputs. All in all, it was working for you before.
Could you try again with the same outputs you provided? I've just pushed b97e8128c0f1e6cd98d169fa105a91f92e5a9ca0.
I am still getting the same libusb before. Did you mean to leave .outputs
at 16?
I am still getting the same libusb before. Did you mean to leave .outputs at 16?
Oops! I didn't mean it, sorry. Fixed in bfd891d4bdb183f172bbe2d9b0b67120fddcfdcb.
I will try to record the high pitched audio tomorrow and upload it here.
I'm thinking that if we can turn it into the "original" then may we can find out what is wrong with the inputs.
Other than that I can't think of anything but to inject a pure sine wave into the inputs and capture the USB packets.
Would they be the same between the ritterent devices?
I'm thinking that if we can turn it into the "original" then may we can find out what is wrong with the inputs.
That's a very good idea. Perhaps it's just an endianness issue.
Would they be the same between the ritterent devices?
The protocol and the packages are exactly the same. Only the amount of tracks per USB package is what makes them different.
Let's leave it here for today but I have one last question. Has your Syntakt became unresponsive with the last code? If not, then we're on the right track.
I guess the audio tracks from the Syntakt to the CP are working well.
It only ever locked up when it was paying back and I connected something to the input tracks in Jack/Pipewire and I have not tried that today.
I will test it tomorrow.
I tested and it still locks up when I connect something to the input tracks that plays a sound. (But not if no sound is coming)
I tested with a pure sine wave note from the Digitone which sounded distorted and beyond recognition.
If you have new code revisions to test, I can do that but I will probably put debugging on hold and play the thing a bit.
At least the outputs are working so people can record.
Sure, enjoy your Syntakt and we can continue next week.
I'll take a look at the code as the issue is most probably there.
Thanks!
I've added a couple of tests to the check if the audio is properly copied between JACK and the resampler and between the engine and the USB stack and everything looks right.
Just in case, are you still having issues with this?
Hi, I just got a Syntakt and I'm trying to use Overwitch on Ubuntu. I'm not familiar with autotools but I followed the installation instructions step by step and (after some complaints and a couple of cautionary reboots) the three binaries seem to be properly installed.
I'm getting mixed results so far.
This part looks good:
overwitch-cli -vv -l
DEBUG:overwitch.c:227:(ow_get_devices): Found Syntakt (bus 001, address 014, ID 1935:001e)
0: Syntakt (ID 1935:001e) at bus 001, address 014
Inputs:
Main L Input
Main R Input
Analog FX L Input
Analog FX R Input
Track 9 Input
Track 10 Input
Track 11 Input
Track 12 Input
Outputs:
Main L
Main R
Track 1
Track 2
Track 3
Track 4
Track 5
Track 6
Track 7
Track 8
Track 9
Track 10
Track 11
Track 12
Analog FX L
Analog FX R
Delay/Reverb L
Delay/Reverb R
Input L
Input R
But that's it, from here I hit the same wall:
$ overwitch-cli -vv -n 0
DEBUG:overwitch.c:227:(ow_get_devices): Found Syntakt (bus 001, address 014, ID 1935:001e)
ERROR:engine.c:704:(ow_engine_init_from_bus_address): Error while opening device: LIBUSB_SUCCESS / LIBUSB_TRANSFER_COMPLETED
ERROR:jclient.c:394:(jclient_init): Overwitch error: can't find a matching device
The same error appears with -d Syntakt
. Same when clicking on the "reload" button on Overwitch.
overwitch-dump -l -v
gives the same correct output as above. However...
$ overwitch-dump -n 0
ERROR:engine.c:704:(ow_engine_init_from_bus_address): Error while opening device: LIBUSB_SUCCESS / LIBUSB_TRANSFER_COMPLETED
ERROR:main-dump.c:324:(run_dump): can't find a matching device
@quimgil, your issue was reported in #33 and I have just improved the error message because it was totally misleading. Take a look there for more details.
Thank you! Issue resolved, and now I can get Syntakt's audio on Bitwig via USB.
Syntakt is identified as "Syntakt@001,014"
When adding mono inputs, the DAW lets me choose from the 20 outputs listed above, with those exact names. I could test the 12 Tracks (side question, Syntakt's tracks are mono, right?).
When adding stereo inputs, these options are available:
Analog FX
Delay/Reverb
Input
Main
Track 1
Track 11
Track 2
Track 4
Track 6
Track 8
I still need to learn more about Syntakt to understand the difference between Main and Input, and to do anything with FX & Delay/Reverb. And I don't get the logic of the tracks offered (I guess I can just ignore tracks for stereo input?)
Anyway, progress! Thank you very much for your work on this very useful piece of software.
I don't know whether you are interested in overwitch-dump feedback yet, but just in case it helps:
$ overwitch-dump -v -d Syntakt
DEBUG:overwitch.c:227:(ow_get_devices): Found Syntakt (bus 001, address 014, ID 1935:001e)
Segmentation fault (core dumped)
Syntakt's tracks are mono, right?
You're correct. Syntakt is a 20 mono outputs and 10 mono inputs Overwitch device. There are no stereo tracks, although two tracks with the same name but the L and R at the end could be considered as a stereo track.
I still need to learn more about Syntakt to understand the difference between Main and Input
This is particularly confusing.
When adding stereo inputs, these options are available: Analog FX Delay/Reverb Input Main Track 1 Track 11 Track 2 Track 4 Track 6 Track 8
Just to be clear, these are the 8 audio channels that go from Bitwig to your Syntakt. It looks weird as there should be 8 input tracks in your Syntakt named
Neither the names nor the amount match. Could you double check this o post a Bitwig capture or something?
This evening I turned on my PC, opened the Syntakt project in the DAW and... all the tracks I had configured were useless because this time Syntakt is on Address 13, this morning was in 14. Can this be prevented?
Just to be clear, these are the 8 audio channels that go from Bitwig to your Syntakt.
No, what I listed above were still inputs from Syntakt to Bitwig. In Bitwig you can add mono inputs or stereo inputs. What I wanted to say in my previous comment is that the list of mono inputs corresponds to overwitch-cli -vv -l
(good) but the list of stereo inputs is the one I posted above (with the weird list of tracks). The numbers fit (6 pairs of "stereo" tracks = 12 tracks) what is weird is the track numbers shown and, well, even the notion of listing stereo tracks when they are just different mono tracks puts in pairs.
I haven't got yet to sending audio from Bitwig to Syntakt. And at least right now I'm not even sure I'd need this. My main interest is to get the separate tracks on Bitwig for audio manipulation and mixing there.
I just tested which Syntakt track appeared where, in case it is useful. In the left you have the label visible in Bitwig when selecting Stereo inputs. In the right you have the pair of Syntakt tracks:
Track 1 - Track 1 & Track 10 Track 2 - T2 & T3 Track 4 - T4 & T5 Track 6 - T6 & T7 Track 8 - T8 & T9 Track 11 - T11 & T12
At least now it's clear why these "stereo" tracks have these labels. But as said, they are rather pointless. I wonder who tells Bitwig about the existence of these "stereo" tracks. Is it Overwitch via JACK or something that JACK alone comes up with?
This evening I turned on my PC, opened the Syntakt project in the DAW and... all the tracks I had configured were useless because this time Syntakt is on Address 13, this morning was in 14. Can this be prevented?
I'm sorry. I didn't think about this. I will remove this antifeature tomorrow. The reason for this was to avoid the same issue when more than one machine of the same type is used.
I wonder who tells Bitwig about the existance of these "stereo" tracks. Is it Overwitch via JACK or something that JACK alone comes up with?
No idea. I don't use Bitwig but from the POV of JACK, which is the audio server, there are only mono tracks in this case so I think is Bitwig trying to pair them alphabetically.
It is very easy to solve if we name the tracks adding an extra space for the single digits ones.
I think is Bitwig trying to pair them alphabetically.
Yes, that makes sense.
Is there anything else I can do to help testing?
I think is Bitwig trying to pair them alphabetically.
Yes, that makes sense.
Is there anything else I can do to help testing?
Can you test what happens if you send in some audio to the Overwitch input ports?
@quimgil, I've hopefully fixed the alphabetical ordering and removed the bus and address from the device name.
Let me know if this actually works for you.
I have one of them on it's way. I will do some testing once it is here.