MUFF WIGGLER Forum Index
 FAQ & Terms of UseFAQ & Terms Of Use   Wiggler RadioMW Radio   Muff Wiggler TwitterTwitter   Support the site @ PatreonPatreon 
 SearchSearch   RegisterSign up   Log inLog in 
WIGGLING 'LITE' IN GUEST MODE

A trig in (like the Clock in for Ardcore)q
MUFF WIGGLER Forum Index -> nw2s  
Author A trig in (like the Clock in for Ardcore)q
Alwaysnew
Can this be done?
I guess for the digital ins that should work?
My problem is that if I want a play-next-note-on-trig-in I always get a number of triggers, i.e. the next note goes to next and next and so on, in other words it reads a gate. But how do I treat it as a trigger in?
scottwilson
I'm working on a slave clock that will do this plus serve as a multiplier/divider, but until then you can look at the code I just committed for a trigger input for the grid controller.

https://github.com/nw2s/b/blob/b-1.1.0-unstable/sketches/libraries/nw2 s/GridTrigger.cpp

Code:

   /* Clock is rising */
   if (this->clockInput != DIGITAL_IN_NONE && !this->clockState && digitalRead(this->clockInput))
   {
      this->clockState = t;

      /* Simulate a clock pulse */
      this->reset();
   }
   
   /* Clock is falling and at least 20ms after rising */
   if (this->clockInput != DIGITAL_IN_NONE && (this->clockState != 0) && ((this->clockState + 20) < t) && !digitalRead(this->clockInput))
   {
      this->clockState = 0;
   }



The gist is that you need to track rising and falling states.

Here's some pseudo code:


Code:


Start out by setting the clockState to false in init()

Every loop() check digitalRead(clkIn)

If clkIn true AND clockState is false, then that's the rising edge.
 
 - On the rising edge set clockState to true
 - On the rising edge do whatever you need to do on a clock cycle

If clkIn is true and clockState is true, then it's not a rising edge or a falling edge so do nothing.

If clkIn is false and clockState is true, then it's a falling edge

 - On the falling edge reset clockState to false




Once you get that working, you can optionally add some de-bouncing in there to make sure that you only track falling edges after at least 10 or 20ms after the rising edge.

Hope that helps...


s
mckenic
Forgive me for jumping in here...

My time plans went out the window, rolling deadlines meant I couldn't invest the time I wanted with my ::b yet.

If I could ask, I don't want to 'emulate' everything that coming out etc but would stuff like the Zularic Repetitor/Grids type clocking and trigger gen be feasible?

Sorry again!
Dave
Alwaysnew
mckenic if you're looking for Grids type stuff I might have just what you need (and more) here: https://github.com/Magnus-G/nw2sFrameworkControl
mckenic
Thank you very much Alwaysnew!!!

I have an expanded Turing, Wogglebug & Grids set-up and for the past 12 months have been obsessed with crazy random rhythms! I imagine the ::b would be brilliant at this so very much appreciated!

DL'd the docs and will have a poke!

thumbs up
scottwilson
Another way to get grids-like behavior, but with customizable patterns is if you check out the probabilistic trigger sequencer ino.

It's set up so that you have a matrix of probabilities that a trigger will occur on any given beat. The probabilities are CV adjustable in real time as well.



(There may also be a monome version of this soon...)

s
MUFF WIGGLER Forum Index -> nw2s  
Page 1 of 1
Powered by phpBB © phpBB Group