ANC w/ Matplotlib.

Surya Maddula
3 min readDec 3, 2023
AI Generated Image

For the past few weeks, I’ve been working on the software for Active Noise Cancellation, for which I got a Patent granted. I initially planned to focus on building the prototype myself but then pivoted to software first since it was much easier to build from home. I plan to work on the hardware after my exams.

And the result:

After a lot of debugging, tweaking, and improving, I finally have the code for ANC using Artificial Intelligence!

Up until now, I’ve been using Jupyter Notebook for running my code, but I was never satisfied with it, so from now, I’ve decided to move to Google Colab, since a lot of my other projects were on that anyways, and it’s easier to work on the same platform for everything.

Software

I split the code I made into 2 parts:

  • Code for the Active Noise Cancellation
  • Code for Visualising the ANC happening

Here’s the Loom Video I made on this!

Starting with NumPy

So, right at the beginning, I bring in NumPy. It’s really good with numbers, and it helps handle all the numerical stuff, making sure everything is ready for real action.

Noise Cancellation Class

Now, I introduce the “Open Air Noise Cancellation” class. It’s like the boss of the system. This class lets me tweak some important settings, like how fast the system listens and how much attention it pays. It’s kinda like adjusting the knobs to get the noise-canceling just right.

Understanding Coefficients and Learning

The coefficients show how fast the system learns to cancel noise. Using adaptive filtering and a bit of smart learning, the system gets better over time. The system is learning from its experiences, figuring out what works and what doesn’t in canceling out unwanted sounds.

Breaking Down the Code

Breaking it down, I tell the system what sound patterns to pay attention to, giving it a heads-up on what’s important. Then, the system processes the input signal, sifting through the good stuff and filtering out the annoying noise. This step-by-step process is the engine that makes the noise cancellation happen.

Visualizing with Matplotlib

To make things clearer, I use Matplotlib for drawing because it creates a visual guide to understand what’s going on. The code defines the size and layout, showing a picture of the Original Clean Signal, the Ambient Background Noise, and the Noise Cancellation Signal. It’s a way to see the different roles each part plays in the noise cancellation process.

Presenting the Visual Output

In the next part, we go a bit deeper into the drawing. We set up the size of the picture label in different parts, giving a clear picture of how the noise gets canceled out. This visual output is like a snapshot that shows, “Hey, the noise is out of the picture.”

Conclusion

So, that’s the journey through my noise cancellation project. It’s a mix of just programming, learning on the go, and making sense of it all with pictures. Turning messy waves into a straight line means the noise is gone.

As always, That’s it for this time; thanks for Reading and Happy Learning!

--

--

Surya Maddula

Student Researcher @ Columbia • TKS 23' & 24' • Patented Innovator • National Record Holder • Growth Engineer