A subscription to JoVE is required to view this content. Sign in or start your free trial.

Method Article

Machine Learning-Based Cough Tone Classification: Diagnostic Exploration of Chronic Obstructive Pulmonary Disease and Respiratory Tract Infections

1.1K views

DOI:

10.3791/68222

September 19th, 2025

* These authors contributed equally

In This Article

Summary

This study effectively accomplished the automated classification of two distinct categories by acquiring cough sound data from patients diagnosed with chronic obstructive pulmonary disease (COPD) and respiratory tract infections (RTI), utilizing an integration of speech signal processing techniques and machine learning algorithms.

Abstract

The objective of this study was to develop and evaluate a non-invasive method for distinguishing patients with chronic obstructive pulmonary disease (COPD) from those with respiratory tract infections (RTI) using voice signal analysis and machine learning. Fixed-pattern voice signals were collected from 25 COPD patients and 25 RTI patients (serving as the control/comparison group). Multi-dimensional voice feature analysis was performed to identify features significantly differentiating the two groups. Statistically significant features were selected and subjected to dimensionality reduction. Logistic Regression (LR) and Random Forest (RF) models were then trained and evaluated for classification performance in distinguishing COPD from RTI. Over 400 voice features were initially analyzed. Eighteen features showed highly significant differences between COPD and RTI patients (P <; 0.05). In the task of distinguishing COPD patients from RTI patients, the LR model achieved a test set area under the curve AUC of 0.95, significantly outperforming the RF model (AUC = 0.76). This study demonstrates the feasibility of using voice analysis and machine learning, particularly the LR model, as a promising non-invasive tool for differentiating COPD from RTI. It provides a foundation for the practical application and further optimization of this voice-based approach in clinical settings requiring differential diagnosis of respiratory conditions.

Introduction

Chronic obstructive pulmonary disease (COPD) and respiratory tract infections represent significant contributors to mortality and morbidity on a global scale. COPD is defined as a chronic inflammatory condition affecting the airways and lung parenchyma, predominantly induced by smoking. It is characterized by symptoms such as persistent cough, dyspnea, and increased sputum production1. The World Health Organization projects that by 2030, COPD will rank as the third leading cause of death worldwide, imposing a substantial economic burden2,3. In contrast, respiratory tract infections (RTI) account for approximately 6% of the global disease burden, surpassing the burden associated with ischemic heart disease, HIV infection, cancer, malaria, and diarrheal diseases4.

Due to the substantial similarities in the clinical manifestations of the two diseases, particularly in the symptomatology of cough, which is a prevalent symptom, early and precise differentiation between these diseases is essential for effective treatment5,6. Traditional diagnostic approaches predominantly depend on clinical symptom assessment, lung function testing, and laboratory analyses7. While conventional diagnostic methods for COPD are effective in identifying and evaluating the condition, they exhibit several limitations in clinical practice. These limitations include inadequate diagnostic accuracy, limited capacity for early diagnosis, insufficient understanding of disease heterogeneity, and a lack of dynamic monitoring8,9,10,11. In contrast to traditional diagnostic methods for COPD, voice diagnosis technology, as an emerging auxiliary tool, offers numerous advantages, particularly in early detection, non-invasive diagnosis, and dynamic monitoring.

With advancements in speech analysis, particularly the automated analysis of cough sounds, there is emerging potential for rapid diagnostic applications. Research indicates that cough sounds encapsulate extensive information regarding pulmonary diseases, with their acoustic features reflecting alterations in airway health status12. Recently, machine learning-based techniques for speech feature analysis have been employed in diagnosing COPD and other conditions, yielding notable outcomes13,14,15. These methodologies facilitate the effective classification of diseases by extracting audio features from cough sounds, such as frequency, duration, and amplitude, and integrating them with machine learning algorithms for pattern recognition.

Despite some studies investigating the potential of cough sound analysis in disease diagnosis, significant challenges persist in differentiating between COPD patients and those with RTI. This difficulty arises due to overlapping characteristics in the cough sounds of both groups, compounded by individual variability. Consequently, the development of methods to extract more precise and distinguishable features from cough sounds remains a critical issue in this domain.

This study seeks to investigate an automated classification method for cough sounds by recording audio from 25 patients diagnosed with COPD and 25 patients with RTI. By integrating speech feature analysis with machine learning algorithms, we aim to enhance the accuracy of disease differentiation, thereby improving early diagnostic capabilities for COPD and RTI.

Access restricted. Please log in or start a trial to view this content.

Protocol

The Ethics Committee of Beijing University of Chinese Medicine and its Third Affiliated Hospital approved this research study. All participants provided their written informed consent to participate. Between July and August 2024, a cohort of 25 COPD patients was recruited from the Respiratory Medicine Department at the Third Affiliated Hospital of Beijing University of Chinese Medicine. Simultaneously, a control group consisting of 25 patients with typical upper RTI was also assembled.

1. Participant selection

  1. Inclusion criteria
    1. Select the audio samples with low background noise and clear articulation.
    2. Ensure that a COPD diagnosis for the COPD group is mandated by clinical guidelines set by lung experts.
      1. Confirm diagnosis via post-bronchodilator spirometry (FEV1/FVC < 0.70) per GOLD 2024 criteria.
      2. Verify clinical stability (no exacerbations ≥ 4 weeks)
    3. Ensure that the comparison group comprises people suffering from typical upper RTI.
      1. Diagnose using the diagnostic criteria of the Diagnosis and Treatment Guidelines for Respiratory Infection Diseases.
      2. Ensure symptom onset time ≤ 72 h.
      3. Exclude chronic respiratory disease history.
    4. Restrict age to 18-85 years.
    5. Request that all participants provide written informed consent to participate in the study.
  2. Exclusion criteria
    1. Exclude participants who are experiencing speech difficulties, such as vocal cord disorders or laryngitis.
    2. Exclude participants with neurological conditions that may impair speech or cognitive functions.
    3. Exclude participants with significant hearing impairments.
    4. Exclude participants who did not adhere to study protocols or failed to provide a sufficient number of audio samples.
    5. Exclude participants who are unable to provide informed consent.

2. Study design

  1. Move the participants to a quiet, isolated standard clinical consultation room (4 m × 5 m dimensions), with external noise levels maintained below 30 dB. Have them sit in a natural, comfortable posture and remain in a relaxed state.
  2. Meticulously document the essential details of the participant, including height, weight, age, and other relevant information, and confirm their current health status with a physician.
  3. Upon completion of the initial data recording, adjust the microphone's height to the appropriate position, ensuring a distance of approximately 20-30 cm between the microphone and the participant's lips.
  4. Collect the audio recordings using a professional portable handheld multitrack recorder, with the sampling rate uniformly set to 44.1 kHz.
    1. Perform the device calibration prior to daily recording sessions. Press and hold the GAIN knob of the target channel for 2 s until the screen displays CAL and the current level value.
    2. Adjust the gain to the target value by slowly rotating the GAIN knob until the input level shown on the screen precisely matches the nominal value of the test tone. Ensuring an error margin within ≤±1 dB.
  5. Under the guidance of the sampling team, let the participant naturally cough in accordance with their condition. Capture the cough sounds using recording devices.
  6. Record the audio as `.WAV` file format.
  7. Abnormal audio segments were removed using voice activity detection (VAD) complemented by manual verification. Recordings that met the signal-to-noise ratio (SNR) threshold of >20 dB were included in the study.
    ​NOTE: The full methodology is available in our GitHub repository (https://github.com/Liteng811/speech-feature-index-database-construction).

3. Development of the Vocal Feature Repository

NOTE: The voice feature indicator database is a collection of acoustic characteristics for comparative analysis of vocal patterns in COPD versus RTI. The methodological architecture is detailed in Table 1. An open-source codebase for its construction has been implemented and is accessible on GitHub (https://github.com/Liteng811/speech-feature-index-database-construction). The steps below detail the code's download and execution. 

  1. Install MATLAB on the computer from the MathWorks official website (https://www.mathworks.com/). Ensure that the appropriate version for the operating system is selected. To verify that MATLAB is installed correctly, start the MATLAB software and type ver in the command window. If installed properly, the version information of MATLAB should appear.
  2. Install Git from the official Git website (https://git-scm.com/). To confirm the successful installation, enter the following command in the command line (Command Prompt for Windows, Terminal for Mac/Linux): git --version. If Git has been installed successfully, the version information will be displayed.
  3. Retrieve the Code Repository
    1. Using a command-line interface, execute the git clone command to download the project files to your local machine:
      git clone https://github.com/Liteng811/voice-feature-index-database-construction.git
      NOTE: This operation creates a new directory named "voice-feature-index-database-construction" in your present working directory, containing all project files.
    2. Access the downloaded folder to manage its contents by running:
      cd voice-feature-index-database-construction.
  4. MATLAB Environment Setup.
    1. Start the MATLAB application.
    2. Integrate the project folder into the MATLAB search path. Navigate to the Home tab, click Set Path, then Add Folder. Select the cloned voice-feature-index-database-construction directory and save the changes. This allows MATLAB to access all necessary scripts.
    3. From the Current Folder panel in MATLAB, open the main processing script (voiceH6_batch_3_stage_WAV_tt.m) by double-clicking on it.
  5. Data Preparation.
    1. The analysis requires input audio files in .wav or .pcm format.
    2. The paths to these audio files are hardcoded within the scripts. Update these path variables to point to the correct locations on the local system.
  6. Script Execution.
    1. With the main script (voiceH6_batch_3_stage_WAV_tt.m) open, initiate processing by either clicking the Run button or typing the script name directly into the MATLAB Command Window: voiceH6_batch_3_stage_WAV_tt.
    2. The script necessitates user interaction. MATLAB will display a graphical interface prompting the user to choose the appropriate audio file or folder. Ensure that the audio file or folder selected for processing matches the prompt.
    3. If issues with the graphical interface freezing or not displaying when running the script in MATLAB are encountered, verify potential compatibility issues with the MATLAB version or ensure that the operating system's graphics drivers are functioning properly.
  7. Output the results. Upon completion, search for a .txt output file where the script will have written the feature extraction results. The output file will contain information such as the audio feature recognition results.

4. Data analysis

NOTE: Following the assembly of the vocal feature indicator database, statistical analyses were conducted. The analytical approach is outlined in Table 2. The Mann-Whitney U test was employed to assess differences in the voice signal features between the COPD and RTI groups.

  1. Test for Mann-Whitney U.
    NOTE: After obtaining the speech feature index library, the Mann-Whitney U test was performed on the data using SPSS 20.0. The operation process is as follows:
    1. Open SPSS and load the data file.
    2. Select Analyze > Nonparametric Tests > Legacy Dialogs > 2 Independent Samples from the menubar.
    3. In the pop-up dialog box:
      1. Test Variable List: Select the variables to be compared (observed variables).
      2. Grouping Variable: Select the grouping variable (the variable that will be used for grouping).
      3. Click the Define Groups button to enter the identifiers of the two groups in the pop-up window (for example, if grouped as "Group 1" and "Group 2," enter 1 and 2).
    4. In the Test Type, select the Mann-Whitney U test partially.
    5. Click OK, and SPSS will automatically generate the output.
  2. Principal Component Analysis (PCA)
    NOTE: Following the identification of statistically significant features, Principal Component Analysis (PCA) was employed for advanced data exploration. This technique reduces dimensionality by condensing the original variables into a smaller set of composite components that preserve critical information and simplify the interpretability of the dataset. Prior to performing PCA, the data were automatically standardized by the statistical software to mitigate scale-related biases. The procedure was executed as follows:
    1. Ensure that the data has been collated, saved in Excel or CSV format, and imported into SPSS 20.0.
    2. Select File > Open > Data, then select the file to open.
    3. Ensure that the missing values and outliers in the data are handled, and that the variables are standardized.
    4. For PCA analysis in SPSS, click Analyze > Dimension Reduction > Factor.
    5. In the dialog box, add all the variables used in PCA to the Variables field. These variables are usually continuous data.
    6. Set up the extraction method.
      1. In the dialog box, click the Extraction button and select the Principal Components method. By default, SPSS extracts enough principal components to explain the variance in the data.
      2. Select Eigenvalues greater than 1 as the retention criterion, meaning that only principal components with eigenvalues greater than 1 are retained, which usually explains most of the variance.
    7. Select the rotation method and click Rotation to choose either Varimax (orthogonal rotation) or Promax (oblique rotation). For most applications, Varimax is a commonly used rotation method.
    8. In the options, check the Scree plot and Coefficient matrix so that the gravel diagram of the principal components and the coefficient matrix of each principal component can be output to help judge the retained variance.
    9. After setting all the options, click the OK button, and SPSS will generate the output.
    10. Interpretation of the results.
      1. Interpret the principal component loading matrix to identify relationships between principal components and original variables. Note that variables with higher load values require greater contribution to changes.
      2. Explain variance using the "Total Variance Explained" table. Observe eigenvalues and variance proportions for each principal component. Select principal components with large variance proportions, as they typically explain most data variation.
      3. Use the scree plot to determine retained principal components. Identify the clear inflection point in the plot. Retain principal components to the left of the inflection point.
      4. Principal component scores: Check save as variables if the score for each sample on the principal component needs to be obtained, and SPSS will add the principal component scores to the dataset as new variables.

5. Building the Logistic Regression (LR) and Random Forest (RF) model

NOTE: The specific methodological framework for constructing LR and RF models is detailed in Table 3. Meanwhile, the LR and RF models in this study have been uploaded to GitHub (https://github.com/Liteng811/The-distinction-between-COPD-and-respiratory-infections). The following will primarily describe how to download and run the code from GitHub. The RF model was constructed using Python 3.12.3 as the primary programming language.

  1. Obtain the project codebase.
    1. Launch a terminal or command prompt and run the git clone command to download the repository locally:
      git clone The-distinction-between-COPD-and-respiratory-infections.git The-distinction-between-COPD-and-respiratory-infections.git
      Note that this command retrieves all repository contents into your current working directory, generating a new folder titled The-distinction-between-COPD-and-respiratory-infections.
  2. Set Up the Programming Environment.
    1. Download and install Python from the official distribution site (https://www.python.org/).
    2. Use the command below to install all Python dependencies listed in the requirements file: pip install -r requirements.txt.
    3. If the requirements.txt file is unavailable, install the essential libraries manually by executing:
      pip install numpy pandas scikit-learn matplotlib
    4. Install the PyCharm integrated development environment from the official JetBrains website (https://www.jetbrains.com/pycharm/).
  3. Explore Repository Contents.
    1. In the repository, locate the main script files (LR.py, RF.py).
    2. Open these files using a code editor or PyCharm to review their implementation and structural details.
  4. Prepare the input data.
    1. Ensure that the required dataset is available in .xlsx format, as expected by the code, and properly organized before execution.
    2. The code contains hardcoded file paths. Update these paths to reflect the actual locations of the files, effectively replacing the existing paths in the code (e.g., C:\Users\1\Desktop\pca-result.xlsx) with the actual file paths on the system.
  5. Run the code.
    1. Once the main script is located, execute it via the command line. For instance, to run LR.py, use: python LR.py
      If the target script is RF.py, substitute the filename accordingly.
    2. Before execution, ensure the terminal is in the correct working directory, or specify the full path to the script. For example:
      python C:/path/to/your/repository/LR.py.
    3. During operation, the script will load the dataset, train the corresponding machine learning model (LR or RF), and generate performance metrics including accuracy, confusion matrix, and ROC curve.

Access restricted. Please log in or start a trial to view this content.

Results

Data analysis results

The research successfully isolated over 400 speech feature indexes using methods like time domain analysis, frequency domain analysis, extraction of Mel-frequency Cepstral Coefficient (MFCC), and altering feature indicators according to TCM diagnosis. Analyzing the time domain is a crucial element in speech signal processing, focusing on the direct manipulation of signal time series data to...

Access restricted. Please log in or start a trial to view this content.

Discussion

This study investigates non-invasive methods for detecting COPD through voice signal analysis and machine learning techniques. It involved collecting voice data from 25 COPD patients and 25 patients with RTI. Models were constructed using LR and RF algorithms. Both models showed similar accuracy in correctly classifying samples overall, yet the difference in AUC values indicates that the LR model might offer a superior balance between sensitivity and specificity. The subsequent sections provide a detailed examination of ...

Access restricted. Please log in or start a trial to view this content.

Disclosures

The authors declare no conflicts of interest regarding the publication of this study. No financial or non-financial support was received from any commercial organization that could have influenced the results or interpretation of this research. All aspects of the study, including design, data collection, analysis, and manuscript preparation, were conducted independently of any external influence.

Acknowledgements

This study was supported by the National Natural Science Foundation of China Youth Science Fund Project (Project Approval Number: 82104739) and the Scientific Research Program of the Hebei Provincial Administration of Traditional Chinese Medicine (Project Number: B2025032). The authors would like to thank all the teachers and students who provided assistance during the experiment.

Access restricted. Please log in or start a trial to view this content.

Materials

List of materials used in this article
NameCompanyCatalog NumberComments
Digital RecorderZOOMH6ZOOM Audio Store
GitHubGit2.47.1.2Official Website
MatlabMathWorksR2024bOfficial Website
PycharmJetBrains2024.1Official Website
PythonPython3.12Official Website

References

  1. Roth, M. Pathogenesis of COPD. Part III. Inflammation in COPD. Int J Tuberc Lung Dis. 12 (4), 375-380 (2008).
  2. Alsayari, A., Muhsinah, A. B., Almaghaslah, D., Annadurai, S., Wahab, S. Pharmacological efficacy of ginseng against respiratory tract infections. Molecules. 26 (13), 4095(2021).
  3. Iheanacho, I., Zhang, S., King, D., Rizzo, M., Ismaila, A. S. Economic burden of chronic obstructive pulmonary disease (COPD): A systematic literature review. Int J Chron Obstruct Pulmon Dis. 15, 439-460 (2020).
  4. Al Rajeh, A. M., et al. Acute upper respiratory tract infections admissions in England and Wales. Medicine (Baltimore). 102 (21), e33616(2023).
  5. Lieberman, D., et al. Pneumonic vs nonpneumonic acute exacerbations of COPD. Chest. 122 (4), 1264-1270 (2002).
  6. Hassan Naqvi, S. Z., Choudhry, M. A. Embedded system design for classification of COPD and pneumonia patients by lung sound analysis. Biomed Tech (Berl). 67 (3), 201-218 (2022).
  7. Rennard, S., et al. Introducing the COPD Foundation Guide for Diagnosis and Management of COPD, recommendations of the COPD Foundation. COPD. 10 (3), 378-389 (2013).
  8. Spyratos, D., et al. false diagnosis and treatment of COPD in a selected population in Northern Greece. Eur J Gen Pract. 27 (1), 97-102 (2021).
  9. Azleen, A., Wilkinson, T. Early COPD: current evidence for diagnosis and management. Ther Adv Respir Dis. 14, 1753466620942128(2020).
  10. Kostikas, K., et al. Clinical impact and healthcare resource utilization associated with early versus late COPD diagnosis in patients from UK CPRD database. Int J Chron Obstruct Pulmon Dis. 15, 1729-1738 (2020).
  11. Cosio, B. G., et al. Defining the asthma-COPD overlap syndrome in a COPD cohort. Chest. 149 (1), 45-52 (2016).
  12. Kilic, M., et al. GCLP: An automated asthma detection model based on global chaotic logistic pattern using cough sounds. Eng Appl Artif Intell. 127, 107184(2024).
  13. Idrisoglu, A., et al. COPDVD: Automated classification of chronic obstructive pulmonary disease on a new collected and evaluated voice dataset. Artif Intell Med. 156, 102953(2024).
  14. Karaarslan, O., Ergen, O., Belcastro, K. D. Respiratory sound-base disease classification and characterization with deep/machine learning techniques. Biomed Signal Process Control. 87, 105570(2024).
  15. Farrús, M., et al. Speech-based support system to supervise chronic obstructive pulmonary disease patient status. Appl Sci. 11 (17), 7999(2021).
  16. Akamatsu, N. Segmentation of speech utilizing the time-domain properties of speech signals. J Acoust Soc Am. 64, S179(1978).
  17. Joy, S., Upadhya, S. Speech analysis in time and frequency domain. Int J Eng Res Technol. 3 (1), 1-4 (2018).
  18. Do, H. D. Exploiting signal linear trend in the time domain to enhance speech feature. IEEE Access. 10, 117886-117899 (2022).
  19. Schroeder, R. M. New approach to time domain analysis and synthesis of speech. J Acoust Soc Am. 31 (6), 852-853 (1959).
  20. Garreth, P., Johnson, S. R., Green, G. G. R. Extracting amplitude modulations from speech in the time domain. Speech Commun. 53 (6), 903-913 (2011).
  21. Thomas, S., Ganapathy, S., Hermansky, H. Recognition of reverberant speech using frequency domain linear prediction. IEEE Signal Processing Letters. 15, 681-684 (2008).
  22. Malah, D. Efficient implementation of a frequency-domain technique for frequency scaling of speech signals. J Acoust Soc Am. 68 (S1), (1980).
  23. Képesi, M., Weruaga, L. Adaptive chirp-based time-frequency analysis of speech signals. Speech Commun. 48 (5), 474-492 (2006).
  24. Isangula, K. G., Haule, R. J. Leveraging AI and machine learning to develop and evaluate a contextualized user-friendly cough audio classifier for detecting respiratory diseases: Protocol for a diagnostic study in rural Tanzania. JMIR Res Protoc. 13, e54388(2024).
  25. Wang, Q., et al. Towards reliable respiratory disease diagnosis based on cough sounds and vision transformers. ArXiv. , (2024).
  26. Can machine learning be used to recognize and diagnose coughs. Bales, C., et al. 2020 International Conference on e-Health and Bioengineering (EHB), , (2020).
  27. Melek, N. Responding to challenge call of machine learning model development in diagnosing respiratory disease sounds. ArXiv. , (2021).

Access restricted. Please log in or start a trial to view this content.

Reprints and Permissions

Tags

Machine Learning DiagnosticsVoice Signal AnalysisLogistic Regression ModelRandom Forest ModelPrincipal Component AnalysisVoice Feature ExtractionNon-Invasive Diagnosis