# An Active Indoor Noise Control System Based on CS Algorithm
## 2 The Indoor ANC System Based on CS Algorithm
### The CS Algorithm for ANC System  
A strategy for overcoming the nonlinearity associated with the microphone and speaker of an active noise control (ANC) system is proposed for the system presented in  
Figure 2: Block Diagram of the FXLMS Algorithm for ANC. this paper. When the noise from the source exceeds the dynamic limit of the microphone, the reference microphone enters saturation mode. Nonlinearity introduced by ANC might be due to nonlinearity in the primary and secondary paths as well as chaotic noise. Nonlinearity is introduced into the system when the controller attempts to drive the loudspeaker system beyond its dynamic limitations. The secondary route, which is often calculated by a linear transfer function with low-level auxiliary noise, does not model such nonlinearity. Figure 3 depicts the suggested ANC system paradigm. The input sensor detects the source noise signal in this suggested technique. It sends the input signal to the ANC system, which employs a series of methods to analyze the input noise signal in order to generate an artificial noise signal with the opposite or inverse phase but the same amplitude and frequency as the input noise signal. The speaker is used to generate an artificial noise signal known as an anti-noise signal because it has the same amplitude and frequency as a noise signal but is in the opposite phase. When manufactured noise signals and source noise signals are mixed, their effects cancel each other out, resulting in the creation of a quiet zone. The error microphone measures the outcome of these signals. If we achieve the intended result, i.e., establishing a silent zone, the process will terminate. If we need to process further, the CS algorithm is used to update the filter coefficients until we receive the desired output. Noise can be decreased by combining artificial and source noise to create a comfort zone around the ear. The meaning of each function in Figure 3 is the same as in Figure 2, except that the CS algorithm is used to update the filter coefficients, as detailed below. The CS algorithm is employed in this approach to update the filter coefficient, and the CS algorithm's updating process is presented in Algorithm 1. The filter coefficient is first initialized. The filter coefficient is tuned as the host nest in the algorithm. The fitness value is then calculated by substituting the coefficients of filter into the fitness function. Levy flying is continued along with evaluating the fitness function when the number of runs is less than the predetermined number of \(K\). At the same time, a nest is chosen at random and replaced if its fitness value is lower than the preceding one. Then, there is the possibility of eliminating the poor ones and constructing new ones. Finally, the best solution is saved and ranked. Figure 4 is the flow chart of the CS algorithm. After initialization, the CS algorithm will calculate the fitness value and then update the position. Based on the pattern of the CS algorithm, it will judge whether the nest is exposed or not. If the exposure means that the position is not good, it will update the position again; if not, it means that the position is not bad, that is, the fitness function will be calculated again. Finally, check whether the end condition is met. If so, the end has been achieved. Otherwise, continue with the previous step. It is worth noting that different functions can be used to update the position [14], which we distinguish between A and B in Figure 4.  
Figure 3: Block Diagram of the proposed CS Algorithm for ANC. The fitness function can be expressed as  
\[f_{i}=\min\Bigl{\{}E\Bigl{[}e_{i}^{2}(n)\Bigr{]}\Bigr{\}}, \tag{9}\]  
where \(E[\cdot]\) is the mean squared error. When generating new solutions \(x_{t+1}\), a cuckoo \(i\), a Levy flight is performed:  
\[x_{i+1}=x_{i}+\alpha\oplus\mathit{Levy}(\lambda), \tag{10}\]  
where \(\alpha>0\) represents the step size, which is normally set to 1. \(\oplus\) denotes entry wise multiplications.