## 2 Materials and Methods
### Method #1: Slice and Detect  
_Slice and Detect_ mimics the Zienkiewicz method [8] by segmenting signals based on the cardiac cycle, and then finding the peak of S1\({}^{\prime}\) for each segment based on a specific window search area. This study proposes another method to replace the template filter method, based on utilising DWT for signal decomposition to guide the segmentation process. Algorithm 1 shows the pseudocode of _Slice and Detect_. ```
Input: enhanced signal \(s\_en\), level. Output: positive integer peak_location. 1. for all level do
2. [app_coef, det_coef] = DWT(\(s\_en\), level(\(i\))). 3. \(s\_recont\_1\leftarrow\) reconstruct signal using the latest detail, det_coef(last). 4. \(corr\_coef\)(\(i\)) = corr(\(s\_recont\_1\), \(s\_en\)). 5. \(chosen\_level\) = max(\(corr\_coef\)) // chosen_level holds index with the highest value in \(corr\_coeff\)
6. \(chosen\_level\) \(\leftarrow\) chosen_level-1. 7. \(s\_recont\_2\leftarrow\) reconstruct from approximation at chosen_level. 8. \(lo\_env\leftarrow\) lower envelope of \(s\_recont\_2\). 9. \(start\_point\leftarrow\) peak locations from \(lo\_env\). 10. \(search\_window\leftarrow\) 60% of mean distance of peak locations. 11. for all start_point (except the last one) do
12. if start_point (1) > search_window. 13. \(s\_slice\leftarrow\) slice s_en from the beginning to start_point(1). 14. elseif peak_loc(last-1) > search_window
15. \(s\_slice\leftarrow\) slice s_en from start_point(last-1) to the end. 16. else
17. \(s\_slice\leftarrow\) slice s_en from start_point(j) to start_point(j + 1). 18. \(peak\_loc(j)\leftarrow\) peak location of s_slice. ```  
**Algorithm 1** Slice and Detect. Appropriate mother wavelets are selected based on their similarity to the shape of S1\({}^{\prime}\) and S2\({}^{\prime}\)[24; 25]. Potential candidates include narrow symmetric wavelets, such as Symlets,  
Figure 3: Raw signals (**top**) contained high frequency noise that blurred the systolic and diastolic parts in each cardiac cycle. Applying BPF with cut-off frequencies of 20 and 50 Hz improved the signal quality by removing high frequency noise and relatively low frequency oscillation between the two AOs (**bottom**). Coiflets, Biorthogonal, Reverse biorthogonal, and Fejer-Korovkin wavelets in addition to wide asymmetric ones, such as Daubechies wavelets. Another critical factor in wavelet decomposition is the number of the decomposition level. We do not want to lose all oscillations, because they are necessary for detecting the peak of S1\({}^{\prime}\). For this reason, we calculate the correlation of the latest _Detail_, for example, D8 from the eight-decomposition level and the input signal (lines 1 to 4 in Algorithm 1). The level with the highest correlation minus one is selected for that segment (lines 5 to 6 in Algorithm 1). Next, the lower envelope of the _Approximation_ signal of the selected level is calculated, along with its peaks. These peaks indicate the locations for slicing the recorded signal into individual chest vibrations (lines 7 to 9 in Algorithm 1). Hence, they represent the start of the S1\({}^{\prime}\) wave. The search window was defined as 60% of the mean of the distance between two adjacent starts of individual chest vibrations (line 10 in Algorithm 1). The main idea is to include the whole S1\({}^{\prime}\) wave. Hence, we applied an adjustable search window to accommodate heart rate variation. AO detection utilises an enhanced signal, instead of the original one. Vibration on the edge needs special attention since the algorithm processes signals segment-by-segment to enable a real-time application. It is possible to have one chest vibration at the beginning of the signal, before the first detected starting point. To solve this process, the algorithm searches for the peak of a chest vibration, when the distance of the first starting point from the beginning of the segmented signal is greater than the search window (lines 12 to 13 in Algorithm 1).