Intelligent Analysis of Nonlinear Respiratory Acoustic Signals for Early Disease Screening Using a Hybrid Convolutional Neural Network–Bidirectional Long Short-Term Memory Framework
Abstract:
Physiological acoustic signals generated during respiration exhibit complex and often nonlinear characteristics that pose challenges for reliable analysis, particularly under real-world recording conditions. This study explores an intelligent signal analysis framework for early respiratory disease screening based on the processing of nonlinear respiratory sound patterns acquired via mobile devices. A hybrid deep learning architecture combining convolutional neural networks (CNNs) and bidirectional long short-term memory (BiLSTM) units is employed to capture both spectral structures and temporal dependencies inherent in respiratory acoustics. The proposed framework integrates feature extraction, nonlinear temporal–spectral representation, and server-side inference within a unified system architecture. Mel-frequency cepstral coefficients (MFCC) are used to characterize the acoustic signals, while the hybrid CNN–BiLSTM model learns discriminative patterns associated with different respiratory conditions. Experimental evaluation using a publicly available dataset demonstrates stable classification performance under moderately noisy conditions and varying recording scenarios, indicating robustness to practical acquisition constraints. The results suggest that intelligent learning-based representations can provide effective tools for analyzing nonlinear biomedical signals and supporting early-stage disease screening. Although focused on respiratory sound analysis, the proposed approach illustrates a general framework for intelligent interpretation of complex acoustic signals, which may be extended to other nonlinear signal analysis tasks in health-related and engineering applications.1. Introduction
Respiratory diseases like asthma, chronic obstructive pulmonary disease (COPD), and other upper and lower airway infections can be responsible for a great deal of disease burden globally due to mortality and long-term impact on daily living. Health authorities estimate that conditions that affect the health of the heart and lungs kill millions of people every year and leave many other patients needing prolonged treatment. For this reason, recognizing symptoms early can slow disease progression, prevent complications, and aid in achieving better treatment outcomes. Although commonly used, traditional stethoscope-based auscultation methods depend heavily on clinician experience, surrounding noise, and the quality of sound obtained. These factors limit the reliability and repeatability of manual measurements. Recently, systems utilizing computer-aided analysis of respiratory sounds have garnered attention as a promising approach for preliminary screenings and remote monitoring situations [1].
In recent years, the availability of open-access respiratory sound datasets has significantly supported research in this area, making it possible to test a wide range of deep learning models. One of the most frequently used resources, the International Conference on Biomedical and Health Informatics (ICBHI) 2017 Respiratory Sound Database, includes 920 audio recordings and 6,898 respiratory cycles from 126 individuals. Studies conducted with such datasets have shown that features like Mel-frequency cepstral coefficients (MFCCs), when combined with models such as convolutional neural networks (CNNs) or recurrent structures like long short-term memory (LSTM), can yield strong classification performance. Despite these advances, transferring similar approaches directly to mobile environments still poses several obstacles. Differences in device hardware, ambient noise during recording, microphone quality, and the need for near-real-time operation create practical limitations [2].
In this study, an end-to-end mobile system was designed to address these issues. The application, developed with Flutter on the client side and supported by a Flask-based application programming interface (API) on the server side, allows users to record respiratory sounds with a single tap. Once captured, the audio is processed to extract MFCC features and is then analyzed by a CNN–LSTM model running on the server. After the prediction is completed, the application presents the user with a visual indication of the model's output, including the estimated disease category and its relative likelihood. This approach aims to provide a practical and affordable method for identifying respiratory conditions, while remaining accessible enough to be used in everyday settings.
This study was conducted to design and evaluate a comprehensive mobile system that can help bridge the existing gaps in respiratory sound analysis. The system comprises a Flutter-based mobile application, responsible for the user interface and recording process, and a server-side structure built with the Flask API for feature extraction and classification tasks. Users can capture breathing or coughing sounds with a single tap, after which the audio is processed to extract MFCC features and evaluated by a CNN–LSTM model. The model was trained using the Asthma Detection Dataset v2 available on Kaggle, and achieved an accuracy of 92.15% during testing. The application presents the analysis outcome to the user in a clear visual format and provides an initial indication of the likely respiratory condition suggested by the model.
In practical use, mobile devices often face a range of varying conditions—ambient noise, differences in microphone hardware, changes in the distance between the device and the user, and occasional recording mistakes. Each of these factors can impact the performance of a diagnostic system. For this reason, the present study examined not only the model's classification accuracy but also how consistently and reliably the system responded under these real-world conditions. The findings suggest that deep learning models integrated into mobile platforms can serve as an effective decision-support tool for early diagnosis, even when deployed on relatively modest hardware. In this respect, the study offers a meaningful contribution to ongoing discussions in the literature concerning noise tolerance, device variability, and real-time processing capabilities.
2. Related Studies
Doctors have long relied on breath sounds to evaluate respiratory problems. Stethoscope assessments are subjective, as the result depends on the assessor and can vary depending on the clinician's knowledge. The limited accessibility of prior information has encouraged the design of automated systems for analyzing respiratory sounds. Due to advancements in sensor technology, the increasing computational capabilities of portable devices, and progress in machine learning methods, these systems have begun to show potential for usability beyond clinical environments and are being explored for wider everyday use [3].
Many researchers have proposed various methods in the literature, ranging from classical signal-processing methods to recent deep learning-based models for classifying respiratory sounds. Previous studies mostly processed time and frequency domain features, such as MFCC, zero-crossing rate, and spectral centroid. The features were then passed to classical machine learning algorithms, such as Support Vector Machine, Random Forest, and k-Nearest Neighbors, among others. These approaches provided a wealth of useful information at the time, but were generally unable to model the more complex acoustics in the respiratory recordings. This shortcoming fostered the growing shift toward deep learning methods, which can learn richer, more complex representations directly from the data. In recent years, deep learning models have demonstrated notably strong performance in analyzing respiratory sounds. Palaniappan [4] employed a deep CNN architecture to classify wheeze and crackle sounds, achieving an accuracy of 92%. Perna and Tagarelli [5] proposed a hybrid CNN–LSTM architecture that can jointly learn from frequency and time dimensions, reporting performance improvement of approximately 6% over CNN-based models alone.
Similarly, Rocha et al. [6] adapted pre-trained voice recognition networks to medical respiratory data using transfer learning, thereby increasing accuracy to 95%. Addressing the problem of data imbalance, Xiao et al. [7] increased the recognition rate of rare respiratory types. They achieved a significant increase in classification accuracy with data augmentation strategies based on the Synthetic Minority Oversampling Technique. Most of these studies were conducted using the ICBHI 2017 Respiratory Sound Database, a widely recognized standard reference dataset. This dataset comprises 920 audio recordings from 126 patients, totaling 6,898 respiratory cycles. However, the fact that this dataset was recorded under laboratory conditions, with high-quality microphones and in a noise-free environment, presents some limitations when compared to mobile recordings obtained under real-world conditions.
Therefore, in recent years, mobile-based approaches have emerged as a significant research direction, particularly in terms of portability and accessibility. Rahman et al. [8] adapted an offline model for early asthma diagnosis and showed that this approach could facilitate access to healthcare, especially in low-income areas.
In parallel, increasing attention has been directed toward explainable artificial intelligence. In the healthcare field, it is not sufficient for a model to be accurate. It is also essential that the decision-making process be transparent and understandable. For this reason, methods such as SHapley Additive exPlanations, Local Interpretable Model-agnostic Explanations, and Gradient-weighted Class Activation Mapping are employed to interpret the outputs of respiratory sound classification models. In conclusion, the literature indicates that AI methods have achieved high success in respiratory sound classification; however, maintaining this success with portable devices and real-world recordings remains an area of ongoing research. In this study, a model based on the principle of processing and analyzing the sound obtained from the user on a local server (Flask API) was proposed, which preserves privacy and shortens the analysis time [9].
To contextualize the present work, results were compared qualitatively with recent mobile-based respiratory analysis studies. While direct numeric comparison is limited by differing datasets (e.g., ICBHI vs. proprietary mobile-collected datasets), the proposed hybrid CNN–bidirectional long short-term memory (BiLSTM) model achieves competitive accuracy (92.15%) while maintaining a model size and latency appropriate for server-supported mobile deployment [10].
3. Materials and Methods
The current study utilizes an open-source audio dataset, Asthma Detection Dataset v2, published on Kaggle. The dataset contains audio recordings of individuals with various respiratory diseases. Each recording is saved in .wav format at a sample frequency of 15 kHz. According to the dataset, the six classes are asthma, bronchiectasis, bronchiolitis, COPD, pneumonia, and healthy (representing healthy individuals). Each class has a mean of 200 recordings that belong to different age groups. The KaggleHub API was used to download the data, which was then labeled according to its classes and made ready. The dataset consists of breathing and coughing sounds collected from real patients using a digital stethoscope and mobile recording devices within supervised clinical settings for the Voice of Healthcare dataset. Every audio file is marked by medical experts according to respiratory diseases labeled by a health practitioner expert like asthma, COPD, pneumonia, bronchiolitis, etc. The audio samples added are not artificial or synthetic. If available, patient age and gender, recording device metadata, and other skills are included in the dataset to evaluate clinical relevance and possible effects on subjects. Figure 1 shows the waveforms of sample respiratory recordings in the dataset.

This dataset is widely referenced in medical sound analysis and is regarded as a dependable resource for validating AI models. It was chosen for this study due to the consistent quality of its recordings and the fact that it covers a broad range of respiratory conditions, which makes it suitable for training and evaluating machine learning approaches.
To prevent data leakage and ensure a clinically valid evaluation, the dataset was divided using a patient-wise split rather than a recording-wise split. Many patients contributed multiple breathing cycles, and assigning these recordings randomly to both training and testing sets could cause the model to learn patient-specific vocal characteristics instead of disease-related patterns. Therefore, all recordings belonging to the same patient were placed exclusively in either the training (80%) or the testing (20%) partition. This procedure guarantees that the test set contains only unseen patients, providing a realistic assessment of generalization performance [11].
Raw audio recordings are not suitable for direct use in training the model. Therefore, a series of preprocessing steps has been applied to each recording. First, all recordings were converted to mono format, brought to a fixed sampling rate (16 kHz), and their amplitude values were normalized. Next, low-frequency background noise was filtered out, and MFCC features were extracted.
Since MFCC is a method that mimics the frequency perception of the human ear, it is often preferred in speech-based classification problems. In this study, 13 MFCC coefficients were extracted from each speech sample, and the averages of these coefficients over time were taken to form a fixed-length vector. The MFCC computation consists of several mathematical steps. The mel-scaled cepstral coefficient for the $n$-th term is defined as [12]:
where, $k$ represents the index of the mel-filter bank; $n$ is the index of the cepstral coefficient; $X_{k}$ denotes the magnitude of the short-time Fourier transform for each frequency bin; and $K$ is the number of mel-filter outputs. This formulation enables the model to represent the spectral characteristics of each recording in a compact numerical form, making it suitable for machine learning methods. Figure 2 shows the MFCC spectrogram of sample voice recordings from different diseases.

Several data augmentation techniques were employed to address the class imbalance issue. To increase the sample sizes in classes with limited amounts, noise addition, time stretching, and pitch shifting were employed. These improvements made the model better at generalizing and reduced training overfitting.
The deep learning model used in this study employs a hybrid design that combines CNN and BiLSTM layers. This combined structure enables the system to learn both the temporal behavior of respiratory sounds and their frequency-related characteristics at the same time, allowing it to capture a wider range of meaningful patterns within the audio signals [13]. The model was created using the TensorFlow Keras API in a sequential format. The layer structure of the model is summarized below:
Layer I: Conv1D (64 filters, kernel size = 3, padding = ‘same’)
This layer extracts low-level time-frequency features from input signals. The learning process is then balanced by applying the LeakyReLU ($\alpha$ = 0.1) activation function and BatchNormalization. Noise reduction and dimension reduction are achieved with the MaxPooling1D layer (pool_size = 2).
Layer II: Conv1D (128 filters)
This layer captures more abstract acoustic patterns. The generalization ability is enhanced with LeakyReLU and BatchNormalization layers.
Layer III: First BiLSTM (64 neurons)
This layer learns the forward and backward dependencies of respiratory signals over time. Dropout (0.25) is then applied to reduce the risk of overfitting.
Layer IV: Second BiLSTM (64 neurons)
This layer processes temporal relationships at a deeper level. The model's stability is increased with BatchNormalization and Dropout (0.3) layers.
Layer V: Dense (128 neurons)
This layer acts as a fully connected layer and compresses features to prepare them for classification. LeakyReLU ($\alpha$ = 0.1) activation and BatchNormalization have been applied, followed by Dropout (0.3) regulation.
Layer VI: Output Layer – Dense (num_classes, softmax)
This layer generates a probability value for each respiratory disease class. The AdamW algorithm (learning rate = 0.001, weight decay = 1e-4) was employed for model optimization. Sparse categorical crossentropy was selected as the loss function, and EarlyStopping (patience = 10) and ReduceLROnPlateau (patience = 5, factor = 0.5) callbacks were added to the training process.
During the training phase, a batch size of 32 and a training-to-validation ratio of 80% to 20% were used, respectively. The model was trained for a total of 100 epochs within the prepared environment. The model obtained a training accuracy of 94.8% and a test accuracy of 92.15% as a result of the training. Based on these outcomes, the system can differentiate between various respiratory disorders with good reliability. Figure 3 shows the architecture of the proposed CNN–BiLSTM hybrid model implemented with TensorFlow Keras [14].

The primary objective of the system developed within this study is to ensure the secure and latency-free transmission of respiratory sounds recorded via the mobile application to the AI model running in the background. To this end, a Representational State Transfer web service based on the Flask framework, commonly used in Python, was implemented on the server side. Flask's lightweight and adaptable structure provides a convenient environment for integrating machine learning models and managing communication with mobile clients.
When a user has finished recording audio in the application, the .wav file is sent to the Flask API via a Hypertext Transfer Protocol (HTTP) POST request to a certain endpoint (like /predict). When a request is received, the server temporarily saves the file and loads the pre-trained model (for example, resp_model.h5) to conduct the classification. The application receives the outcome prediction, which indicates the likely disease category and the confidence value, in JavaScript Object Notation (JSON) format. This setup forms a communication workflow between the mobile client and the server that is capable of operating with low latency and, when needed, supporting asynchronous data transmission. To ensure secure access from both emulators and physical devices on the same network, the Flask-CORS extension is enabled, allowing different devices to interact with the API without running into cross-origin restrictions. Figure 4 shows the overall system architecture showing mobile application → Flask API → model interaction [15].

The Flask-based web service is organized using the Blueprint structure (Figure 5), which separates different parts of the application into manageable modules. Prediction endpoints, error-handling routines, and logging functions are each placed in their own sections, making the system easier to maintain and extend. This modular design also supports future enhancements—such as integrating server-side logging, gathering usage statistics, or adding a web-based interface for visualizing outputs—without requiring major changes to the overall architecture. Because each module operates independently, updates can be made with minimal disruption to other components, ultimately improving the scalability of the system [16].

In the Flask-based application, the TensorFlow–Keras model is loaded into memory when the server starts and is reused for all subsequent requests without being reloaded. This approach eliminates unnecessary overhead, enabling predictions to be generated more quickly and with better utilization of system resources. After the model completes its evaluation, the resulting output is sent back to the mobile application through the API in JSON format. The disease classification result and the confidence percentage of the prediction are displayed as separate fields in the application interface. The system operates in a series of stages [16]. Figure 6 shows the data flow representation showing the end-to-end process from recording to prediction and output visualization. In the first step of this process:
$\bullet$ The “Disease Analysis” section in the mobile application opens, and a voice recording is taken from the user.
$\bullet$ After the recording is completed, the resulting .wav file is temporarily stored on the device before processing.
$\bullet$ The file is uploaded to the Flask API endpoint/predict.
$\bullet$ The API loads the AI model and performs classification.
$\bullet$ The result (predicted disease and confidence) is returned to the mobile application.

The performance of the CNN–BiLSTM-based hybrid model developed in this study was evaluated using training and validation data. The model was trained for 100 epochs, with overfitting prevented by using early stopping and ReduceLROnPlateau strategies. Based on the results obtained during the training process, the model's accuracy rate was recorded as 92.15%. This result indicates that the model effectively distinguishes between respiratory diseases based on breath sounds. Furthermore, the steady decline in validation loss during training suggests that the model was able to generalize effectively to unseen data. Figure 7 shows the training and validation accuracy curves [16].

The performance of the classification model was assessed using four commonly used evaluation metrics: accuracy, precision, recall, and F1-score. Together, these measures offer a more complete picture of how the model behaves, showing not only its overall prediction accuracy but also how well it handles minority classes and potential misclassification tendencies. The formal definitions of these metrics are presented below:
\[\mathrm{Accuracy}=\frac{\mathrm{TP}+\mathrm{TN}}{\mathrm{TP}+\mathrm{TN}+\mathrm{FP}+\mathrm{FN}}\]
\[\mathrm{Precision}=\frac{\mathrm{TP}}{\mathrm{TP}+\mathrm{FP}}\]
\[\mathrm{Recall}=\frac{\mathrm{TP}}{\mathrm{TP}+\mathrm{FN}}\]
\[\mathrm{F1}=2\times\frac{\mathrm{Precision}\times\mathrm{Recall}}{\mathrm{Precision}+\mathrm{Recall}}\]
where, TP is True Positive; TN is True Negative; FP is False Positive; and FN is False Negative.
The results show that combining CNN layers with BiLSTM units produces strong performance in classifying respiratory diseases from audio signals. After training, the model achieved an accuracy of 92.15% on the test set, which is competitive with findings reported in similar studies. The model's ability to capture both frequency-related features and temporal variations played a crucial role in distinguishing complex respiratory patterns [17].
The relatively low validation error suggests that the model did not suffer from substantial overfitting. This outcome is largely due to the effectiveness of the CNN layers in extracting meaningful local features and the BiLSTM's balanced handling of time-dependent information. Together, these components supported the accurate identification of conditions such as asthma and bronchitis based on respiratory sound recordings [17].
A confusion matrix was computed to provide a detailed, class-wise assessment of model performance. This matrix reveals which disease classes are most frequently confused and helps interpret clinical relevance. In the results, the model achieved the highest true positive rate for the healthy class, which is important for screening purposes. The most common misclassifications occurred between asthma and COPD, consistent with known acoustic overlaps. Presenting the confusion matrix enables clinicians and researchers to better understand specific error modes and to prioritize future data collection for confused class pairs.
4. Discussion and Future Work
The CNN–BiLSTM framework developed in this study showed strong performance in identifying respiratory diseases from sound recordings. Its effectiveness is largely due to its capability to analyze both the frequency characteristics of the signal and the temporal variations that unfold over time. The model produced consistent results, particularly when evaluating features such as breathing rhythm, tone, and duration—factors that commonly vary in conditions like asthma and bronchitis.
One limitation of the current study is that some disease categories contain fewer samples than others, which affects the model's ability to generalize to those groups. This issue could be reduced in future work by expanding the dataset, ensuring a more even class distribution, and incorporating recordings collected from a wider range of clinical environments. Another direction for improvement is the development of a lighter model that can run more efficiently in real time and potentially operate offline on mobile devices. Future research may also extend beyond simple disease detection, exploring systems that evaluate symptom severity or offer personalized recommendations based on a patient's history. Additionally, clinical trials and feedback from healthcare professionals are crucial for further enhancing the model's reliability and practical usability [17].
5. Conclusion
This study presents a model that combines CNN layers with BiLSTM units to detect respiratory diseases from audio recordings. Once trained, the model reached an accuracy of 92.15% on the test dataset, showing a level of performance that compares favorably with other approaches reported in the literature. Integrated with the mobile application, the system evaluates user voice recordings and produces a classification output for potential respiratory conditions.
The findings demonstrate that such hybrid deep learning approaches are suitable for use in healthcare technologies, particularly in early diagnosis applications. Using the Flask server-side infrastructure allows the system to operate sustainably for both research and application use. This study aims to contribute to the development of AI applications in the field of health informatics, as it is one example developed using local data in the field of medical voice analysis in Turkey.
The data used to support the research findings are available from the corresponding author upon request.
The author declares no conflicts of interest.
