# Empowering Healthcare: TinyML for Precise Lung Disease Classification
## 3 Materials and Methods
### Feature Extractor  
Feature extraction is an essential phase in lung sound analysis, where raw audio signals are converted into useful representations for classification. This process includes several categories: time-domain, frequency-domain, and time-frequency-domain features. Time-domain features capture the temporal characteristics of lung sounds, including metrics such as the zero-crossing rate, root mean square, and signal envelope. Frequency-domain features provide insights into the energy distribution across different frequency bands and include measures like MFCCs. Time-frequency-domain features, like wavelet transform and spectrograms, present a combined view of both time and frequency characteristics [6].  
MFCCs are commonly used as features [6; 25; 29] in lung analysis derived from the Fourier transform, which can capture the distribution of energy in different frequency bands. The MFCCs consist of a series of coefficients that capture the characteristics of the signal's spectrum. These coefficients are derived by taking the logarithm of the discrete cosine transform applied to the signal's spectrum. The particular parameters utilized to produce MFCCs are detailed in Table 3.  
In order to obtain the MFCC parameters presented in Table 3, we were inspired by the methodology used in [34], where the authors tested multiple configurations of MFCC parameters to optimize model performance and resource consumption. Following a similar procedure, we conducted multiple iterative tests to explore different parameter settings and find the optimal balance between performance and computational efficiency. While we initially tested the parameters used in their study, we found that these configurations did  
\begin{table}
\begin{tabular}{l c c c c} \hline \hline
**Category** & **Subjects** & **Age (Mean \(\pm\) SD)** & **Number of Records** & **Duration** \\ \hline Normal & 35 (11F, 24M) & 43 \(\pm\) 19 & 105 & 31 m 10 s \\ \hline Asthma & 32 (17F, 15M) & 45 \(\pm\) 15 & 94 & 28 m 06 s \\ \hline Heart failure & 21 (9F, 12M) & 58 \(\pm\) 18 & 56 & 13 m 59 s \\ \hline Pneumonia & 5 (2F, 3M) & 55 \(\pm\) 13 & 17 & 4 m 53 s \\ \hline Bronchiectasis & 3 (1F, 2M) & 37 \(\pm\) 26 & 9 & 2 m \\ \hline COPD & 9 (1F, 8M) & 57 \(\pm\) 9 & 29 & 07 m 54 s \\ \hline \hline \end{tabular}
\end{table}
Table 2: Demographic summary and recording details by disease category.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Value** \\ \hline
**Number of coefficients** & 13 \\ \hline
**Frame length** & 0.256 \\ \hline
**Frame stride** & 0.064 \\ \hline
**Filter number** & 20 \\ \hline
**FFT length** & 256 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Relevant parameters used to generate MFCCs.  
not yield the desired results in our specific case. As a result, we experimented with other configurations to achieve the best balance between model accuracy and resource efficiency.  
Given the constraints of TinyML, where devices are resource-limited and power-sensitive, it was essential to choose parameters that minimized memory usage and computational time. The final selected parameters consume 38 KB of RAM and have a processing time of 763 ms, based on estimates provided by the Edge Impulse platform for an Arduino Nano 33 BLE [38].