I used the concept of time shifting by delaying a sine wave to demonstrate noise cancellation properties. By changing the number of samples by which the wave is delayed, we can shift it enough so that the shifted wave added to the original becomes 0. My code and a demonstration of the patch are shown below.