Forums > MaxMSP

is there a way to make a signal based onebang?


nit
July 12, 2009 | 3:28 pm

is there a way (or maybe a free external) to make something wich works like the onebang object wich accepts and outputs signals (preferably clicks)?


July 14, 2009 | 7:36 am

cshot~


July 14, 2009 | 7:55 am

[*~ ]



nit
July 14, 2009 | 9:55 am

thanks, i’ll have a look at cshot~

Roman Thilenius wrote on Tue, 14 July 2009 09:55
[*~ ]

how would you use that to make something similar to the onebang object?


July 14, 2009 | 10:13 am

if you send a click of 1.0 into the right inlet of a [*~ ] it
passes one sample only.

this way you can, for example, read out a certain sample value
of a given sample (in conjunction with count~ and maximum) or
seperate a certain sample from the rest.



nit
July 14, 2009 | 11:10 am

thanks, but how would you open the left inlet untill a click came trough and then close it immediatly?


July 14, 2009 | 1:43 pm

click~



nit
July 14, 2009 | 1:57 pm

i dnon’t get it, i want it to work like the onebang object. when you send a click~ in the right inlet, the left inlet should stay open until a click~ comes trough then immediatly closes for other click~’s into the left inlet.


July 14, 2009 | 4:34 pm

i think i get you now, but i must say "dont have too
much hope."

what you are trying to do – using clicks as triggers
in MSP – is an attempt to build logic on the signal
layer.

this is in many cases simply impossible: as soon as one
part of such a network works, you will always come to
another point where you again need a possibility of
triggering a 0 to 1 transition (the state) by a click
(the "bang").

the only method i can think of is using a special object
for that purpose, which is able to do this spike-to-state
conversion.
i dont know one, but maybe there is one.

-110


July 14, 2009 | 5:01 pm

would el.mask and el.clickhold be what you mean by spike-to-state?


July 14, 2009 | 7:31 pm

You could use edge~ to convert the clicks into bangs, then just use it with a regular onebang. The bangs that are output by the onebang can then be used to trigger click~ objects, envelopes, or whatever you want. Example:

– Pasted Max Patch, click to expand. –

July 14, 2009 | 8:54 pm
Stephen Lee wrote on Tue, 14 July 2009 21:31
You could use edge~ to convert the clicks into bangs, then just use it with a regular onebang.

i think he wants it to output signals not bangs.

just like [110.b1b0] but all-signal.

which i think is not possible with the standard objects, but
go and try it if someone thinks he knows how.

-110

.


July 14, 2009 | 9:42 pm
Roman Thilenius wrote on Tue, 14 July 2009 16:54
i think he wants it to output signals not bangs.

The bangs can be converted to signals using click~. If he needs it to be sample-accurate, then that’s another story, but it seems like that could be done by using several signal comparison objects.


July 14, 2009 | 10:00 pm

How are you generating these clicks? If you gave us some sort of idea of what you’re trying to do with such an object then maybe we could be of more help.

lh


July 15, 2009 | 12:48 pm

btw such things (signal to signal-generation) need a lot
of CPU. you can see what i mean when you compare the
CPU requirement for multiple instances of [zerox~] against
objects like [phasor~ ].

[zerox~], which does more or less the opposite of what has
ben asked for here, needs more than tapin~/tapout~…

-110


July 15, 2009 | 1:30 pm

Not very pretty or efficient but you can do it with standard objects like this…

#P button 37 86 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 37 115 37 196617 click~;
#P button 118 86 15 0;
#P newex 118 115 37 196617 click~;
#N vpatcher 125 371 1254 896;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 179 271 56 196617 clip~ 0. 2.;
#N comlet otherclicks;
#P outlet 389 346 15 0;
#N comlet oneclick;
#P outlet 179 346 15 0;
#N comlet click~ reset;
#P inlet 248 72 15 0;
#P window linecount 0;
#P newex 179 306 220 196617 gate~ 2;
#P newex 274 134 44 196617 tapout~;
#P newex 274 110 47 196617 tapin~ 1;
#P newex 273 88 40 196617 *~ -1.;
#N comlet click in;
#P inlet 226 72 15 0;
#P newex 179 130 31 196617 +~ 1;
#P newex 179 162 106 196617 selector~ 2 1;
#P newex 179 195 71 196617 frameaccum~;
#P fasten 8 0 2 0 253 112 184 112;
#P connect 2 0 1 0;
#P connect 1 0 0 0;
#P connect 0 0 11 0;
#P connect 11 0 7 0;
#P connect 7 0 9 0;
#P connect 3 0 1 1;
#P fasten 0 0 4 0 184 217 349 217 349 79 278 79;
#P connect 4 0 5 0;
#P connect 5 0 6 0;
#P connect 6 0 1 2;
#P fasten 3 0 7 1 231 154 394 154;
#P connect 7 1 10 0;
#P pop;
#P newobj 37 168 91 196617 p oneclick~;
#P user ezdac~ 37 242 81 275 0;
#P connect 1 1 0 1;
#P connect 2 0 1 1;
#P connect 3 0 2 0;
#P connect 1 0 0 0;
#P connect 4 0 1 0;
#P connect 5 0 4 0;
#P window clipboard copycount 6;


July 15, 2009 | 2:08 pm

Just found a better solution

#P button 72 94 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 72 123 37 196617 click~;
#P button 153 94 15 0;
#P newex 153 123 37 196617 click~;
#N vpatcher 125 371 1254 896;
#P outlet 279 358 27 0;
#P window setfont "Sans Serif" 9.;
#P newex 279 299 27 196617 -~;
#P newex 296 270 61 196617 sah~ 0.999;
#P inlet 437 64 15 0;
#P newex 279 200 71 196617 frameaccum~;
#P newex 279 326 111 196617 gate~ 1 1;
#P inlet 380 65 15 0;
#P fasten 0 0 2 0 385 185 284 185;
#P connect 2 0 5 0;
#P connect 5 0 1 0;
#P connect 1 0 6 0;
#P fasten 2 0 4 0 284 243 301 243;
#P connect 4 0 5 1;
#P fasten 3 0 4 1 442 255 352 255;
#P connect 0 0 1 1;
#P pop;
#P newobj 72 176 91 196617 p oneclick~;
#P user ezdac~ 72 250 116 283 0;
#P connect 2 0 1 1;
#P connect 3 0 2 0;
#P connect 1 0 0 1;
#P connect 1 0 0 0;
#P connect 4 0 1 0;
#P connect 5 0 4 0;
#P window clipboard copycount 6;


July 15, 2009 | 5:15 pm

the impulse-to-state thing:

max v2;
#N vpatcher 75 461 1137 1142;
#P newex 403 265 65 196617 gate~;
#P newex 403 232 65 196617 sah~;
#P newex 403 199 65 196617 count~;
#P newex 289 171 53 196617 *~ 1.;
#P user scope~ 263 385 393 515 64 3 16 -1. 1. 0 0. 0 0. 255 255 255 85 85 85 0;
#P comment 252 82 240 196620 what can you do to make an impulse spike alternating between signals of 0. and 1. (of course while staying in the signal domain) ?;
#P button 131 48 27 0;
#P newex 131 153 53 196617 click~;
#P newex 41 127 53 196617 -~ 0.5;
#P user scope~ 41 385 171 515 64 3 16 -1. 1. 0 0. 0 0. 255 255 255 85 85 85 0;
#P flonum 41 48 35 9 0. 50. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 41 99 53 196617 phasor~;
#P newex 41 153 53 196617 zerox~;
#P toggle 169 547 15 0;
#P newex 210 563 49 196617 dac~;
#P comment 252 52 100 196620 homework:;
#P connect 5 0 4 0;
#P connect 4 0 7 0;
#P connect 7 0 3 0;
#P connect 3 0 6 0;
#P connect 9 0 8 0;
#P connect 2 0 1 0;
#P connect 3 0 12 0;
#P connect 8 0 12 0;
#P pop;


July 15, 2009 | 7:11 pm
Roman Thilenius wrote on Wed, 15 July 2009 13:48

btw such things (signal to signal-generation) need a lot
of CPU.

In my experience, not necessarily. While processing signal clicks is more CPU intensive than processing bangs, it is not that expensive. For example, a samm~ object with 30 click outlets draws no more than 1% of the CPU on a 2.4 GHz Mac.

The native MSP solution probably needs a few more objects to implement the same sample-accurate logic, so that might be more CPU intensive than my approach.

Eric


Viewing 19 posts - 1 through 19 (of 19 total)