Firearm classification from acoustic signals using combined mel spectrogram, MFCC, LFCC, and CRNN networks Authors: Lamine Elkarous, Mohamed Hechmi Jeridi, Montassar Dhouibi Published: 2025 ABSTRACT Discriminating the source of gunfire and accurately identifying the type of firearm used present a complex multifaceted challenge, requiring the integration of advanced acoustic signal processing techniques with cutting-edge deep learning methodologies. This research addresses the inherent difficulties in achieving reliable gunshot classification, which stem from the variability of acoustic signatures, environmental noise interference, and the need for real-time processing capabilities. The proposed system captures gunfire sounds using MEMS, processes the signals to extract discriminative features, and leverages deep learning models to classify firearm types. This work is conducted after addressing and emphasizing the challenges associated with acoustic principles, frequency modulation, acoustic pressure variations, and the acoustic fingerprints of different firearms. The system design phase highlights the technical complexities, the analysis of stringent requirements for real-world deployment, and the proposal and optimization of the model. The implementation involves collection of representative datasets, advanced data preprocessing techniques to mitigate noise and enhance signal quality, and the training of deep learning architectures using a novel feature set, termed MLFCC, which combines Mel spectrograms, MFCCs, and LFCCs. The proposed model demonstrates performance in real-time applications, effectively balancing accuracy and computational efficiency. Experimental results reveal the system’s ability to handle the complexities of real-world scenarios while also exposing its limitations, particularly its sensitivity to extreme environmental conditions. This work underscores the significant technical challenges involved in developing gunfire discrimination system and highlights the critical role of interdisciplinary approaches in overcoming these obstacles. By pushing the boundaries of acoustic signal processing and deep learning, this research contributes to the advancement of public safety technologies, offering a foundation for innovations in this demanding field. Introduction The rapid advancement of artificial intelligence (AI) and acoustic signal processing has opened new frontiers in security and forensic sciences, particularly in the identification and classification of gunshot sounds. Law enforcement, public safety, and emergency response systems rely on the accurate and timely detection of firearm discharges to enhance situational awareness, facilitate forensic investigations, and enable rapid responses to shooting incidents. However, the task of identifying gunshots from acoustic data remains inherently complex due to variations in acoustic signatures, environmental noise interference, and the need for real-time processing. Traditional sound classification methods have relied on spectral analysis to differentiate acoustic signatures. However, deep learning techniques-particularly Convolutional Neural Networks (CNNs) and Convolutional Recurrent Neural Networks (CRNNs)-have revolutionized the field by enabling the extraction of intricate patterns from audio data. These models excel at capturing both spatial and temporal features, making them well-suited for applications such as gunshot recognition, where distinguishing firearm discharges from background noise is critical. Despite recent progress, the lack of high-quality, annotated gunshot datasets remains a challenge for training robust deep learning models. To address this, researchers have developed specialized datasets, such as the Forensic dataset, which comprises carefully recorded gunshot samples in controlled environments. These resources aim to improve model performance and the reliability of automated systems in real-world scenarios. In this work, we propose a novel approach to firearm classification using a composite feature set called MLFCC (Mel-Linear Frequency Cepstral Coefficients), which integrates Mel spectrograms, Mel Frequency Cepstral Coefficients (MFCCs), and Linear Frequency Cepstral Coefficients (LFCCs). This comprehensive acoustic fingerprint captures complementary information across multiple frequency bands and cepstral domains, improving the discriminability of acoustic features. The proposed method leverages a CRNN architecture, combining CNN-based spatial feature extraction with the temporal modeling capabilities of RNNs to effectively capture the spectral and sequential characteristics of gunshot sounds. This work aims to overcome the challenges associated with reliable gunshot classification by pursuing three key objectives. First, it seeks to enhance feature discriminability through the development and validation of a novel composite representation, the MLFCC (Mel–Linear Frequency Cepstral Coefficients), which fuses Mel spectrograms, MFCCs, and LFCCs to jointly capture complementary spectral and cepstral cues across multiple frequency bands. Second, it focuses on designing a robust hybrid CRNN architecture that combines convolutional layers for spatial feature extraction with recurrent layers for temporal sequence modeling, thereby enabling the effective characterization of both spectral and temporal dynamics of gunshot events. Finally, the system aims to achieve high real-time classification accuracy while maintaining computational efficiency suitable for embedded deployment in practical acoustic monitoring environments. The methodology follows a pipeline of data acquisition, preprocessing, feature extraction, and model training. Advanced data augmentation techniques-including time-shifting, pitch-shifting, and noise reduction-are applied to address dataset imbalances and enhance model robustness. The system is designed for real-time operation, making it suitable for public safety applications. Experimental results demonstrate the system’s effectiveness, achieving an average accuracy of 96.3% with a loss of 0.103. However, challenges persist, particularly in distinguishing between acoustically similar firearms, such as the M4 and M16 rifles, which share sound characteristics due to their common AR-15 chassis design. Future research will focus on integrating multi-modal sensing technologies, exploring advanced signal processing techniques, and expanding the diversity of training datasets to further improve performance. By pushing the boundaries of deep learning and acoustic signal processing, this study contributes to advancements in public safety technology, laying the groundwork for future innovations in firearm detection and classification. The proposed approach represents a significant step toward addressing the technical challenges of gunshot recognition, with the potential to enhance situational awareness and response in critical scenarios. This paper is structured to provide a logical progression from methodology to experimental validation. The first section outlines the proposed approach, detailing the theoretical foundations of CRNNs and the MLFCC feature set for gunshot classification. It covers spatial and temporal processing models, data collection, preprocessing, feature extraction, and model training. The second section presents experimental results, including performance metrics and real-time testing outcomes, followed by an analysis of the system’s limitations and broader implications. Related work Acoustic identification systems have undergone substantial advancement, driven by increasing demands across a wide spectrum of application domains. Research in this field has investigated a range of algorithmic paradigms, signal processing techniques, and machine learning frameworks, while also critically examining their respective constraints and performance trade-offs. In1, the CMC method is used for identifying firearm evidence, excelling in statistical error rate estimation and forensic analysis of ballistic tool marks. However, it is limited to post-incident analysis, lacking real-time applicability, and depends on physical evidence like cartridge cases, which may not always be available. Acoustic systems, on the contrary, leverage remote sound signal capture, deep learning, and advanced signal processing, offering a more adaptable and scalable solution. The CMC method’s reliance on limited datasets and insufficient consideration of environmental factors (e.g., corrosion, damage) further restricts its robustness in real-world scenarios. In2, the study focuses on identifying air gun bullets using Empirical Mode Decomposition (EMD) for feature extraction and minimum Redundancy Maximum Relevance (mRMR) for feature selection, followed by classification with Support Vector Machines (SVM), Decision Trees (DT), and Random Forests (RF). While promising for automating ballistic examinations, the reliance on air gun data raises questions about generalizability to more complex firearms. The study’s narrow focus may not fully address the variability of traditional firearms, limiting its broader forensic applicability. Additionally, resource-intensive models like DenseNet121 may hinder real-time or resource-constrained applications. In3, the study identified a high correlation of characteristics, suggesting redundancy and limiting discriminative power. Moderate accuracy indicates room for improvement, particularly for high-precision forensic applications. The focus on statistical and geometric moment features overlooks other characteristics like texture or microlevel irregularities. The effectiveness of the method is also limited by the reliance on image quality, which can be compromised by damage, corrosion, or poor preservation. It does not account for real-world variability such as wear, manufacturing differences, or ammunition types, reducing its applicability. The computational complexity of analyzing 68 features, even after PCA, poses scalability challenges. In4, LASSO regression is used to classify firearm injury encounters, achieving strong performance (AUC: 0.92, sensitivity: 0.95, specificity: 0.89) and outperforming traditional methods such as emergency department visits and time-based approaches. However, reliance on retrospective data and ICD-10 coding can introduce biases or misclassification. The model’s generalizability is uncertain due to variability in coding practices across healthcare settings. It also does not explore advanced ML techniques, NLP, or social determinants of health. While effective, its moderate specificity may misclassify follow-up encounters, impacting its utility for injury recurrence studies. The methodologies, domains, and reported performance metrics of the existing works reviewed in this section-which include the CMC method for forensic analysis, air gun bullet identification, firing pin impression feature analysis, and LASSO regression for injury encounters-are formally summarized and contrasted with our proposed acoustic classification approach in Table 1.Table 1Benchmarking against firearm identification approaches from literature.StudyDomainMethod MetricRelevance5Forensic Ballistic Tool MarksCMC methodStatistical error rate estimation and forensic analysisLimited: lacking real-time acoustic applicability3Air Gun BulletsEMD, mRMR feature selection, and classificationBallistic examinationsLimited: Reliance on air gun data6Firing Pin ImpressionStatistical and geometric moment featuresCorrelation suggesting redundancyLimited: Focuses on image quality and physical evidence1Firearm Injury EncountersLASSO regression using ICD-10 coding and retrospective dataAUC: 0.92, sensitivity: 0.95, specificity: 0.89Limited: Uses retrospective data for Firearm injury classification Table 1Benchmarking against firearm identification approaches from literature.StudyDomainMethod MetricRelevance5Forensic Ballistic Tool MarksCMC methodStatistical error rate estimation and forensic analysisLimited: lacking real-time acoustic applicability3Air Gun BulletsEMD, mRMR feature selection, and classificationBallistic examinationsLimited: Reliance on air gun data6Firing Pin ImpressionStatistical and geometric moment featuresCorrelation suggesting redundancyLimited: Focuses on image quality and physical evidence1Firearm Injury EncountersLASSO regression using ICD-10 coding and retrospective dataAUC: 0.92, sensitivity: 0.95, specificity: 0.89Limited: Uses retrospective data for Firearm injury classification Benchmarking against firearm identification approaches from literature. Our work addresses the multifaceted challenge of firearm classification, focusing on overcoming key obstacles such as acoustic signature variability, environmental noise interference, and real-time processing demands. By leveraging a novel feature set, MLFCC (Mel-Linear Frequency Cepstral Coefficients), which combines Mel spectrograms, MFCCs, and LFCCs, our system enhances the discriminative power of acoustic features for firearm identification. We emphasize robust data preprocessing to mitigate noise and improve signal quality, ensuring reliable performance in real-world scenarios. Proposed approach Proposed solution consists of an acoustic identification system for small-calibre weapons that uses acoustic fingerprints captured by a microphone and and analyzes them by leveraging an advanced algorithmic deep learning pipeline. This predicts the type of firearm used. The acoustic firearms identification system is based on several key stages, capture, process and analyse the acoustic signal generated by a gunshot, culminating in the inference of the ballistic signature’s classification. The first stage consists of acquiring the acoustic signal using an appropriate capture device. Once the acoustic signal has been processed, the next step is to use an artificial intelligence (AI) model to predict the type of firearm based on the data. (AI) model to predict the type of firearm based on the numerical data extracted from the acoustic signal. The AI model is trained to recognise the acoustic characteristics specific to each type of firearm. By using these characteristics, the model can perform an accurate classification and identify the type of weapon used when the shot was fired. The final stage involves the presentation of the classification output, comprising the inferred class label, its associated confidence estimation, and a set of quantitative performance metrics computed to assess model efficacy. This can be done using a graphical user interface (GUI) that presents the results in a clear and understandable way. The GUI can display the type of weapon detected, possibly with additional information such as Match probability and associated statistics. Theoretical model Spatial feature extraction architectures and sequential memory-based models are fundamental approaches in acoustic signal processing7. The former excels at capturing local and hierarchical patterns from spectral data through multi-layer filtering operations, while the latter models temporal dependencies via recurrent state transitions. A hybrid integration of these paradigms enables advanced acoustic analysis, significantly enhancing the characterization and identification of transient signals, including small-caliber firearm discharges. Spatial feature extraction The architecture employs a multi-stage hierarchical processing pipeline optimized for high-dimensional spectro-temporal data analysis. Each processing stage implements specialized transformations that progressively extract increasingly abstract and discriminative feature representations. The system’s shift-invariant properties emerge from its carefully designed local connectivity patterns and weight sharing mechanisms. The underlying computational architecture employs learnable finite impulse response (FIR) filters arranged in deep filter-bank structures. This design enables localized convolutional operations across the input representation, facilitating the extraction of both spectral and spatial features. By interpreting the spectrogram as a two-dimensional image, the approach leverages principles from advanced machine vision methodologies. Techniques originally developed for industrial visual inspection, which emphasize the joint extraction of global and local features to produce abstract and discriminative representations8, reinforce the relevance of such hierarchical processing pipelines for capturing fine-grained acoustic patterns essential to robust classification. The convolutional filtering process governing these operations can be formally expressed as a discrete two-dimensional convolution, where the output response is obtained through the weighted summation of localized input regions modulated by the filter kernel:1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} {{\textbf {Y}}}[{\varvec{i}}, {\varvec{j}}] = \sum _{\textit{p=0}}^{\textit{F-1}} \sum _{\textit{q=0}}^{\textit{F-1}} {\textbf {X}}[\textit{p}, \textit{q}] \cdot {\textbf {K}}[\textit{i-p, j-q}] \end{aligned}$$\end{document}where: Y is the output feature map, X is the input feature map, and K is the convolution kernel. The size of the output feature map depends on the input size (H inand W in ), the kernel size (F), the padding (P), and stride (S). The activation function is applied element by element to the output of the convolutional layer. A commonly used activation function is the rectified linear unit (ReLU), defined as follows:2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} {{\textbf {ReLU}}}(\textit{x}) = \max (\textit{0, x}) \end{aligned}$$\end{document} Sequential memory-based model Sequential memory-based models incorporate recurrent feedback mechanisms that enable the continuous retention and adaptive updating of contextual information across ordered input sequences. This capability makes them particularly effective for modeling time-dependent data, where temporal dependencies may extend over variable intervals. The transition of internal states across successive time steps is conceptually represented through their underlying recurrent architecture (Fig. 1).Figure 1Recurrent neural network temporal state transition architecture. Recurrent neural network temporal state transition architecture. At each time step t, the activation a(t) and the output y(t) are expressed as follows:3\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} {\textbf {a}}^{\textit{t}} = g_{1}({\textbf {W}}_{\textit{aa}} {\textbf {a}}^{\textit{t-1}} + {\textbf {W}}_{\textit{ax}}x^{\textit{t}}+{\textbf {b}}_{\textit{a}}) \end{aligned}$$\end{document}4\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} {\textbf {y}}^{\textit{t}}=g_{2}({\textbf {W}}_{\textit{ya}} {\textbf {a}}^{\textit{t}}+{\textbf {b}}_{\textit{y}}) \end{aligned}$$\end{document}where the coefficients \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\textbf {W}}_{\textit{ax}}$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\textbf {W}}_{\textit{aa}}$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\textbf {W}}_{\textit{ya}}$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\textbf {b}}_{\textit{a}}$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\textbf {b}}_{\textit{y}}$$\end{document} are shared temporally and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$g_{1}$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$g_{2}$$\end{document} are activation functions. Recurrent Neural Networks have the same input and output architecture as any other deep neural network. However, differences arise in how information flows from input to output. According to9,10, the most effective method for image classification is the use of Convolutional Neural Networks. The CNN model11,12, has demonstrated its efficiency in the classification of audio data by leveraging the spatio-temporal features of acoustic signals. According to this research13, Recurrent Neural Networks (RNNs) are designed to detect patterns in sequences of data, such as images. Unlike traditional neural networks, RNNs can remember past events and use a “memory” to capture computed information up to that point. LSTM (Long Short-Term Memory) is the most commonly used RNN, particularly in linguistic translation and speech processing to extract features from a sequence of data, such as videos. Hybrid architectures for spatiotemporal feature learning Hybrid neural architectures that integrate convolutional and recurrent components-collectively known as Convolutional Recurrent Neural Networks (CRNNs)-offer a robust framework for joint spatial and temporal feature learning. In these architectures, convolutional layers operate as spatial encoders, extracting hierarchical feature representations from input data, while recurrent layers, such as LSTMs or GRUs, model temporal dynamics by capturing dependencies across sequential frames or observations. This architectural (Fig. 2) synergy enables CRNNs to effectively learn complex spatiotemporal correlations, making them highly suitable for tasks such as video sequence analysis, scene understanding, and time-series forecasting. By leveraging convolutional feature hierarchies in conjunction with recurrent state transitions, CRNNs achieve superior representational efficiency and improved generalization in domains characterized by both spatial structure and temporal continuity.Figure 2CRNN hybrid architecture for spatio-temporal feature learning. CRNN hybrid architecture for spatio-temporal feature learning. In a typical Convolutional Recurrent Neural Network architecture, several key components work together to process both spatial and sequential information:The initial layers of the CRNN are convolutional layers, responsible for extracting spatial features from the input data.After the convolutional layers, recurrent layers such as Long Short-Term Memory (LSTM) or Gated Recurrent Unit (GRU) are used. These recurrent layers are responsible for modeling temporal dependencies in the data. They process the sequential output from the convolutional layers and capture contextual information over time. The recurrent layers enable the CRNN to capture the sequential nature of the data and learn long-term dependencies. The initial layers of the CRNN are convolutional layers, responsible for extracting spatial features from the input data. The initial layers of the CRNN are convolutional layers, responsible for extracting spatial features from the input data. After the convolutional layers, recurrent layers such as Long Short-Term Memory (LSTM) or Gated Recurrent Unit (GRU) are used. These recurrent layers are responsible for modeling temporal dependencies in the data. They process the sequential output from the convolutional layers and capture contextual information over time. The recurrent layers enable the CRNN to capture the sequential nature of the data and learn long-term dependencies. After the convolutional layers, recurrent layers such as Long Short-Term Memory (LSTM) or Gated Recurrent Unit (GRU) are used. These recurrent layers are responsible for modeling temporal dependencies in the data. They process the sequential output from the convolutional layers and capture contextual information over time. The recurrent layers enable the CRNN to capture the sequential nature of the data and learn long-term dependencies. Acoustic fingerprint Features used for acoustic pattern recognition, such as Mel Frequency Cepstral Coefficients (MFCC) and the Mel-spectrogram, were initially developed for speech recognition14. However, these features have been extended to different acoustic scenarios, including gunshot detection15. The Mel-spectrogram is a visual representation of frequency changes in a signal over time. For the human ear, frequencies of 600 Hz and 1000 Hz may sound different, but frequencies of 7600 Hz and 8000 Hz may sound similar. Due to the non-linear transformations of the frequency scale, frequencies that seem less distant appear closer together on the Mel scale. In the Mel spectrogram, the y-axis represents the Mel scale, and the x-axis represents time. The Mel spectrogram is calculated by dividing the audio signal into windows of 2048 samples with a 512 sample overlap. Next, a Fast Fourier Transform is applied to each window, and the given audio spectrum is divided into evenly spaced frequencies; 128 Mel-filter banks are taken for this purpose. Finally, for each window, based on the Mel scale frequencies, the magnitude of the audio signal is decomposed into its components (Fig. 3).Figure 3M4 gunshot mel spectrogram. M4 gunshot mel spectrogram. Mel Frequency Cepstral Coefficients (MFCC) help us understand the periodic structures in frequency that provide us with information related to echoes. In MFCC, frequency bands are evenly spaced on the Mel scale, allowing for a better audio representation. MFCC are the coefficients of the Mel Frequency Cepstrum. To obtain a sequence of MFCC, a sampling rate of 44,100 Hz was used, the number of output MFCC features is set to 44, the FFT window length is 2048 samples, the number of samples between successive frames is 512, and a Discrete Cosine Transform (DCT) was employed (Fig. 4 illustrates the M4 Gunshot MFCC Spectrogram).Figure 4M4 gunshot MFCC spectrogram. M4 gunshot MFCC spectrogram. Linear Prediction Coefficients (LPC)11 widely used technique in acoustic pattern recognition is based on the principle of modeling the audio signal using a linear prediction model. They are designed to capture the spectral properties of a signal by approximating the linear relationship between past and future samples of the signal. In the context of gunshot recognition, LPC coefficients can be utilized to extract relevant information about the specific acoustic characteristics of gunshots. By adjusting the parameters of LPC, such as the analysis window length and the number of coefficients, it is possible to obtain a compact yet informative representation of signal features related to gunshots (Fig. 5).Figure 5Linear prediction coefficient spectral modeling of M4 gunshot (12-coefficient configuration). Linear prediction coefficient spectral modeling of M4 gunshot (12-coefficient configuration). The extraction of MFCC coefficients In proposed acoustic identification system, the extraction of MFCC coefficients is carried out following several key steps. First, the audio signal is pre-emphasized to amplify high frequencies and improve signal quality. The signal is then divided into fixed-size frames so that different signal segments can be processed independently. After that, each frame is windowed, usually using a Hamming window, to minimize undesired edge effects. After this, triangular band-pass filters are applied to divide the power spectrum of each frame into specific frequency bands, corresponding to human auditory filters. Once the frequency bands are defined, the Discrete Cosine Transform DCT16 is applied to the power spectrum of each frame. This transformation converts the spectral information into MFCC coefficients, emphasizing frequency variations that are significant for human sound perception.The extraction pipeline is visualized in the Fig. 6.Figure 6Acoustic feature extraction pipeline for MFCCs. Acoustic feature extraction pipeline for MFCCs. The extraction of LFCC coefficients The steps to compute LFCC coefficients are similar to those used to compute MFCCs and the Mel spectrogram. First, the audio signal is divided into short segments. Next, a Fast Fourier Transform (FFT) is applied to each segment to obtain the short-term spectrum. The magnitude spectrum is then filtered using a bank of linear gamma-tone filters, similar to the Mel spectrogram computation. The outputs of the band-pass filters are then processed to obtain a logarithmic energy value. Finally, the LFCC coefficients are computed using a Discrete Cosine Transform (DCT), similar to the computation of MFCCs. The calculation of the coefficients continues following the standard rules of MFCC as follows:5\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} {\textbf {LFCC}}_{\textit{m}} = \sum _{\textit{n=1}}^{\textit{N}} {\textbf {log}}(S_{\textit{n}})\cdot {\textbf {cos}}\left[ \frac{\pi }{\textit{N}}\cdot m(\textit{n-0.5}) \right] \end{aligned}$$\end{document}Where N represents the number of filters used and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$S_{\textit{n}}$$\end{document} denotes the output power of the n-th filter of the filter bank. The signal spectrum was computed using the Fourier transformation. Extracting acoustic features Mel spectrogram, MFCC, and LFCC are effective for extracting acoustic features to form acoustic fingerprints11,14,15). Combining these methods to extract sound characteristics for gunshot identification and classification aims to create a comprehensive acoustic fingerprint encompassing various aspects of gunshot sounds. The Mel spectrogram provides a frequency-based representation, while MFCC and LFCC offer spectral and cepstral insights. By leveraging the strengths of these combined methods, we anticipate a more robust and accurate system for identifying and classifying gunshots.Figure 7MLFCC feature fusion schema (Mel, MFCC, LFCC integration). MLFCC feature fusion schema (Mel, MFCC, LFCC integration). Diagram 7 illustrates the generation of a new acoustic fingerprint by combining the three methods. This enhanced method is named MLFCC (Mel-Linear Frequency Cepstral Coefficients). The MLFCC acoustic fingerprint associates each audio sequence with a three-layered feature fingerprint composed of Mel, MFCC, and LFCC, converting the traditional single-layer acoustic fingerprint into a three-layered fingerprint. Efficiency of the combined MLFCC feature MLFCC, the acoustic fingerprint used in this work, combines Mel Spectrogram, MFCC, and LFCC. Diagram in Fig. 7 illustrates the generation of a acoustic fingerprint by combining the three methods. Each method offers unique advantages: Mel Spectrogram provides a perceptually relevant frequency representation, aligning with human auditory processing. The transformation from frequency \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f$$\end{document} (in Hz) to the Mel scale M is defined as:6\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} {\textbf {M}} = 2595 \cdot {\textbf {log}}_{10}\left( 1 + \frac{f}{700}\right) \end{aligned}$$\end{document}MFCCs, used in speech recognition, capture vocal tract information. Both MFCC and LFCC involve a Discrete Cosine Transform (DCT):7\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} {\textbf {C}}_\textit{n} = \sum _{\textit{k=1}}^{\textit{K}} {\textbf {S}}_\textit{k} {\textbf {cos}}\left( \frac{\pi \textit{n} (\textit{2k - 1})}{\textit{2K}}\right) \end{aligned}$$\end{document}where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\textbf {C}}_\textit{n}$$\end{document} is the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n^{th}$$\end{document} cepstral coefficient, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\textbf {S}}_\textit{k}$$\end{document} is the log power of the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$k^{th}$$\end{document} filter bank output (Mel or Linear), and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$K$$\end{document} is the number of filter banks. MFCCs use a Mel-scaled filter bank, while LFCCs use a linear frequency scale, preserving more detailed spectral information. By combining these complementary representations, MLFCC offers a more comprehensive acoustic fingerprint, enhancing system robustness by mitigating individual feature limitations. For example, if noise or distortion affects the Mel Spectrogram, MFCC and LFCC can still provide discriminative information, leading to improved firearm identification and classification accuracy. Methodology Focusing on gunshot identification and calibre classification using a combined CNN and RNN-LSTM approach, a comprehensive set of audio preprocessing operations was conducted to enhance the quality of the acoustic data. Additionally, real-time audio processing techniques were implemented to facilitate live listening for gunshot analysis. Furthermore, extensive model training was carried out on the CRNN architecture using a carefully curated dataset, ensuring that the model was robustly trained to accurately classify small firearm calibers based on their distinct acoustic profiles. Audio pre-processing and feature extraction duties were made easier by Librosa, designed specifically for audio signal analysis. This allowed us to extract valuable insights from audio datasets. TensorFlow, made it easier to train and implement complex deep learning models, while Keras provide intuitive user interface. PyAudio facilitated real-time audio processing, Torch provided a robust platform for building and training neural networks, and Audiomentations enriched dataset diversity through advanced audio data augmentation techniques. The dataset was thoughtfully curated, containing audio files organized into ten distinct classes. With classes including AK-12, AK-47, IMI Desert Eagle, M4, M16, M249, MG-42, MP5, Zastava M92, and other noises, we were particularly interested in classifying firearm noises. The scope of the data set was expanded by adding the “Other Sounds” class, which included a wide variety of urban sounds outside of categories connected to firearms. To mitigate dataset imbalance and enhance model generalization, an extensive audio data augmentation protocol was applied. Augmentation operations simulated realistic acoustic variability while preserving signal integrity. The adopted transformations included time-shifting, time masking, pitch-shifting, Gaussian noise injection, and spectrogram-domain masking. Time-shifting displaced the waveform along the temporal axis to improve invariance to alignment variations. Time masking muted short temporal segments, promoting robustness to missing data. Pitch-shifting modified spectral pitch while maintaining temporal consistency, reproducing natural frequency variations. Gaussian noise injection introduced stochastic perturbations, improving resilience to environmental noise. Spectrogram-based time and frequency masking enhanced feature invariance across temporal and spectral domains. Pitch-shifting was randomized within ±4 semitones to emulate variations in resonance characteristics. Time-shifting adjusted playback rate between 0.8\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\times$$\end{document} and 1.25\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\times$$\end{document} of the original duration. Gaussian noise was applied with amplitudes from 0.001 to 0.03 and SNR values between 5.0 and 40.0 dB. These operations collectively increased class diversity and mitigated bias toward dominant categories. Figure 8 illustrates a time-domain waveform post-Gaussian Noise Data Augmentation. The final augmented dataset comprised twelve feature-level fingerprints per original recording, derived from four Mel, four MFCC, and four LFCC representations, resulting in 47,592 augmented acoustic fingerprints from 3,966 initial audio samples. The resulting Balanced Dataset Class Distribution (Fig. 9).Figure 8Time-domain waveform post-Gaussian noise data augmentation.Figure 9Balanced dataset class distribution following data augmentation. Time-domain waveform post-Gaussian noise data augmentation. Balanced dataset class distribution following data augmentation. Data processing Raw firearm audio signals were resampled to 44.1 kHz, converted to mono, amplitude-normalized, and pre-emphasized to enhance high-frequency transients. The processed signals were segmented using a Short-Time Fourier Transform with 25 ms frames and 10 ms overlap to obtain time–frequency representations. From these, Mel Spectrograms, MFCCs, and LFCCs were extracted to capture complementary perceptual and spectral characteristics. All features were standardized and structured into multi-representational tensors. Data loading Audio recordings were ingested and managed using the Python libraries Librosa and PySoundFile, which support multiple formats, including WAV and MP3. Librosa was employed for waveform reading, resampling, and conversion to mono channels, while PySoundFile provided precise low-level access for frame-accurate decoding and metadata retrieval. All recordings were standardized to a uniform sampling rate of 44.1 kHz to maintain temporal consistency across the dataset. The audio signals were stored as one-dimensional time-series arrays representing amplitude variations over time, preserving transient and high-frequency content critical for firearm acoustic analysis. This representation is illustrated for an AK-47 signal in Fig. 10. To optimize memory usage and enable efficient training, audio data were loaded in buffered batches, allowing on-the-fly preprocessing without exceeding system memory constraints. Each waveform was checked for clipping or silence, and normalization routines were applied to maintain consistent amplitude ranges across recordings. This standardized and memory-efficient representation facilitated subsequent segmentation, windowing, spectral transformations, and augmentation pipelines. The resulting data format ensured seamless compatibility with convolutional and recurrent network architectures, supporting high-throughput training and robust feature learning.Figure 10Time-series amplitude representation of AK-47 firearm signal. Time-series amplitude representation of AK-47 firearm signal. Through the course of this project, we came to realize that the greatest importance for audio data lies in the sampling frequency. It indicates how many samples or data points are recorded in the audio file per second and is determined in Hertz (Hz). The higher the sampling frequency the finer the temporal resolution which lets you capture even higher details within an audio signal. Once the audio files were loaded, it was necessary to apply preprocessing techniques to ensure consistency and enhance data quality. Preprocessing operations include: Resampling Acoustic sequences exhibit variability in their sampling frequencies, posing challenges for consistent analysis and interoperability across subsequent stages of the processing pipeline. To address this, standardization of the sampling frequency is implemented as a necessary preprocessing step to ensure methodological coherence and compatibility. Within this context, resampling adjusts the temporal resolution of acoustic signals, thereby enabling uniformity and facilitating integration throughout the analytical framework. The algorithmic basis of resampling involves either interpolation or decimation, depending on whether the target sampling frequency is higher or lower than that of the original signal. Interpolation entails the generation of additional data points between existing samples, thereby increasing the sampling rate, while decimation involves the systematic removal of samples to achieve a lower sampling rate. This resampling procedure is essential for producing temporally consistent acoustic representations, which in turn ensures the reliability and comparability of features extracted for subsequent deep learning-based analyses. Suppose we have an original audio signal with a sampling frequency of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textit{f}_\textit{s}$$\end{document} (in Hz) and a total duration of T (in seconds). To resample the signal to a new sampling frequency \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textit{f}_\textit{s}'$$\end{document}, we can use the following formula: New number of samples8\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} {\textbf {N}}' = \left\lfloor N \times \frac{\textit{f}_\textit{s}'}{\textit{f}_\textit{s}} \right\rfloor \end{aligned}$$\end{document}where N is the original number of samples,\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textit{f}_\textit{s}'$$\end{document} is the new sampling frequency, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textit{f}_\textit{s}$$\end{document} is the original sampling frequency5. In this study, all audio recordings were resampled to a standardized sampling rate of 44.1 kHz to ensure consistency in temporal and frequency resolution across the dataset. The resampling procedure was implemented using the resample and resamplepoly functions from the SciPy and NumPy signal processing libraries, which apply polyphase filtering to mitigate aliasing artifacts and preserve signal integrity. Prior to decimation or interpolation, an anti-aliasing finite impulse response (FIR) low-pass filter was applied to suppress frequency components above the Nyquist threshold of the target sampling rate. This preprocessing step was essential for harmonizing the dataset and ensuring the reliability of subsequent time-frequency analyses and feature extraction procedures employed in the deep learning pipeline.. Converting stereo channels to mono We converted all audio files to mono format to match the single-channel input of our audio sensor. Converting stereo audio files to mono involves combining the left and right channels into a single channel17. This results in a mono representation of the audio signal, where all audio information is present in a single audio stream. Converting stereo channels to mono can be done using a simple formula:9\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \text {Mono} = \frac{{Left Channel} + {Right Channel}}{2} \end{aligned}$$\end{document}This formula takes each sample from the left channel, adds it to the corresponding sample from the right channel, and then divides the result by two to get the mono sample. Converting audio files to mono ensures compatibility with our single-channel sensor, enabling seamless signal processing and analysis (Fig. 11).Figure 11Channel downmixing: stereo-to-mono conversion for single-channel sensor compatibility. Channel downmixing: stereo-to-mono conversion for single-channel sensor compatibility. Normalization Normalization adjusts audio signal amplitudes to a target range, standardizing volume levels for consistent processing. We normalized audio amplitudes across all classes to ensure consistent sound levels, improving dataset quality for reliable processing and analysis. The normalization process first identifies each file’s maximum absolute amplitude (\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\textbf {A}}_{\text {max}}$$\end{document}). The first step of normalization is to find the maximum absolute amplitude:10\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} {\textbf {A}}_{{max}} = {max}(| \textit{x}[\textit{n}] |) \end{aligned}$$\end{document}Then, we can normalize each sample \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\textbf {x}}_{{norm}}[\textit{n}]$$\end{document} by dividing it by the maximum absolute amplitude:11\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} {\textbf {x}}_{{norm}}[\textit{n}] = \frac{{\textbf {A}}_{{max}}}{x[\textit{n}]} \end{aligned}$$\end{document} Noise reduction Audio recordings frequently contain disruptive artifacts (background noise, clicks, pops) that compromise analysis accuracy. To address this, we processed our dataset using Audacity’s dual noise reduction capabilities:The Nyquist noise reduction algorithm used by Audacity is based on the following formula: 12\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} {\textbf {y}}(\textit{t}) = {\textbf {x}}(\textit{t}) - g \cdot {\textbf {n}}(\textit{t}) \end{aligned}$$\end{document} where:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$y(t)$$\end{document} represents the output signal after noise reduction.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$x(t)$$\end{document} is the input audio signal.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n(t)$$\end{document} is the estimated noise from the audio signal.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$g$$\end{document} is the noise reduction factor that controls the extent of noise attenuation.We employ an adaptive filter to estimate and suppress unwanted noise in audio signals6. The Least Mean Squares (LMS) algorithm serves as our primary adaptation method, with its filter coefficients updated according to the following equation: 13\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \varvec{\omega }(\textit{n+1}) = \varvec{\omega }(\textit{n}) + \mu \cdot {\textbf {e}}(\textit{n}) \cdot {\textbf {x}}(\textit{n}) \end{aligned}$$\end{document} where:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\omega (\textit{n})$$\end{document} is the current weight vector at time n.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mu$$\end{document} is the learning rate coefficient that controls the convergence speed of the filter.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$e(\textit{n})$$\end{document} is the error, computed by subtracting the filter output from the desired value.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$x(\textit{n})$$\end{document} is the filter input vector at time n. The Nyquist noise reduction algorithm used by Audacity is based on the following formula: 12\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} {\textbf {y}}(\textit{t}) = {\textbf {x}}(\textit{t}) - g \cdot {\textbf {n}}(\textit{t}) \end{aligned}$$\end{document} where:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$y(t)$$\end{document} represents the output signal after noise reduction.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$x(t)$$\end{document} is the input audio signal.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n(t)$$\end{document} is the estimated noise from the audio signal.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$g$$\end{document} is the noise reduction factor that controls the extent of noise attenuation. The Nyquist noise reduction algorithm used by Audacity is based on the following formula: 12\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} {\textbf {y}}(\textit{t}) = {\textbf {x}}(\textit{t}) - g \cdot {\textbf {n}}(\textit{t}) \end{aligned}$$\end{document} where:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$y(t)$$\end{document} represents the output signal after noise reduction.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$x(t)$$\end{document} is the input audio signal.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n(t)$$\end{document} is the estimated noise from the audio signal.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$g$$\end{document} is the noise reduction factor that controls the extent of noise attenuation. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$y(t)$$\end{document} represents the output signal after noise reduction. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$y(t)$$\end{document} represents the output signal after noise reduction. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$x(t)$$\end{document} is the input audio signal. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$x(t)$$\end{document} is the input audio signal. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n(t)$$\end{document} is the estimated noise from the audio signal. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n(t)$$\end{document} is the estimated noise from the audio signal. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$g$$\end{document} is the noise reduction factor that controls the extent of noise attenuation. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$g$$\end{document} is the noise reduction factor that controls the extent of noise attenuation. We employ an adaptive filter to estimate and suppress unwanted noise in audio signals6. The Least Mean Squares (LMS) algorithm serves as our primary adaptation method, with its filter coefficients updated according to the following equation: 13\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \varvec{\omega }(\textit{n+1}) = \varvec{\omega }(\textit{n}) + \mu \cdot {\textbf {e}}(\textit{n}) \cdot {\textbf {x}}(\textit{n}) \end{aligned}$$\end{document} where:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\omega (\textit{n})$$\end{document} is the current weight vector at time n.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mu$$\end{document} is the learning rate coefficient that controls the convergence speed of the filter.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$e(\textit{n})$$\end{document} is the error, computed by subtracting the filter output from the desired value.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$x(\textit{n})$$\end{document} is the filter input vector at time n. We employ an adaptive filter to estimate and suppress unwanted noise in audio signals6. The Least Mean Squares (LMS) algorithm serves as our primary adaptation method, with its filter coefficients updated according to the following equation: 13\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \varvec{\omega }(\textit{n+1}) = \varvec{\omega }(\textit{n}) + \mu \cdot {\textbf {e}}(\textit{n}) \cdot {\textbf {x}}(\textit{n}) \end{aligned}$$\end{document} where:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\omega (\textit{n})$$\end{document} is the current weight vector at time n.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mu$$\end{document} is the learning rate coefficient that controls the convergence speed of the filter.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$e(\textit{n})$$\end{document} is the error, computed by subtracting the filter output from the desired value.\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$x(\textit{n})$$\end{document} is the filter input vector at time n. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\omega (\textit{n})$$\end{document} is the current weight vector at time n. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\omega (\textit{n})$$\end{document} is the current weight vector at time n. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mu$$\end{document} is the learning rate coefficient that controls the convergence speed of the filter. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mu$$\end{document} is the learning rate coefficient that controls the convergence speed of the filter. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$e(\textit{n})$$\end{document} is the error, computed by subtracting the filter output from the desired value. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$e(\textit{n})$$\end{document} is the error, computed by subtracting the filter output from the desired value. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$x(\textit{n})$$\end{document} is the filter input vector at time n. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$x(\textit{n})$$\end{document} is the filter input vector at time n. Short-time fourier transform (STFT) Once the audio is processed, a Short-Time Fourier Transform (STFT) is applied to each frame to obtain the frequency spectrum. The Short-Time Fourier Transform (STFT) serves as a core analytical tool in audio processing, enabling time-frequency representation of sound signals. By decomposing the signal into localized frequency components, STFT reveals spectral evolution over time. The transform is mathematically expressed as:14\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} {\textbf {X}}_{{STFT}}[\textit{k, n}] = \frac{1}{N} \sum _{\textit{m=0}}^{\textit{N-1}} {\textbf {x}}[\textit{m + nH}] \cdot {\textbf {w}}[\textit{m}] \cdot W^{km} \end{aligned}$$\end{document}An STFT is the Fourier transform of a signal x[m], multiplied by a windowing function w[m]. In this definition, N of the windowing length, n is the temporal frame index, and k refers to the frequency index. H stands in for the hop length, which determines the overlap of adjacent frames as N-H. The overlap ratio between frames is (N-H)/N. For example, consider an STFT, which corresponds to the Fourier transform of a signal x[m], multiplied by a windowing function w[m]. In this definition, N of the windowing length, n representing the temporal frame index, and k referring to the frequency index. H stands in for the hop length, which determines their overlap as N-H. Acoustic fingerprint extraction The feature set, named MLFCC (Mel-Linear Frequency Cepstral Coefficients), combines three distinct acoustic features to enhance the system’s discriminative power. The following parameters define the reproducible feature extraction process (Table 2).Table 2Acoustic feature extraction parameters for MLFCC generation.Feature parameterValueInput feature setMLFCCSampling rate (sr)44.1 kHzFFT points (n_fft)4096Window length4096 samplesHop length512 samplesMel filter count (N_MEL)128MFCC coefficients (N_MFCC)18LFCC coefficients (N_LFCC)13 Table 2Acoustic feature extraction parameters for MLFCC generation.Feature parameterValueInput feature setMLFCCSampling rate (sr)44.1 kHzFFT points (n_fft)4096Window length4096 samplesHop length512 samplesMel filter count (N_MEL)128MFCC coefficients (N_MFCC)18LFCC coefficients (N_LFCC)13 Acoustic feature extraction parameters for MLFCC generation. Following the completion of the audio preprocessing pipeline, which included adaptive resampling to 44.1 kHz and noise mitigation, we systematically initiated the extraction of acoustic features from all class-specific audio sequences . This process utilized the composite feature set known as MLFCC (Mel-Linear Frequency Cepstral Coefficients), strategically integrating Mel spectrograms, MFCCs, and LFCCs to generate a robust, three-layered acoustic fingerprint that enhances feature discriminability. The distributions of these derived features are subsequently formalized and presented in the following figures, commencing with the visualization of the Mel-type acoustic fingerprint in Fig. 12, continuing with the MFCC distribution in Fig. 13. The acoustic features are systematically extracted from each audio file in our dataset, with every file represented by three distinct features. These features are organized into structured matrices, where the first column identifies the class label of the corresponding audio file, and the remaining three columns encode the extracted acoustic features. This matrix-based representation ensures data consistency, preserves the relationship between features and their respective classes, and provides a standardized format optimized for efficient model ingestion. Figure 14 shows the Feature Matrix Visualization for the LFCC Distribution (10 Classes). By structuring the data in this manner, we facilitate seamless integration with our learning framework while maintaining traceability and scalability across the dataset.Figure 12Feature matrix visualization: mel spectrogram distribution (10 classes).Figure 13Feature matrix visualization: MFCC distribution (10 classes).Figure 14Feature matrix visualization: LFCC distribution (10 classes). Feature matrix visualization: mel spectrogram distribution (10 classes). Feature matrix visualization: MFCC distribution (10 classes). Feature matrix visualization: LFCC distribution (10 classes). Model training The training process validates the hybrid Convolutional Recurrent Neural Network (CRNN) model for acoustic classification, leveraging the specific MLFCC (Mel-Linear Frequency Cepstral Coefficients) feature set. This architecture utilizes Conv2D layers for automated spectral-temporal feature extraction from spectrograms, coupled with LSTM recurrent layers to model sequential dependencies in the audio sequence. Model robustness was achieved through intensive data augmentation, including techniques such as time-shifting and pitch-shifting, designed to address dataset imbalance. Optimization relied on the efficient Adamax optimizer. The exact, reproducible structure-detailing the stack of Conv2D layers, regularization via Dropout (0.25), and concluding LSTM layers-is formalized within the Optimized CRNN Architecture Configuration Table 3.Table 3Optimized CRNN architecture configuration.Layer typeFiltersKernelPoolingDropoutActv FctConv2D (1)32(3, 3)ReLUMxPooling2D(2, 2)Dropout0.25Conv2D (2)64(3, 3)ReLUConv2D (3)128(3, 3)ReLUDropout0.25LSTM(1)128LSTM(2)64Dense (Outp)Nb ClsSoftmaxAcoustic Features – Entry point for the MLFCC features.Reshape – Converts input into a 3D tensor suitable for Conv2D layers.Conv2D(1) – Extracts local spatial features and patterns.Conv2D(2) – Extracts deeper spatial features.Conv2D(3) – Extracts complex spatial characteristics. LSTM(1)–Captures longterm temporal dependencies (return-sequences=True).LSTM(2) – Final temporal modeling layer. Table 3Optimized CRNN architecture configuration.Layer typeFiltersKernelPoolingDropoutActv FctConv2D (1)32(3, 3)ReLUMxPooling2D(2, 2)Dropout0.25Conv2D (2)64(3, 3)ReLUConv2D (3)128(3, 3)ReLUDropout0.25LSTM(1)128LSTM(2)64Dense (Outp)Nb ClsSoftmaxAcoustic Features – Entry point for the MLFCC features.Reshape – Converts input into a 3D tensor suitable for Conv2D layers.Conv2D(1) – Extracts local spatial features and patterns.Conv2D(2) – Extracts deeper spatial features.Conv2D(3) – Extracts complex spatial characteristics. LSTM(1)–Captures longterm temporal dependencies (return-sequences=True).LSTM(2) – Final temporal modeling layer. Optimized CRNN architecture configuration. Acoustic Features – Entry point for the MLFCC features. Reshape – Converts input into a 3D tensor suitable for Conv2D layers. Conv2D(1) – Extracts local spatial features and patterns. Conv2D(2) – Extracts deeper spatial features. Conv2D(3) – Extracts complex spatial characteristics. LSTM(1)–Captures longterm temporal dependencies (return-sequences=True). LSTM(2) – Final temporal modeling layer. We implemented a CRNN model for acoustic classification, aiming to achieve accurate and efficient recognition of distinct sound classes. The CRNN architecture integrates convolutional layers for automatic spectrogram feature extraction with recurrent layers to model temporal dependencies in audio sequences, enabling comprehensive acoustic signal analysis. This hybrid architecture synergistically combines the spatial feature extraction capabilities of CNNs with the sequential modeling strengths of RNNs, enabling comprehensive audio pattern recognition. Hyperparameters The hyperparameters were empirically optimized (Table 4) through iterative testing, specifically balancing high performance with the limited computational resources of the Raspberry Pi 4 (quad-core ARM Cortex-A72 clocked at 1.5 GHz, and 8 GB LPDDR4).Table 4Core training hyperparameters.ParameterValueModel architectureCRNN (CNN + LSTM)Epochs30Batch Size64Learning Rate0.001OptimizerAdamaxLoss Functioncategorical_crossentropyData Split75% Training / 25% Testing Table 4Core training hyperparameters.ParameterValueModel architectureCRNN (CNN + LSTM)Epochs30Batch Size64Learning Rate0.001OptimizerAdamaxLoss Functioncategorical_crossentropyData Split75% Training / 25% Testing Core training hyperparameters. The following callbacks were implemented to manage the training process, control the learning rate, and prevent overfitting (Table 5).Table 5Model optimization callbacks.Callback functionParameterValueEarlyStoppingPatience5EarlyStoppingVerbose1ReduceLROnPlateauPatience2ReduceLROnPlateauFactor0.1ReduceLROnPlateauVerbose1 Table 5Model optimization callbacks.Callback functionParameterValueEarlyStoppingPatience5EarlyStoppingVerbose1ReduceLROnPlateauPatience2ReduceLROnPlateauFactor0.1ReduceLROnPlateauVerbose1 Model optimization callbacks. For CRNN-based acoustic classification system, we fine-tuned multiple hyperparameters to maximize model performance. All parameter configurations were managed through a dedicated ‘.cfg’ configuration file, enabling efficient experimentation and reproducibility (Fig. 15).Figure 15Dedicated .cfg file for CRNN hyperparameter management. Dedicated .cfg file for CRNN hyperparameter management. We optimized the model architecture by tuning the convolution window size and layer depth, balancing performance with computational constraints. This ensured sufficient complexity for acoustic feature extraction while maintaining efficient resource utilization. We optimized training dynamics through careful learning rate selection to balance convergence speed and stability. The model incorporated L1/L2 regularization to enhance generalization capability while preserving computational efficiency. Note: All hyperparameters were empirically optimized through iterative testing, balancing performance outcomes with our system’s computational constraints. Results, analysis and discussion Results and analysis Results of the CRNNs model (model file) After training and testing the CRNNs model, we obtained improved numerical results, achieving an average accuracy of 94% and a total loss of 0.162, reflecting more efficient convergence of the cross-entropy objective and enhanced generalization during validation. Figure 16 illustrates the overall performance metrics and learning trajectory of the CRNN Model. The standard CNN baseline model exhibited improved performance compared to the baseline RNN architectures (which achieved only 37% accuracy and a total loss of 1.184). The integration of convolutional layers enabled more effective extraction of local spectral features from the acoustic representations, while the recurrent units captured temporal dependencies across successive frames. This hybrid configuration contributed to a reduction in misclassification rates and a more consistent decision boundary across classes. In comparison, the CNN model reached an average accuracy of 84% with a loss of 0.356, indicating that the addition of recurrent dynamics significantly improved temporal modeling and overall classification stability.Figure 16CRNN model performance. CRNN model performance. Analyzing the confusion matrix in Fig. 17, which provides granular detail on classification outcomes per class, indicates that the CRNNs model achieved high results, with an average macro precision/F1 score of 89%. This metric, calculated without weighting for class frequency, reflects strong performance despite some inter-class confusion (such as between M4 and M16) as detailed in the matrix. AK-12 class was correctly predicted in 389 cases, with only 1 case of prediction error. AK-47 class was correctly predicted in 250 cases.Figure 17Classification performance matrix of the CRNN model, indicating inter-class confusion. Classification performance matrix of the CRNN model, indicating inter-class confusion. Results of the CRNNs model test during live listening Implemented on a Raspberry Pi with INMP441 microphone, our CRNN-based system provides continuous sound monitoring. It triggers 2-second recordings upon abnormal sound detection, then executes real-time classification with the embedded model to identify sound sources accurately.Figure 18Real-time embedded CRNN model discrimination of non-firearm acoustics. Real-time embedded CRNN model discrimination of non-firearm acoustics. Note: The 2-second sampling duration was selected to ensure compatibility with our training dataset format.This segment duration is optimized for real-time operation. Implementation on embedded hardware confirmed that the processing is highly efficient, resulting in an average inference latency of 187ms per 2-second audio segment . This short latency validates the 2-second sampling duration as an effective balance between capturing sufficient temporal data (sequential characteristics of gunshot sounds) and maintaining the rapid response required for public safety applications Figure 18 shows the prediction results of our CRNNs model for two different sounds. Figure 18a shows a prediction of 99.08% that the sound belongs to the “Other sound” class when listening to speech. On the other hand, Fig. 18b shows a prediction of 84.03% that the sound belongs to the “Other sound” class when listening to music. These results demonstrate the ability of our CRNNs model to accurately classify sounds according to their content, distinguishing unnecessary sounds from those related to small arms.Figure 19CRNN live test results (M16 and AK-47). CRNN live test results (M16 and AK-47). The result shown in Fig. 19a reveals a prediction of 48.01% for the “M4” class when listening to the sound emitted by an M16, and a prediction of 41.22% for the “M16” class. These percentages indicate the probabilities estimated by the model of the sound belonging to each respective class. Figure 19b shows a 91.58% prediction that the sound belongs to the “AK-47” class when listening to the AK-47 sound, and a 5.93% prediction that the sound belongs to the “Other” class. The result in Fig. 19a clearly shows confusion between the M4 and M16 weapons, as suggested by the confusion matrix. This confusion is attributed to their similarity as variants of the AR-15 weapon. In fact, these two weapons share similar sound characteristics, making it more difficult for the CRNNs model to distinguish between them. Quantitative analysis of weapon classification improvements Analysis of previous results identified classification challenges between specific weapon types. To address this, we enhanced our model by expanding the training dataset - increasing the quantity of acoustic fingerprint images generated per audio sequence during feature extraction. The aim of this enhancement is to apply image filters to the three acoustic fingerprints, such as spectrographic masks and other filters. These filters improve the quality and accuracy of the data used for model training. By using advanced filtering techniques, we aim to reduce confusion and enhance the model’s ability to correctly distinguish between different weapon types. This update therefore aims to improve the overall performance of our weapon identification system by enriching training data with filtered acoustic fingerprints. We are confident that this enhancement will deliver more accurate and reliable results in weapon type recognition. Following data augmentation and hyperparameter optimization, the refined CRNN model achieved a classification accuracy of 96.3% and a loss equal to 0.103 (Fig. 20).Figure 20Optimized CRNN + MLFCC performance. Optimized CRNN + MLFCC performance. The new confusion matrix reveals a significant improvement in the distinction between different types of weapon, including M4 and M16.Figure 21Enhanced classification performance matrix of the optimized CRNN + MLFCC model. Enhanced classification performance matrix of the optimized CRNN + MLFCC model. The number of acoustic fingerprints used for model training became 47,592, from 3,966 audio files. We extracted 12 fingerprints for each file, comprising 4 Mel, 4 MFCC and 4 LFCC fingerprints. Benchmarking Performance: acoustic feature fusion and CRNN architecture This work details a specialized framework for firearm classification, leveraging a Convolutional Recurrent Neural Network (CRNN) architecture combined with the consolidated MLFCC (Mel-Linear Frequency Cepstral Coefficients) feature set to enhance feature discriminability (Fig. 21). This system achieved a classification accuracy of 96.3% with a cross-entropy loss of 0.103 on the optimized test dataset, representing an observable improvement when benchmarked against internal models, such as the initial CRNN (94% accuracy) and the standard CNN (84% accuracy). The improved performance can be attributed to the MLFCC feature set, which integrates Mel spectrogram, MFCC, and LFCC to capture complementary spectral and cepstral information across different frequency scales, enhancing the model’s capacity to distinguish subtle acoustic variations in firearm discharges. The CRNN architecture further contributes by combining convolutional layers for local spectral-temporal feature extraction with recurrent layers that model long-term temporal dependencies, enabling the learning of detailed and structured spatiotemporal representations. Nonetheless, the model has difficulty separating certain firearm classes with highly similar acoustic profiles, such as the M4 and M16 rifles, due to their nearly identical firing characteristics. Moreover, external factors such as ambient noise, reverberation, and variations in source-to-microphone positioning can alter the acoustic signature, limiting system robustness and highlighting the need for advanced signal enhancement, feature normalization, and augmented training data to support deployment in real-world conditions. To address current limitations and enhance system performance, several strategic improvements merit investigation. First, expanding the training set to incorporate greater diversity of firearms, recording conditions, and environmental scenarios would strengthen the model’s generalization and robustness to real-world variability. Second, exploring advanced signal processing techniques-such as adaptive noise cancellation and blind source separation-could improve performance in noisy or complex acoustic environments by isolating target signals more effectively. Finally, integrating this technology with complementary sensors may enable a multimodal system that improves detection accuracy and situational awareness through sensor fusion18. Benchmark results establish the technical merit of combining acoustic feature extraction with CRNN models for precise firearm classification. Our system achieves high accuracy and robust real-time performance, validating its practical potential. While acknowledging current limitations and ethical considerations, this work provides a foundation for advancing acoustic-based firearm detection technology-a critical step toward enhancing public safety and security. Future refinements in dataset diversity, signal processing, and multimodal integration could further elevate the system’s reliability in real-world scenarios. Conclusion The research presented here established a specialized framework for small-caliber firearm classification, leveraging a novel feature extraction approach, MLFCC (Mel-Linear Frequency Cepstral Coefficients), which integrates Mel spectrograms, MFCCs, and LFCCs to enhance feature discriminability in the cepstral domain. The core architecture employed is a Convolutional Recurrent Neural Network (CRNN), designed to simultaneously capture localized spectro-temporal patterns through convolutional operations and model long-range temporal dependencies via recurrent layers. Experimental results demonstrated the efficacy of the optimized system, which achieved a classification accuracy of 96.3% with a cross-entropy loss of 0.103 on the test dataset. The system’s robustness was supported by comprehensive preprocessing stages, including spectral subtraction for noise reduction, dynamic range compression, and adaptive resampling to 44.1 kHz. Data augmentation techniques, such as time-domain warping and additive Gaussian noise, were additionally employed to improve model robustness against environmental variability. Crucially, implementation on embedded hardware confirmed the feasibility of real-time operation, exhibiting an average inference latency of 187ms per 2-second audio segment. While the model exhibited particular efficacy in distinguishing firearm classes with distinct acoustic signatures , it encountered specific challenges that must be explicitly acknowledged. Performance degradation was observed when classifying weapons sharing common mechanical platforms, notably the M4 and M16 rifles. This limitation primarily stems from the inherent spectral similarity in their muzzle blast waveforms and the overlapping characteristics of their shockwave propagation patterns. Furthermore, operational applicability is challenged by the system’s sensitivity to extreme environmental conditions, where external factors like ambient noise, reverberation, and variations in source-to-microphone positioning can alter the acoustic signature, limiting overall robustness. Technically, the current feature extraction pipeline does not fully account for nonlinear propagation effects in outdoor environments, and the temporal resolution of the STFT-based features may be insufficient to accurately capture transient ballistic signatures in certain scenarios. Future work is required to mitigate these constraints. Subsequent investigations should explore wavelet-based time-frequency representations and consider incorporating physical models of muzzle blast formation to enhance feature discriminability . Moreover, research directions include the development of multi-sensor fusion architectures and the investigation of attention mechanisms to improve classification performance, particularly on the acoustically similar firearm classes. This work contributes significantly to the ongoing development of robust acoustic classification systems for security applications, although further validation under different operational conditions is explicitly required to confirm reliability in uncontrolled settings.