# [PD] First post - bang to float conversion

Frank Barknecht fbar at footils.org
Mon Sep 29 15:59:29 CEST 2008

```Hallo,
Daniel Almeida hat gesagt: // Daniel Almeida wrote:

> this is my first post on the list. I'm a beginner on Pure data. Just
> had a workshop on MAX and decided to try PD.

Welcome, Daniel!

> I'm working on a simple drum machine but I need a way to convert a
> bang into a float. I have a counter that counts from 1 to 16

You maybe want to make your counter count from 0 to 15 later. Why?
Because then you can use [mod] to make sub-counters, e.g. one that
counts from 0-3 every quarter note using [mod 4]. ([mod] always starts
at 0.)

> and on each step a select to send me a bang. I want a way to execute a
> sound when I have a bang and the checkbox for that step is on. I was
> thing on using the boolean operator && or the multiplication to send
> another bang to play the sound.

Just use a [float] or [f] object to get a float event. Use the cold,
right inlet to set the value of the float to be different from 0. See
attachement.

Ciao
--
Frank
-------------- next part --------------
#N canvas 162 29 519 655 10;
#X obj 83 97 f 0;
#X obj 117 98 + 1;
#X obj 83 73 metro 250;
#X obj 83 51 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1
;
#X floatatom 113 154 5 0 0 0 - - -;
#X obj 83 121 mod 8;
#X text 152 126 counts 0-7;
#X obj 83 296 f 0;
#X obj 83 381 f;
#X floatatom 96 409 5 0 0 0 - - -;
#X obj 101 225 vsl 8 64 0 127 0 0 empty empty empty 0 -9 0 10 -262144
-1 -1 5200 1;
#X obj 113 295 f 0;
#X obj 131 224 vsl 8 64 0 127 0 0 empty empty empty 0 -9 0 10 -262144
-1 -1 0 1;
#X obj 145 295 f 0;
#X obj 163 224 vsl 8 64 0 127 0 0 empty empty empty 0 -9 0 10 -262144
-1 -1 0 1;
#X obj 175 295 f 0;
#X obj 193 224 vsl 8 64 0 127 0 0 empty empty empty 0 -9 0 10 -262144
-1 -1 4800 1;
#X obj 207 296 f 0;
#X obj 225 225 vsl 8 64 0 127 0 0 empty empty empty 0 -9 0 10 -262144
-1 -1 0 1;
#X obj 237 296 f 0;
#X obj 255 225 vsl 8 64 0 127 0 0 empty empty empty 0 -9 0 10 -262144
-1 -1 2800 1;
#X obj 269 296 f 0;
#X obj 287 225 vsl 8 64 0 127 0 0 empty empty empty 0 -9 0 10 -262144
-1 -1 1000 1;
#X obj 83 499 / 127;
#X obj 83 529 *~;
#X obj 83 567 *~ 0.5;
#X obj 84 592 dac~;
#X obj 136 498 osc~ 440;
#X obj 99 457 del 200;
#X obj 99 435 b;
#X msg 99 478 0;
#X obj 83 184 select 0 2 3 4 5 6 7;
#X connect 0 0 5 0;
#X connect 1 0 0 1;
#X connect 2 0 0 0;
#X connect 3 0 2 0;
#X connect 5 0 1 0;
#X connect 5 0 4 0;
#X connect 5 0 31 0;
#X connect 7 0 8 0;
#X connect 8 0 9 0;
#X connect 8 0 23 0;
#X connect 8 0 29 0;
#X connect 10 0 7 1;
#X connect 11 0 8 0;
#X connect 12 0 11 1;
#X connect 13 0 8 0;
#X connect 14 0 13 1;
#X connect 15 0 8 0;
#X connect 16 0 15 1;
#X connect 17 0 8 0;
#X connect 18 0 17 1;
#X connect 19 0 8 0;
#X connect 20 0 19 1;
#X connect 21 0 8 0;
#X connect 22 0 21 1;
#X connect 23 0 24 0;
#X connect 24 0 25 0;
#X connect 25 0 26 0;
#X connect 25 0 26 1;
#X connect 27 0 24 1;
#X connect 28 0 30 0;
#X connect 29 0 28 0;
#X connect 30 0 23 0;
#X connect 31 0 7 0;
#X connect 31 1 11 0;
#X connect 31 2 13 0;
#X connect 31 3 15 0;
#X connect 31 4 17 0;
#X connect 31 5 19 0;
#X connect 31 6 21 0;
```