A trig in (like the Clock in for Ardcore)q

Discussion, support, and resources for our noise making modules and kits.

Moderators: Kent, scottwilson

Post Reply
User avatar
Alwaysnew
Wiggling with Experience
Posts: 361
Joined: Thu Feb 23, 2012 8:55 am
Location: Stockholm

A trig in (like the Clock in for Ardcore)q

Post by Alwaysnew » Sat Oct 18, 2014 10:46 am

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?

User avatar
scottwilson
Wiggling with Experience
Posts: 435
Joined: Mon Sep 16, 2013 12:54 pm

Post by scottwilson » Sat Oct 18, 2014 11:48 am

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- ... rigger.cpp

Code: Select all

	/* 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 &#40;this->clockInput != DIGITAL_IN_NONE && &#40;this->clockState != 0&#41; && &#40;&#40;this->clockState + 20&#41; < t&#41; && !digitalRead&#40;this->clockInput&#41;&#41;
	&#123;
		this->clockState = 0;
	&#125;

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

Here's some pseudo code:

Code: Select all


Start out by setting the clockState to false in init&#40;&#41;

Every loop&#40;&#41; check digitalRead&#40;clkIn&#41;

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

User avatar
mckenic
pew!pew!pew!kthnxbye!
Posts: 6450
Joined: Fri Aug 06, 2010 8:05 pm
Location: Limerick, Ireland

Post by mckenic » Sat Oct 18, 2014 12:32 pm

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

User avatar
Alwaysnew
Wiggling with Experience
Posts: 361
Joined: Thu Feb 23, 2012 8:55 am
Location: Stockholm

Post by Alwaysnew » Sat Oct 18, 2014 1:22 pm

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

User avatar
mckenic
pew!pew!pew!kthnxbye!
Posts: 6450
Joined: Fri Aug 06, 2010 8:05 pm
Location: Limerick, Ireland

Post by mckenic » Sat Oct 18, 2014 1:31 pm

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!

:tu:

User avatar
scottwilson
Wiggling with Experience
Posts: 435
Joined: Mon Sep 16, 2013 12:54 pm

Post by scottwilson » Sat Oct 18, 2014 3:18 pm

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.

[video][/video]

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

s

Post Reply

Return to “nw2s”