wir35 / marf

Source code for electronic music store MARF 248r
MIT License
19 stars 2 forks source link

Glitches in vertical sequencer patch #24

Closed norjad closed 2 years ago

norjad commented 2 years ago

Beta 4

I tried Ciani's vertical sequencer patch today: four CV pitch sequences coming from the 225e to MARF's external inputs. A pulse from the 225e (or the note pulse from one of the sequences: same result) connected to START/STOP of AFG1, running the sequence.

When all sliders are set to the same EXT (A, B, C or D) there are no issues. But when I set for instance all sliders to A and just a single slider to B (or C or D), I hear a glitch at that point. Sounds like the step set to the different EXT is playing partly the previous EXT, partly the selected EXT.

That did not happen with the very first beta Max sent to me (don't know if that was beta 1 or even earlier).

maxl0rd commented 2 years ago

Thanks for the report. I am aware of this problem but I don't have a solution worked out yet.

The root cause is that the trigger pulse starts the step before the ADC has acquired the voltage change on the external input. So the step starts with the voltage at the old value and then it jumps to the new value after a few ms. This problem was uncovered when I tightened up the pulse timing. It used to have a lot of latency itself that it masked this problem.

The problem with fixing this is that it forces us to introduce some latency somewhere which makes the timing sloppy.

waldnzwrld commented 2 years ago

The problem with fixing this is that it forces us to introduce some latency somewhere which makes the timing sloppy.

Would it be possible to read ahead?

norjad commented 2 years ago

How many ms does the readout take? If there's no other way to speed it up, I assume introducing the required amount of latency (or a combination of latency and slope) when using EXT CV would be the only way to get rid of the glitches.

maxl0rd commented 2 years ago

It's not possible to read ahead, since the issue occurs when a pulse updates the sequencer feeding the ext in and triggers the stage simultaneously. The same issue happens with stage address strobe.

It wasn't easy to figure out, but I've come up with a solution to this which is implemented now. Immediately after seeing a pulse the main loop goes into a mode where it scans the external inputs and the stage address cvs as fast as possible and then it processes the mode change from the pulses. This seems to add about 1ms of latency before the stage can begin, but I think I can live with that.

The vertical sequencer patch should be glitch free again.

norjad commented 2 years ago

Thanks, Max. Sounds like a great solution. I think 1 ms latency is more than acceptable to solve this problem. Looking forward to the next build!

maxl0rd commented 2 years ago

Resolved in beta 5 (marf-v2-66-2022-07-13.hex.zip)