## 3 Proposed Audio Watermarking Method
### Watermark Embedding Scheme  
Figure 2 presents the process of the watermark embedding. Firstly, bandpass filtering is applied to the host signal \(x(t)\) to get the filtered signal \(s(t)\). Then, the filtered signal is separated into successive frames. After that, they are divided into the front subframes and back subframes. We compute a gain based on the scale factor \(\xi_{i}\), original \(D_{i}\) as well as watermark bit \(w_{i}\), and then multiply the gain to the front and back subframe with mutually opposite signs to generate the watermark signal. In the end, the watermark signal is added back into the host signal with a specified delay \(\tau\) to modify the NCOD values.  
When modulated subframes are added back to host signal, there are sudden changes at the boundaries which cause audible noise. To avoid this, amplitude of the boundaries of the modulated subframes are attenuated. In our implementation, the window function is calculated by following equation:  
\[(t)=\left\{\begin{array}{ll}(t-1)\cdot\Delta k,&1\leq t<l_{a}\\ 1,&l_{a}\leq t\leq\ T-l_{a}\\ (T-t)\cdot\Delta k,&T-l_{a}<t\leq T\\ l_{a}\cdot|\Delta k|=1,&1<l_{a}<T/2\end{array}\right. \tag{8}\]  
where \(\Delta k\) is attenuation interval and \(l_{a}\) is attenuation length at the boundary. We set \(|\Delta k|=1/l_{a}\). Figure 3 shows the window.  
The watermark embedding procedure of each frame is illustrated by pseudo code in Algorithm 1. The \(b_{i}\) is the bipolar term of \(w_{i},\ w_{i}\in\{0,1\}\Rightarrow b_{i}\in\{-1,+1\}\). The \(TH_{i}\) is threshold for determining a gap of NCOD relation between the front subframe and back subframe.  
```
1:\(b_{i}=w_{i}\cdot 2-1\)
2:\(D_{i}=NC_{11}-NC_{2}\)
3:\(TH_{i}=\xi_{i}\cdot b_{i}\)
4:if\((w_{i}==1\) and \(D_{i}>TH_{i})\) or \((w_{i}==0\) and \(D_{i}<TH_{i})\)
5:return // return without performing any action
6:else
7:\(g_{i}=TH_{i}-D_{i}\)
8:end
9: front subframe = front subframe \(\cdot g_{i}\cdot f_{w}\)
10: back subframe = back subframe \(\cdot(-g_{i})\cdot f_{w}\)
```  
**Algorithm 1** Watermark embedding process  
Figure 3: Window function.  
Figure 2: Watermark embedding procedure.  
If \(D_{i}\) has already met the requirements of the watermark embedding condition, then no further modulating operation to the frame is required. Otherwise, a gain value \(g_{i}\) is calculated by \(TH_{i}\) minus \(D_{i}\), and this gain is multiplied to the front subframe. In contrast, the back subframe is multiplied by opposite sign of \(g_{i}\). These subframes are further multiplied by the \(f_{w}\) window function.  
In other words, the natural NCOD is firstly calculated, and then the necessary modifications are determined. To get a well visual effect, Figure 4 illustrates the procedure of the watermark embedding of two frames.  
The scale factor \(\xi_{i}\) is utilized to balance requirements between robustness and transparency. The main purpose of the proposed audio watermarking algorithm is to be robust against HE-AAC compression attack, so we designed the algorithm to adaptively adjust \(\xi_{i}\) by using the signal-to-noise ratio (SNR) between host signal and the HE-AAC compressed signal. For convenience, we call the SNR as CSNR in this paper. Figure 5 presents the calculation process of \(\xi_{i}\).  
We can calculate the CSNR of each frame by utilizing following formula:  
\[SNR_{i}=20\cdot\log_{10}\frac{\sum_{t=T_{f}:i}^{T_{f}(i+1)}\abs{x(t)}}{\sum_{ t=T_{f}:i}^{T_{f}(i+1)}\abs{x(t)-y(t)}} \tag{9}\]  
where \(x(t)\) is host signal and \(y(t)\) is its compressed version. It can be indicated that the lower the CSNR value, the greater the compression is performed to the frame, which means lots of redundant signals are removed. Thus, a frame with a lower CSNR value would get a larger \(\xi_{i}\) value to guarantee robustness and vice versa.  
Figure 4: Watermark embedding diagram.  
Figure 5: Scale factor \(\xi_{i}\) calculation.