-=- MinMax-O-Matic -=-

Sculpt-O-Sound presents the MinMax-O-Matic.


The MinMax-O-Matic is a utility module that outputs the minimum and maximum value of two input values.
It can be used for audio and CV signals.

How it works

If you take two signals J1(t) and J2(t) that vary over time then at any given time you can calculate the minimum value of these using this formula:

min(J1(t), J2(t)) = 0.5 * (J1(t) + J2(t) - abs(J1(t) - J2(t)))

or the maximum value using this formula:

max(J1(t), J2(t)) = 0.5 (J1(t) + J2(t) + abs(J1(t) + J2(t)))

where abs(x(t)) is the absolute value of x(t).

If you find this ‘over time’-notation confusing, the formulas can be simplified such that:

the minimum value of J1 and J2 is: 0.5 * (J1 + J2 - abs(J1 - J2))

and the maximum value of J1 and J2 is: 0.5 * (J1 + J2 + abs(J1 - J2))

If you do not believe these formulas can work, then try it with a few numbers!

If J1 and J2 vary over time, you need to recalculate the minimum and maximum each time you want to know it. It is possible to build an analog circuit for this. There is no need for an arduino or any other digital computing device.


You can build a circuit for each of these formulas using basic opamp operations.
In the schematic below you can see the MinMax.
U1.1 will produce the inverse of the sum of the signals J1 and J2 i.e. - (J1 + J2)
U1.2 will subtract J2 from J1 i.e. J1 - J2
U2.1 and U2.2 are a ‘full wave rectifier (say this out loud in a reverberant room!)’ which transforms the output of U1.2 into a positive signal i.e. abs(J1 - J2)
U3.1 and U3.2 finally sum it all up.
U3.1 produces -0.5 the sum of its input signals i.e. J3 = -0.5 * ( -(J1 + J2) + abs(J1 - J2) )
This is equivalent to J3 = 0.5 * (J1 + J2 - abs(J1 - J2))
U3.2 subtracts its two input signals from each other and halves the result such that
J4 = 0.5 * ( abs(J1 - J2) - (-(J1 + J2) )) = 0.5 * (J1 + J2 + abs(J1 - J2))

As you can see all resistors have the same value. Here all are 100k, but if you are freshly out of 100k resistors, it will work with other values, as long as they are all the same value. Keep their tolerance at 1% or better, though.

Since you need 6 opamps, you can make one MinMax with one quad and one dual opamp but why not make two of these circuits using three quad opamps?

I used LM324 quad opamps in my build (after Yves Usson), but you can use other general purpose opamps.


In my implementation the input jacks I used are grounded when no patch cable is inserted, therefore if one plugs a signal in an input and nothing in the other, the signals collected at the MIN and MAX outputs are the negative and positive halves of the signal, respectively. This can be used to verify the working of the build.

What is it good for?

So far I’ve tried 2 use cases:

1: waveshaping
2: extracting a bass line from 2 sequences

Example 1: Waveshaping

You can use the MinMax as a Waveshaper to construct a new signal from two other signals. Have a look at this example video.

On the right hand side you have 2 input signals each shown in a scope with a white trace. The output signal is displayed on the scope to the left using a blue trace.
The input signals are both sines, one with a low and one with a higher frequency. The amplitude of the high frequency sine is 0 at the start, so you see the max of the low sine and zero, which result in the positive halves of the low frequency sine. Once the amplitude of the high frequency sine is raised, you see its appearance in the output signal at those points where the low frequency sine has a lower amplitude.

Note: the waveshaping effect using sine waves may not sound spectacular here, but the sines make it easy to visualize what is happening.

Example 2: Extracting a bass line from 2 sequences

Imagine a simple hardware sequencer with a few rows of potentiometers. When the sequencer is running, per row of potentiometer each potentiometer’s output value is connected to that rows output one at a time. The sequencer can be made to loop. If a VCO is connected to each output several melodies can be played at the same time.

The B960 is shown here as an example of a simple sequencer. In the picture below to its immediate right you can see a sequential switch.

If we set the potentiometers to a pattern and chain 2 rows of 8 pots using the sequential switch we get a 16 step pattern. If we connect the output of the first row of potentiometers to one of the inputs of the MinMax and the output of the second row to the other input, then for each step the MinMax will produce the minimum and maximum of these values at its outputs. Lets assume we are only interested in the minimum output’s signal.

For each step this will correspond to the lowest of the 2 notes in the 2 rows. Thus the minimum values can be seen (or heard) as a ‘bass line’ which is extracted from the 2 patterns. This is show in this video:

Note: the ticking noise in the background is caused by the phone I used to make the recording.

Note: the minmax produces an 8 step pattern because it compares the 8 steps of two rows one to the other respectively and these stepping of the rows is looped after 8 steps. The sequential switch ties two 8 step pattern together resulting in a 16 step pattern.

In the video the 2 outputs of the sequencer rows are sent to a sequential switch. During the first 8 steps the sequential switch connects the output of row one to a quantizer and from there to a VCO. During the 2nd 8 steps the switch connects the output of row two to the quantizer and the VCO. The Min output of the MinMax is connected to another quantizer which is connected to a 2nd VCO which will play the ‘bass line’. The 2nd VCO is silent at the beginning but its volume will be turned up after a few seconds (using an grey attenutator).

Note: the ticking noise in the background is caused by the phone I used to make the recording.

Other uses

There may be other uses for a MinMax, so if you have any ideas, write them in the comments.


Analog maths looks like lots of fun!

(The second vid is as same as the first?)


Oops, thx for pointing that out.

1 Like