## IX Peer Accumulator.

#### Installation

Copy "IX Peer Accumulator.dll" and this document to your Generators folder. That's it. You could add it to your index as well if you like.

#### What does it do?

It's a trigger style peer controller, mostly intended for adding controllable pseudo-random texture to parameters but you can send fixed values too.

#### Pseudo-Random?

Each track has it's own independent pseudo-random number generator which will happily spit out seemingly random values all day long. The values are not truly random however but are generated from a seed value, and for a given seed the number sequence will always be the same. You can control the generator's state with various commands that allow you to do things like re-seed the generator or rewind the number sequence to it's start point. When you add a track, the new track's generator is seeded with the current time.

#### Why "Accumulator"?

It started as a simple machine that would send a peer value only after it had been triggered a certain number of times. It still does that, but I got a bit carried away with the random side of things.

#### Global Parameters

Command 1 | See below.
Argument 1 | Value for Command 1. See below.
Command 2 | See below.
Argument 2 | Value for Command 2. See below.

#### Track Parameters

Trigger | Trigger, possibly.
Delay | Delay trigger by n subticks.
SubTicks | Sub-tick resolution for trigger delay. Default value is 6 subticks per tick.
Threshold | How many times this track must be triggered before it does something.
Mode | What to do when the track actually triggers.
Val A/B | Value controls.
Track | Which track of the target machine to use.
Command 1 | See below.
Argument 1 | Value for Command 1. See below.
Command 2 | See below.
Argument 2 | Value for Command 2. See below.

#### Triggering Modes

Random | Successful triggers send a random value in the range between A and B.
Use A | Successful triggers will send value A. Useful for tuning the value range.
Use B | Successful triggers will send value B. Also useful for tuning the value range.
Alternate | Successful triggers will alternate between the values of A and B.

#### Commands

There are several commands you can use to control Accumulator, either on a global or per-track basis. If you use the global command columns, the command will be applied to all existing tracks. Where two commands on the same line conflict, Command 2 has precedence over Command 1 and Track commands override Global commands. Commands are processed before triggering occurs.

00 - Reset | No argument needed. Resets trigger counter, clears all flags and overrides, resets the bitmasks and restarts the number generator.
01 - Set Counter | Set trigger counter to argument or reset counter to zero if no argument supplied.
02 - Set Toggle | In Alternate mode, sets toggle phase to A or B. Use zero or no argument for A, non-zero for B.
03 - Set Offset | Sets the random number sequence to the specified step. Use zero or no argument to reset the generator.
04 - Re-seed | Seed random number generator with argument. An argument of zero seeds the generator with the current time. If no argument is supplied, the generator is restarted (same as Set Offset to zero).
05 - Ignore Delay | A non-zero argument causes the track to ignore any specified subtick delay for subsequent triggers. An argument of zero or no argument clears the flag.
06 - Override (IT) | Override (Insert, Temporary). See below.
07 - Override (RT) | Override (Replace, Temporary). See below.
08 - Override (IP) | Override (Insert, Permanent). See below.
09 - Override (RP) | Override (Replace, Permanent). See below.
0A - Clear Override | Clears all override settings for this track. No argument needed.
0B - Invert | Invert values. Random numbers will be inverted (ie. 100% becomes 0%). Non-zero to activate, zero or no argument to deactivate. Override values are not affected.
0C - Set AND | Bitwise AND. Bits that are not set in the argument value will be cleared from sent values. If that makes sense to you then you probably are, or should be, a programmer. This will affect all subsequent values except for overrides and is processed before the bitwise OR. No argument resets the mask.
0D - Set OR | Bitwise OR. Bits that are set in the argument value will be set in sent values. Crazy huh? This will affect all subsequent values except for overrides and is processed after the bitwise AND. No argument resets the mask.
0E - Set Mode | Sets how values A and B are interpreted. Zero or no argument for Standard, non-zero for Precise. In Standard mode the values of A and B are regarded as percentages of the target parameter's range. In precise mode the values are treated literally and if the value exceeds the parameter's range, it will clamped accordingly. The mode setting is ignored if the target is a note parameter.

#### Override command modes:

The override commands allow you to override the normal value of a trigger. If no argument is supplied, the value is that of the last successful trigger (ie. hold). The override commands behave in the following ways:

Temporary | Overrides only the next successful trigger.
Permanent | Overrides all subsequent triggers until the flag is cleared by either a temporary override, 'Clear Override' or 'Reset' command.
Insert | Inserts the value into the normal value sequence. Subsequent values are shifted along one place ie. the sequence will resume where it was interrupted.
Replace | Replaces the value at this point in the sequence. Subsequent triggers retain their values.

#### Attributes

MIDI Input Channel | Channel to monitor if MIDI filtering is not enabled. Off by default.
MIDI Trigger Base | The MIDI note that will trigger the first accumulator track.
Reset On Stop | If set, perform a global Reset command when stop button is pressed. Off by default.

#### Right-click menu

Assign | Manage peer assignments.
Style | Controls how values A and B will be displayed in the parameters window. This is just an aid for setting up values and has no effect on the actual function of the machine. Please note that although it should work correctly for most machines, it is possible that the 'Note' mode may not accurately a machine's interpretation of the values sent by Accumulator.
Info | Launch the status dialog.

#### Status Dialog Fields

Track | Track number. No, you can't give them custom labels.
Assign | Shows the current peer assignment.
T/C | Threshold and counter state, in that order.
Override | Shows current override settings, if any.
Delay | Shows whether the track is currently obeying subtick delay.
Invert | Shows whether the track's random values are being inverted.
AND | Shows the current AND mask. FFFF is no effect.
OR | Shows the current OR mask. 0000 is no effect.
Value | Displays the last actual numeric value sent to the target parameter.
Mode | Shows whether the track is in Standard or Precise mode.

#### Known Problems

There seems to be an issue when controlling one Accumulator with another in Buzé (probably other libzzub projects too) which can result in unusual triggering. The problem is somehow liked to saving and reloading so if you notice a problem, save the song and reload it and the problem should have gone. Each time you save and reload the file, the problem will alternately be back again or gone. Files saved in Buzé will have the bug in Buzz but a single save/reload will fix the problem permanently. Saving a file in Buzz will bring the problem back in Buzé. I'm baffled.

You may experience minor mutex timeout problems in Buzz if you add certain machines to your song while the status dialog is open and Accumulator is active. The problem is worse in Buzé where the program will stop responding. I haven't been able to trace the problem but I think it's triggered by machines that do a lot of pre-calculation on initialising.

#### Acknowledgements

First and foremost, many thanks to Ed Powley for the superb PeerLib upon which this machine is based, and for his seemingly endless patience when faced with stupid noob questions. I have also used the Mersenne Twister random number generator, in the form of MersenneTwister.h by Richard J. Wagner which is in turn based upon code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus. Many thanks to those distinguished gentlemen for making their code publicly available to be used by amateurs such as myself. Thanks also to the many developers who frequent The Church whose help, advice and code I have leaned on heavily from day one. Finally, huge thanks to Oskari for making, and now at last re-making, our beautiful, beloved Buzz.

#### Contact

If you've got any comments, requests, bug reports, whatever, you can find me lurking in The Church (username 'd9') or you can mail me via deenine[at]hotmail[dot]co[dot]uk (but don't expect a quick reply.)

#### Disclaimer

This is the second machine I've made and I'm still strictly amateur so use it at your own risk. If it kills your computer, take comfort in the fact that it'll probably kill mine too.

- IX