# [PD] signal math explanation

Jonathan Wilkes jancsika at yahoo.com
Sat Jan 18 20:01:34 CET 2014

```Since you're dealing with arithmetic, it helps immensely to simplify the data by replacing [osc~ 440] with [sig~ 1], which will just send out blocks where every sample is "1".

The [+~] just goes through a loop every block and does addition, sample by sample.  When you don't give it an argument as in your example, it starts with the first sample of each input signal, adds those samples together, stores the sum for the outgoing signal, and then does it again for the next index number until it's gone through the entire block of samples.

When you fan out from a signal outlet into multiple signal inlets, you're essentially just sending the same output the object computed to several places.  It's worth noting, however, that for signal chains Pd will ensure that an object receives all of its input before it computes its output.  Control objects do not do this, which is why [trigger] exists and why it's often more difficult to read the flow of control diagrams.

Anyway, since our source signal [sig~ 1] only contains the number 1, you can just do the math in your head for the sum of the first two samples to get the number "2", and safely assume it will be the same answer for the rest of the samples in the block.  Check your math using something like the [print~] object (or the cord inspector in Pd-extended or Pd-l2ork) at the bottom of the chain.

Finally, put the [osc~ 440] back at the top and see that it's doing the exact same math; it's only that the samples of each block will have different values.  But if you use several [print~] objects to see what's being computed at each link of the object chain, you can still check the math works for any sample you want to track visually.

Finally, it's worth noting that most arithmetic signal objects have a simplified method that's used if you specify an argument, like [+~ 42].  In this case, the right inlet is actually a control inlet.  It simplifies the math somewhat because there's only one incoming signal, and it gets added to a constant value in the loop to compute the output.  If you're going to be sending control data to the right inlet of a [+~] object, you can force this simplification using [+~ 0].  (Same for the other arithmetic signal objects.)

-Jonathan

On Saturday, January 18, 2014 12:24 PM, Pall Thayer <pallthay at gmail.com> wrote:

Can anyone tell me what one is accomplishing when doing something like this:

[osc~ 440]
|
[+~]
|\
[+~]
|\
[+~]
|\
[+~]

In other words, the chain of [+~] that feed the previous object's output into both inlets of the next... what does this do exactly?

Thanks,
Pall

--
*****************************
Pall Thayer
artist
http://pallthayer.dyndns.org
*****************************
_______________________________________________
Pd-list at iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20140118/798dae91/attachment-0001.htm>
```