The amplitude of a sound wave can be calculated using multiple methods. The main two are "peak" and "RMS".

For both, you need to first take a number of consecutive samples. This should be at least the number of samples it takes for a single cycle of the wave.

Then, to calculate the peak amplitude, you simply take the highest absolute value of all of those samples.

RMS (Root Means Square), however, is more complicated.

For this particular task, peak should be sufficient.

Note that sample values can be negative. The absolute value (converts negative to its positive equivalent) will give you the value to compare here.