Reply To: Question about gen~ 'chopper' examples


Forums > Gen > Question about gen~ 'chopper' examples
August 18, 2013 | 5:32 pm

You could keep track of the total duration by updating a History object in the if(is_complete) section. E.g., where it currently states

len = write_index + offset – prev_offset – 1;
poke(length_data, len, write_segment, 0);

You could replace it with (assuming History total_length is declared above):

prev_length = peek(length_data, write_segment, 0);
len = write_index + offset – prev_offset – 1;
total_length = total_length – prev_length + len;
poke(length_data, len, write_segment, 0);

That updates the total length every time a new segment is recorded. Then you can simply output that from another outlet. (see below)

There’s no way to output a bang from gen~, but you can very simply test according to the value of the write segment (e.g. [==~ 63] -> [change]) to get a trigger signal.

– Pasted Max Patch, click to expand. –