Sound reactive speaker that adjusts its own volume depending on surroundings

Good morning ladies and gents,

I have just started a new project for my college course and am in need of some help.

I have decided to try and create a speaker that is continuously monitoring its surroundings and is able to react to the surrounding decibel levels in order to adjust its own.

I am struggling with implementing this concept into Arduino as it seems quite advanced and i am quite new to Arduino only knowing some basics.

My initial idea was to create an array that contains 10 different possible volume levels that the Arduino can output and then find some way to link it to an input array. The input array consisting of numbers lets say also 1 - 150 decibels. The inputted decibel levels would correspond to a number in the first array that would then correspond to a volume in the second array then change the speakers output to the volume corresponded in the second array.

For example if 90 decibels is given to the speaker it would take that 90 compare it to the second array and maybe out put the same 90 decibels or higher depending on how the array is configured.

Please could someone point me in the right direction of where to start.

Thanks, JT

Difficult. Even more difficult if you only have an Arduino.

First problem: how does the speaker NOT hear itself?