audio-driven counter

Jul 24, 2006 at 3:54pm

audio-driven counter

Hi all, I’m looking for a way to design a counter driven by an audio signal,
and although I figured out how to do it with a bunch of objects, I have a
feeling that there is a single object out there capable of this. My problem
with the solution below is that it involves a lot of object (this is only
still 16 steps) and I have to make a separate setup for negative
frequencies. If there isn’t I might have to build one, so please let me know
if there is already something like this out there.

-thijs

#P button 60 292 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 60 266 19 9109513 0;
#P newex 60 192 43 9109513 change~;
#P newex 60 242 33 9109513 edge~;
#P newex 60 216 37 9109513 ==~ -1.;
#P newex 361 93 36 9109513 *~ 16;
#P button 624 292 15 0;
#P newex 624 266 19 9109513 15;
#P newex 624 216 34 9109513 edge~;
#P newex 624 192 34 9109513 >=~ 15;
#P button 587 292 15 0;
#P newex 587 266 19 9109513 14;
#P newex 587 216 34 9109513 edge~;
#P newex 587 192 34 9109513 >=~ 14;
#P button 550 292 15 0;
#P newex 550 266 19 9109513 13;
#P newex 550 216 34 9109513 edge~;
#P newex 550 192 34 9109513 >=~ 13;
#P button 513 292 15 0;
#P newex 513 266 19 9109513 12;
#P newex 513 216 34 9109513 edge~;
#P newex 513 192 34 9109513 >=~ 12;
#P button 476 292 15 0;
#P newex 476 266 19 9109513 11;
#P newex 476 216 34 9109513 edge~;
#P newex 476 192 34 9109513 >=~ 11;
#P button 439 292 15 0;
#P newex 439 266 19 9109513 10;
#P newex 439 216 34 9109513 edge~;
#P newex 439 192 34 9109513 >=~ 10;
#P button 402 292 15 0;
#P newex 402 266 19 9109513 9;
#P newex 402 216 34 9109513 edge~;
#P newex 402 192 34 9109513 >=~ 9;
#P button 365 292 15 0;
#P newex 365 266 19 9109513 8;
#P newex 365 216 34 9109513 edge~;
#P newex 365 192 34 9109513 >=~ 8;
#P button 328 292 15 0;
#P newex 328 266 19 9109513 7;
#P newex 328 216 34 9109513 edge~;
#P newex 328 192 34 9109513 >=~ 7;
#P button 291 292 15 0;
#P newex 291 266 19 9109513 6;
#P newex 291 216 34 9109513 edge~;
#P newex 291 192 34 9109513 >=~ 6;
#P button 254 292 15 0;
#P newex 254 266 19 9109513 5;
#P newex 254 216 34 9109513 edge~;
#P newex 254 192 34 9109513 >=~ 5.;
#P button 217 292 15 0;
#P newex 217 266 19 9109513 4;
#P newex 217 216 34 9109513 edge~;
#P newex 217 192 34 9109513 >=~ 4.;
#P button 180 292 15 0;
#P newex 180 266 19 9109513 3;
#P newex 180 216 34 9109513 edge~;
#P newex 180 192 34 9109513 >=~ 3.;
#P button 143 292 15 0;
#P newex 143 266 19 9109513 2;
#P newex 143 216 34 9109513 edge~;
#P newex 143 192 34 9109513 >=~ 2.;
#P button 106 292 15 0;
#P newex 106 266 19 9109513 1;
#P newex 106 216 34 9109513 edge~;
#P newex 106 192 34 9109513 >=~ 1.;
#P flonum 361 41 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 361 66 79 9109513 phasor~;
#P connect 62 0 65 0;
#P connect 62 0 2 0;
#P connect 62 0 6 0;
#P connect 62 0 10 0;
#P connect 62 0 14 0;
#P connect 62 0 18 0;
#P connect 62 0 22 0;
#P connect 62 0 26 0;
#P connect 62 0 30 0;
#P connect 62 0 34 0;
#P connect 62 0 38 0;
#P connect 62 0 42 0;
#P connect 62 0 46 0;
#P connect 62 0 50 0;
#P connect 62 0 54 0;
#P connect 62 0 58 0;
#P connect 64 0 66 0;
#P connect 66 0 67 0;
#P connect 65 0 63 0;
#P connect 63 0 64 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 6 0 7 0;
#P connect 7 0 8 0;
#P connect 10 0 11 0;
#P connect 11 0 12 0;
#P connect 1 0 0 0;
#P connect 14 0 15 0;
#P connect 15 0 16 0;
#P connect 18 0 19 0;
#P connect 19 0 20 0;
#P connect 22 0 23 0;
#P connect 23 0 24 0;
#P connect 26 0 27 0;
#P connect 27 0 28 0;
#P connect 30 0 31 0;
#P connect 31 0 32 0;
#P connect 34 0 35 0;
#P connect 35 0 36 0;
#P connect 36 0 37 0;
#P connect 32 0 33 0;
#P connect 28 0 29 0;
#P connect 24 0 25 0;
#P connect 20 0 21 0;
#P connect 16 0 17 0;
#P connect 12 0 13 0;
#P connect 8 0 9 0;
#P connect 4 0 5 0;
#P connect 38 0 39 0;
#P connect 39 0 40 0;
#P connect 40 0 41 0;
#P connect 42 0 43 0;
#P connect 43 0 44 0;
#P connect 44 0 45 0;
#P connect 46 0 47 0;
#P connect 47 0 48 0;
#P connect 48 0 49 0;
#P connect 50 0 51 0;
#P connect 51 0 52 0;
#P connect 52 0 53 0;
#P connect 54 0 55 0;
#P connect 55 0 56 0;
#P connect 56 0 57 0;
#P connect 58 0 59 0;
#P connect 59 0 60 0;
#P connect 60 0 61 0;
#P connect 0 0 62 0;
#P window clipboard copycount 68;

#26906
Jul 24, 2006 at 4:17pm

try this :

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 49 70 14 196617 1;
#P newex 50 49 48 196617 loadbang;
#P user ezdac~ 295 194 339 227 0;
#P flonum 108 99 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 144 256 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 107 119 45 196617 phasor~;
#N counter;
#X flags 0 0;
#P newobj 145 233 66 196617 counter;
#P newex 145 193 28 196617 < ~ 0;
#P newex 145 157 35 196617 delta~;
#P newex 145 212 34 196617 edge~;
#P connect 9 0 6 0;
#P connect 8 0 9 0;
#P connect 0 0 3 0;
#P connect 3 0 5 0;
#P connect 6 0 4 0;
#P connect 4 0 1 0;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P window clipboard copycount 10;

#80950
Jul 24, 2006 at 4:22pm

maybe this might work:

phasor~ (or something to trigger sah~)

sah~ (trig input)

tapin~ 1
tapout~ 0

+~ (count increment here)

back into sah~ (sample input)

#80951
Jul 24, 2006 at 4:51pm

Thanks but that’s not what I meant. Sorry for being unclear. The reason why
I designed the patch I posted is because I want the audio signal to
represent a position in a step sequencer. This way I can manipulate the
audio (jump, reverse, shape whatever) and have the pattern position follow
the audio exactly. So my question is how to map an audio signal to a
position grid.

-thijs

On 7/24/06, Langdon C Crawford wrote:
>
> maybe this might work:
>
> phasor~ (or something to trigger sah~)
>
> sah~ (trig input)
>
> tapin~ 1
> tapout~ 0
>
> +~ (count increment here)
>
> back into sah~ (sample input)
>
>
>

#80952
Jul 24, 2006 at 5:10pm

hmm i probably still am not understanding, but
audio signal to position grid:

somesignal~ //any audio signal…

clip~ -1 1 //keep signal within limits

abs~ // make all positive

*~ 16. //or any number of step values

+~ 0.5 // round up

index~ stepBuff // buffer with 16 or any number step values poked into
it

steppyValues~ // yer grid output…

or if output from neg numbers should be different than pos,
replace abs~ with +~ 1.

#80953
Jul 24, 2006 at 5:24pm

techno~

#80954
Jul 24, 2006 at 6:07pm

ofcourse…lookup tables :-) thanks a lot. techno~ can also be used for
this, though it seems a little silly to use it only for this purpose.

best,
-thijs

On 7/24/06, Langdon C Crawford wrote:
>
> hmm i probably still am not understanding, but
> audio signal to position grid:
>
>
> somesignal~ //any audio signal…
>
> clip~ -1 1 //keep signal within limits
>
> abs~ // make all positive
>
> *~ 16. //or any number of step values
>
> +~ 0.5 // round up
>
> index~ stepBuff // buffer with 16 or any number step values poked into
> it
>
> steppyValues~ // yer grid output…
>
>
> or if output from neg numbers should be different than pos,
> replace abs~ with +~ 1.
>
>

#80955
Jul 24, 2006 at 6:18pm

i meant why not just use techno~ for the whole thing. its easy to control samples with it, play them backward, pitch curves and all that. you wouldnt need to bother with making a counter

#80956
Jul 24, 2006 at 6:44pm

Its just that I have other plans. I’m trying to design a couple of different
sequencing interfaces with other functions and capabilities than what techno
does, or any other standard max interface for that matter. I’m also working
with midi most of the time, so an audio sequence is not very useful in my
case.

-thijs

On 7/24/06, bin ray wrote:
>
>
> i meant why not just use techno~ for the whole thing. its easy to control
> samples with it, play them backward, pitch curves and all that. you wouldnt
> need to bother with making a counter
>
>

#80957
Jul 24, 2006 at 7:10pm

Thijs Koerselman wrote:
> If there isn’t I might have to build one, so please let me know if
> there is already something like this out there.

Why not just take an audio driven metro and a scheduler based counter?
Seems less expensive and for sure is as exact as your solution, can
unfold all the glory of the counter object and scales easily to a
million steps…

(Encapsulate it and you got a single object… ;-)

Stefan

#P window setfont “Sans Serif” 9.;
#P number 55 153 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user ezdac~ 130 116 174 149 0;
#P window linecount 1;
#N counter 1 16;
#X flags 0 0;
#P newobj 55 130 67 196617 counter 1 16;
#P newex 55 86 67 196617 >~ 0.5;
#P newex 55 108 67 196617 edge~;
#P flonum 55 43 67 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 55 64 67 196617 phasor~ 2.;
#P connect 1 0 0 0;
#P connect 0 0 3 0;
#P connect 2 0 4 0;
#P connect 4 0 6 0;
#P connect 3 0 2 0;
#P window clipboard copycount 7;


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#80958
Jul 24, 2006 at 10:27pm

try this one, it just needs a one bar long phasor and lets you control : division of a whole note, number of steps, swing in % and slack in ms….

hope it helps…

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 192 254 23 196617 abs;
#P newex 243 34 60 196617 loadmess 1;
#N vpreset 1;
#X append 1 2 8 165 108 number int 16 ; 11 411 9 GSwitch2 int 1 ; 18 290 63 number int 2 ; 23 15 9 number int 100 ; 24 131 67 number int 16 ; 28 376 117 number int;
#X append 1 2 0 ; 30 488 9 number int 5 ;;
#P preset 243 56 47 27;
#P number 9 488 117 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 284 373 27 196617 t b f;
#P number 117 376 35 9 0 100 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 114 365 68 196617 swing in %;
#P comment 46 16 75 196617 bpm;
#P comment 103 132 150 196617 division (speed of the sequence);
#P number 67 131 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 9 15 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 9 41 40 196617 / 240.;
#P newex 9 66 58 196617 phasor~ 1.;
#P newex 192 376 27 196617 t b f;
#P newex 117 409 195 196617 expr (240000/$f3) / $f2 * ($f1 / 100);
#P number 63 290 35 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 67 164 33 196617 t b i;
#P window linecount 3;
#P comment 144 165 56 196617 number of steps in sequence;
#P window linecount 1;
#P comment 122 427 68 196617 “swing (ms)”;
#P newex 9 361 39 196617 t i i;
#P newex 38 461 89 196617 pipe;
#P newex 9 388 27 196617 % 2;
#P user gswitch2 9 411 39 32 1 0;
#P newex 67 192 33 196617 / 16.;
#P newex 9 337 48 196617 change 0;
#P number 108 165 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 9 214 68 196617 rate~ 1. lock;
#P newex 9 312 64 196617 snapshot~ 2;
#P comment 49 243 55 196617 # of steps;
#P newex 9 243 40 196617 *~ 16.;
#P comment 99 292 68 196617 slack in ms;
#P comment 15 83 112 196617 phasor~ – one bar long;
#P comment 125 489 100 196617 step;
#P window linecount 4;
#P comment 212 256 61 196617 -to work with negative frequencies;
#P connect 23 0 22 0;
#P fasten 23 0 33 0 14 33 197 33;
#P connect 33 0 20 0;
#P connect 17 1 10 1;
#P connect 17 0 10 0;
#P connect 18 0 6 1;
#P connect 11 1 13 0;
#P fasten 14 0 11 1 14 382 43 382;
#P connect 12 0 11 0;
#P fasten 14 1 12 0 43 382 14 382;
#P connect 9 0 14 0;
#P connect 6 0 9 0;
#P connect 4 0 6 0;
#P connect 22 0 21 0;
#P connect 28 0 19 0;
#P connect 19 0 13 1;
#P fasten 20 0 19 0 197 407 122 407;
#P connect 20 1 19 1;
#P connect 29 1 19 2;
#P fasten 29 0 19 0 289 404 122 404;
#P connect 11 0 30 0;
#P fasten 13 0 30 0 43 482 14 482;
#P connect 21 0 7 0;
#P connect 7 0 4 0;
#P connect 10 0 7 1;
#P connect 32 0 31 0;
#P fasten 8 0 10 0 113 187 72 187;
#P fasten 8 0 4 1 113 236 44 236;
#P fasten 24 0 29 0 72 156 289 156;
#P connect 24 0 17 0;
#P window clipboard copycount 34;

#80959
Jul 24, 2006 at 10:59pm

#80960

You must be logged in to reply to this topic.