AScustomWorks / AS

VCV Rack Modules
Other
114 stars 16 forks source link

Triggers MKx producing 1 sample momentary triggers #34

Closed MarcBoule closed 5 years ago

MarcBoule commented 5 years ago

Hi Alfredo,

I noticed a small potential problem with Tiggers MKI, MKII and MKIII, concerning the trigger outputs that are produced when using the momentary buttons. In Rack's standards:

https://vcvrack.com/manual/VoltageStandards.html#triggers-and-gates

triggers should last 1 millisecond, and in your modules I believe they last only one sample (at 44.1 kHz, that's only about 22.6 microseconds).

If we look at the code from MKI, we can see this since BtnTrigger.process() returns true only on the precise sample step where a rising edge was detected, the .value = volts will only last for that sample, and after it goes back to 0.0f in the else.

if (BtnTrigger.process(params[MOMENTARY_SWITCH].value)) {
        resetLight = 1.0;
        if (!running) {
            outputs[TRIGGER_OUT].value = volts;
        }
    }else{
        if (!running) {
             outputs[TRIGGER_OUT].value = 0.0f;
        }
    }

If you want to see why the current method can be problematic, connect the output of MKI into the clock of a PulseMatrix, and use momentary with 10V to advance the sequencer, and it will not advance since it won't detect the output of MKI as the triggers are too short.

If you want, a simple fix would be to use PulseGenerator in Digital.hpp, as indicated by Andrew in the link above.

Thanks for considering this! Cheers :-)

AScustomWorks commented 5 years ago

Hi Marc! As it happens I don't own the Pulse Matrix, so I tried the same with SEQ3, aepelzen's GATE SEQ and your own PhraseSeq... guess what? It worked just fine everywhere, so that Pulse Matrix is way too picky:D

But, this code is pretty old and won't hurt to update it to use pulses. Are you on Mac? I can send you the plugin after updating it to test it against Puse Matrix just to be sure everything is fine (already did the changes to MKI.

as-triggers

MarcBoule commented 5 years ago

From my understanding, when modules are optimized as Andrew has certainly done, they don't necessarily sample all the inputs at audio rate, such that they can miss a one sample trigger, hence the 1ms standard for triggers. No problem to test the new version, I PMed you in Facebook :-)

AScustomWorks commented 5 years ago

Code updated to use pulses on v 0.6.12, thanks Marc!