Snore detection method and apparatus
Through the analysis method based on spectrum signals, the calculation amount of snoring detection is simplified, the recognition accuracy is improved, the problems of large calculation amount and low frequency resolution of deep learning algorithms in the existing technology are solved, and efficient identification of snoring is achieved.
Patent Information
- Application Number
- PCT/CN2024/087424
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-14
- Filing Date
- 2024-04-12
- Publication Date
- 2024-10-17
AI Technical Summary
Existing snoring detection methods rely on deep learning algorithms, which are computationally intensive and complex. Insufficient sampling points during Fourier transform lead to large errors in spectrum peak positions, low frequency resolution, and the inability to accurately identify the frequency and amplitude of adjacent spectrums.
Using an analysis method based on spectrum signals, by obtaining the frequency band loudness mean ratio of the audio signal, perform spectrum transformation and frequency band division, obtain the frequency-loudness peak trajectory, determine whether the number of maximum values and their distribution windows comply with the snoring classification rules, and conduct Peak correction to identify snoring.
It simplifies the calculation amount, improves the accuracy and efficiency of snoring recognition, can effectively suppress the influence of low-frequency noise, and provides more accurate recognition results.
Smart Images

Figure CN2024087424_17102024_PF_FP_ABST
Abstract
Description
Snoring detection method and device Technical Field
[0001] The present application relates to the technical field of snoring detection, and in particular to a snoring detection method and device. Background Art
[0002] Obstructive sleep apnea-hypopnea syndrome (OSAHS) is a common condition that is often overlooked. It is primarily caused by sleep apnea, hypoventilation, or no ventilation, which can cause daytime sleepiness and recurring apnea episodes. The most notable symptom is snoring during sleep, so snoring recognition can effectively detect possible OSAHS.
[0003] The existing technology generally uses deep learning algorithms to identify snoring. Comparative document 1, "A snoring monitoring method and system based on deep learning algorithm and a corresponding electric bed control method and system" (application number 202110803746.6), discloses the use of a pre-trained deep learning model for deep feature extraction and classification to classify each audio segment into an audio slice containing snoring and an audio slice that does not contain snoring. The existing deep learning method is complex to process and has a large amount of calculation. There is also a technology for detecting audio signals through Fourier transform, such as Comparative Document 2, application number 201510586206.1, which discloses a high-resolution audio frequency measurement method based on FFT. When using the measurement method of Comparative Document 2, if the number of sampling points is not enough when performing Fourier transform, the calculated spectrum peak will be located exactly in the middle of two sampling points, which will cause the result obtained by fast Fourier transform to have a large deviation from the actual value. When the frequency resolution of the spectrum obtained by traditional Fourier transform is low, the frequency and amplitude recognition of adjacent spectra is not accurate enough.
[0004] Summary of the Invention
[0005] In order to solve the above technical problems, the present invention provides a snoring detection method and device, which are based on spectrum signal analysis and have less computational complexity than deep learning methods and are easy to implement.
[0006] The present invention adopts the following technical solutions:
[0007] In a first aspect, a snoring detection method includes:
[0008] Obtaining the audio signal to be detected;
[0009] Divide the audio signal into two frequency bands; obtain the average frequency band loudness of the two frequency bands respectively, and calculate the ratio of the average frequency band loudness of the two frequency bands;
[0010] If the ratio is greater than a set threshold, performing spectrum transformation on the audio signal to obtain a spectrum signal, and dividing the frequency band into a window with a preset frequency value; taking an average value of each divided window to obtain a frequency-loudness peak trajectory;
[0011] Obtain the number of maximum values and the distribution window to which the maximum values belong based on the frequency-loudness peak trajectory;
[0012] It is determined whether the number of maximum values and the distribution window to which the maximum values belong conform to the snoring classification rule. If so, it is identified that the audio signal includes snoring.
[0013] Preferably, determining whether the number of maximum values and the distribution window to which the maximum values belong conform to the snoring classification rule, and if so, identifying that the audio signal includes snoring, specifically includes:
[0014] If the number of maximum values is 1, determining whether the distribution window to which the maximum value belongs is located in the low-frequency part, and if so, recognizing that the audio signal includes snoring; the frequency of the low-frequency part is less than the first frequency value;
[0015] If the number of maxima is 2, determining the distribution window to which the maxima belong, determining whether one of the maxima is located in the low-frequency part and whether the other maxima is located in the intermediate-frequency part or the high-frequency part, and if so, identifying that the audio signal includes snoring; the frequency of the intermediate-frequency part is between the first frequency value and the second frequency value, and the frequency of the high-frequency part is greater than the second frequency value;
[0016] If the number of maximum values is 3, it is determined whether the distribution windows to which the maximum values belong are located in the low frequency part, the middle frequency part and the high frequency part respectively. If so, it is recognized that the audio signal includes snoring.
[0017] Preferably, after obtaining the number of maximum values and the distribution window to which the maximum values belong based on the frequency-loudness peak trajectory, peak correction is further performed when the number of maximum values is equal to 2, specifically including:
[0018] If the first maximum value is located in the first frequency band and the frequency band loudness ratio between the first frequency band and the adjacent second frequency band is between [0.75, 1.25], the distribution window to which the first maximum value belongs is corrected to the second frequency band; wherein the frequency of the second frequency band is greater than the frequency of the first frequency band.
[0019] Preferably, after obtaining the number of maximum values and the distribution window to which the maximum values belong based on the frequency-loudness peak trajectory, peak correction is further performed when the number of maximum values is equal to 2, specifically including:
[0020] If the first maximum value is located in the third frequency band and the frequency band loudness ratio between the third frequency band and the adjacent second frequency band is between [0.75, 1.25], the distribution window to which the third maximum value belongs is corrected to the second frequency band; wherein the frequency of the third frequency band is greater than the frequency of the second frequency band.
[0021] Preferably, dividing the audio signal into two frequency bands of equal frequency specifically includes:
[0022] Perform short-time Fourier transform on the audio signal and divide the transformed frequency band into two frequency bands of equal frequency.
[0023] Preferably, if the ratio is greater than a set threshold, performing spectrum transformation on the audio signal to obtain a spectrum signal specifically includes:
[0024] If the ratio is greater than a set threshold, a fast Fourier transform is performed on the audio signal to obtain a spectrum signal.
[0025] Preferably, before performing short-time Fourier transform on the audio signal, the method further includes:
[0026] Perform pre-emphasis processing and / or noise reduction processing on the audio signal to be detected.
[0027] Preferably, the pre-emphasis processing specifically includes:
[0028] The audio signal to be detected is pre-emphasized by a first-order first filter.
[0029] Preferably, the noise reduction processing specifically includes:
[0030] Performing short-time Fourier transform on a pre-stored or input noisy audio signal;
[0031] Calculate the mean and standard deviation of the noise audio signal in frequency;
[0032] Performing short-time Fourier transform on the audio signal to be detected;
[0033] Calculate the threshold based on the statistical information of the noise;
[0034] Comparing the value of the audio signal to be detected after short-time Fourier transform with the threshold value to determine the mask signal;
[0035] smoothing the mask signal in frequency and time using a second filter;
[0036] The mask signal is superimposed on the value after the short-time Fourier transform of the audio signal and inverted to the audio signal.
[0037] In a second aspect, a snoring detection device includes:
[0038] An audio signal acquisition module is configured to acquire an audio signal to be detected;
[0039] The loudness mean ratio calculation module is configured to divide the audio signal into two frequency bands of equal frequency; obtain the frequency band loudness mean of the two frequency bands respectively, and calculate the ratio of the frequency band loudness mean of the two frequency bands;
[0040] a peak trajectory acquisition module configured to determine whether the ratio is greater than 2; if so, perform spectrum transformation on the audio signal to obtain a spectrum signal, and divide the frequency band into a window with a preset frequency value; average each divided window to obtain a frequency-loudness peak trajectory;
[0041] a distribution window acquisition module configured to acquire the number of maximum values and the distribution window to which the maximum values belong based on the frequency-loudness peak trajectory;
[0042] The snoring recognition module is configured to determine whether the number of maximum values and the distribution window to which the maximum values belong meet the snoring classification rules, and if so, recognize that the audio signal includes snoring.
[0043] Preferably, the snoring recognition module specifically performs the following processing:
[0044] If the number of maximum values is 1, determining whether the distribution window to which the maximum value belongs is located in the low-frequency part, and if so, recognizing that the audio signal includes snoring; the frequency of the low-frequency part is less than the first frequency value;
[0045] If the number of maxima is 2, determining the distribution window to which the maxima belong, determining whether one of the maxima is located in the low-frequency part and whether the other maxima is located in the intermediate-frequency part or the high-frequency part, and if so, identifying that the audio signal includes snoring; the frequency of the intermediate-frequency part is between the first frequency value and the second frequency value, and the frequency of the high-frequency part is greater than the second frequency value;
[0046] If the number of maximum values is 3, it is determined whether the distribution windows to which the maximum values belong are located in the low frequency part, the middle frequency part and the high frequency part respectively. If so, it is recognized that the audio signal includes snoring.
[0047] Preferably, the snoring detection device further includes a peak correction module, which is specifically configured to perform the following processing if it is determined that the number of maximum values is equal to 2 after the distribution window acquisition module:
[0048] If the first maximum value is located in the first frequency band and the frequency band loudness ratio between the first frequency band and the adjacent second frequency band is between [0.75, 1.25], the distribution window to which the first maximum value belongs is corrected to the second frequency band; wherein the frequency of the second frequency band is greater than the frequency of the first frequency band.
[0049] Preferably, the snoring detection device further includes a peak correction module, which is specifically configured to perform the following processing if it is determined that the number of maximum values is equal to 2 after the distribution window acquisition module:
[0050] If the first maximum value is located in the third frequency band and the frequency band loudness ratio between the third frequency band and the adjacent second frequency band is between [0.75, 1.25], the distribution window to which the third maximum value belongs is corrected to the second frequency band; wherein the frequency of the third frequency band is greater than the frequency of the second frequency band.
[0051] In a third aspect, an electronic device includes a processor and a memory, wherein the memory stores an application program, and the processor is configured to run the application program in the memory to execute the steps of the snoring detection method.
[0052] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor to execute the steps of the snoring detection method.
[0053] The present invention has the following beneficial effects:
[0054] (1) The present invention first calculates the ratio of the frequency band loudness means of the audio signal. When the ratio of the frequency band loudness means is greater than a set threshold, the frequency-loudness peak trajectory is further obtained, and the number of maximum values and the distribution window to which the maximum values belong are obtained. Based on the number of maximum values and the distribution window to which the maximum values belong, it is identified whether the audio signal is snoring. The calculation method is simple and easy to implement.
[0055] (2) The present invention performs peak correction when the number of maximum values is equal to 2, specifically, correction is performed when the frequency band loudness ratio of the left and right frequency bands is within a preset range, so as to obtain a more accurate recognition result;
[0056] (3) The present invention performs pre-emphasis processing and / or noise reduction processing on the audio signal before performing frequency band loudness mean comparison, which can effectively suppress the influence of low-frequency noise.
[0057] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] FIG1 is a flow chart of a snoring detection method according to an embodiment of the present invention;
[0059] FIG2 is a detailed flow chart of a snoring detection method according to an embodiment of the present invention;
[0060] FIG3 is a spectrum diagram before and after pre-emphasis processing according to an embodiment of the present invention; wherein (a) represents before processing, and (b) represents after processing;
[0061] FIG4 is a spectrum diagram before and after noise reduction processing according to an embodiment of the present invention; wherein (a) represents before processing, and (b) represents after processing;
[0062] FIG5 is a schematic diagram showing the distribution of four types of snoring sounds according to an embodiment of the present invention;
[0063] FIG6 is a schematic diagram of partial snoring / non-snoring spectra according to an embodiment of the present invention; wherein (a) shows spectrum 1 of partial snoring; (b) shows spectrum 2 of partial snoring; (c) shows spectrum 1 of partial non-snoring; (d) shows spectrum 2 of partial non-snoring; and (e) shows spectrum 3 of partial non-snoring.
[0064] FIG7 is a schematic diagram of spectrum before and after segmentation according to an embodiment of the present invention; wherein (a) shows a spectrum diagram before segmentation; (b) shows a schematic diagram after segmentation;
[0065] FIG8 is a schematic diagram of peak correction according to an embodiment of the present invention;
[0066] FIG9 is a schematic diagram of the frequency domain and peak trajectory of Class A according to an embodiment of the present invention;
[0067] FIG10 is a schematic diagram of the frequency domain and peak trajectory of Class B according to an embodiment of the present invention;
[0068] FIG11 is a schematic diagram of the frequency domain and peak trajectory of Class C according to an embodiment of the present invention;
[0069] FIG12 is a schematic diagram of the frequency domain and peak trajectory of Class D according to an embodiment of the present invention;
[0070] FIG13 is a block diagram of a snoring detection device according to an embodiment of the present invention;
[0071] FIG14 is a schematic diagram of the hardware structure of an electronic device for executing a snoring detection method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0072] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention; it is obvious that the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0073] In the description of the present invention, it should be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0074] In the description of the present invention, it should be noted that the terms “first” and “second” are only used for descriptive purposes and should not be understood as indicating or implying relative importance.
[0075] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, step identifiers S101, S102, S103, etc. are only used for convenient expression and do not represent the execution order. The corresponding execution order can be adjusted.
[0076] 1 and 2 , the present invention provides a snoring detection method, including:
[0077] S101, obtaining an audio signal to be detected;
[0078] S102, dividing the audio signal into two frequency bands of equal frequency; obtaining the mean loudness values of the two frequency bands respectively, and calculating the ratio of the mean loudness values of the two frequency bands;
[0079] S103, if the ratio is greater than a set threshold, performing spectrum transformation on the audio signal to obtain a spectrum signal, and dividing the frequency band into a window with a preset frequency value; taking an average value of each divided window to obtain a frequency-loudness peak trajectory;
[0080] S104, obtaining the number of maximum values and the distribution window to which the maximum values belong based on the frequency-loudness peak trajectory;
[0081] S105: Determine whether the number of maximum values and the distribution window to which the maximum values belong conform to the snoring classification rule. If so, identify that the audio signal includes snoring.
[0082] S101 to S105 of the snoring detection method of this embodiment can be implemented using an anti-snoring pillow device and / or an intelligent terminal device, as long as these devices have sound collection capabilities (such as a microphone) and / or processor capabilities (such as a microcontroller). Specifically, one terminal can be responsible for sound collection (such as an anti-snoring pillow) and another terminal can be responsible for sound processing (such as a mobile phone), or both sound collection and sound processing can be performed by a single terminal, without any specific limitation in this embodiment. Furthermore, the intelligent terminal device can be a mobile phone, tablet computer, wearable device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), etc. This embodiment does not impose any restrictions on the specific type of terminal device.
[0083] In this embodiment, after S101, the method further includes: performing pre-emphasis processing and / or noise reduction processing on the audio signal to be detected.
[0084] Specifically, in order to enhance the high-frequency components in the signal, the collected audio signal to be processed is pre-emphasized through a first-order filter. The filter used in this embodiment is as follows: X(z)=X(z)-0.98X(Z-1)
[0085] Wherein, X(z) represents the z-th sampling point of the input signal, and X(z-1) represents the z-1-th sampling point of the input signal.
[0086] The spectrum diagrams before and after the pre-emphasis processing are shown in FIG3 , wherein (a) represents the spectrum diagram before processing, and (b) represents the spectrum diagram after processing.
[0087] Furthermore, this embodiment also performs noise reduction processing after the pre-emphasis processing.
[0088] Specifically, the short-time Fourier transform is performed on the noise audio segment of the prototype noise of the audio segment, and the thresholds of the mean and standard deviation on the frequency are calculated to determine the mask operation on the audio signal.
[0089] Noise reduction processing requires two inputs, one is the audio signal to be processed, and the other is the noisy audio signal (the audio signal emitted by the machine that records the audio signal).
[0090] The specific processing steps are as follows:
[0091] (1) Perform STFT (Fast Fourier Transform) calculation on the noisy audio signal segment;
[0092] (2) The mean and standard deviation of the noise are calculated by STFT.
[0093] (3) Perform STFT calculation on the audio signal to be detected;
[0094] (4) Calculate a threshold based on the statistics of the noise (and the desired sensitivity of the algorithm);
[0095] (5) determining a mask signal by comparing the STFT value of the audio signal to be detected with a threshold;
[0096] (6) Using filters to smooth the mask signal in frequency and time;
[0097] (7) Superimpose the mask signal on the STFT of the audio signal to be detected and invert it to the audio signal.
[0098] Specifically, the threshold calculation process is as follows.
[0099] The parameters of Stft are: the number of points of the FFT window is 2048; the frame length l is 2048; the frame shift m is 512; and the window function is the Hanning window.
[0100] The noise audio signal is recorded as noise, the length is lens_noise, and the noise is subjected to stft transformation, recorded as noise_stft, with the format of a two-dimensional matrix of [1025, Nframes1].
[0101] Let the audio signal to be processed be signal, length be lens_signal, and perform stft transformation on signal, denoted as signal_stft, with the format of a two-dimensional matrix of [1025, Nframes2] Nframes1 = lens_snore-l / m Nframes2 = lens_signal-l / m
[0102] It is a one-dimensional matrix with a length of 1025 and a format of (1025, 1). Noise_thresh = Mean_noise + Std_noise*k
[0103] Where k represents the dispersion coefficient of the audio; k is set to 1.5; Noise_thresh is a one-dimensional matrix of length 1025, formatted as (1025, 1); Mean_noise represents the mean of the noise signal; Std_noise represents the standard deviation of the noise signal. Thresh is Noise_thresh repeated Nframes2 times on the column, formatted as (1025, Nframes2). The threshold is Thresh.
[0104] Further, the process of determining the mask signal is as follows.
[0105] Smooth_filter for smooth filtering = [1 / 3, 2 / 3, 1, 2 / 3, 1 / 3] * [0.2, 0.4, 0.6, 0.8, 1, 0.8, 0.6, 0.4, 0.2].T
[0106] Compare Thresh and signal_stft. When signal_stft < Thresh, set it to 1; otherwise, set it to 0, obtaining a matrix sig_mask with the format (1025, Nframes2). Convolve Smooth_filter and sig_mask to obtain the mask signal Mask_sign.
[0107] See FIG. 4 showing the spectrograms before and after the noise reduction processing in this embodiment; where (a) represents the spectrogram before processing, and (b) represents the spectrogram after processing. It can be seen from the comparison diagram that the noise reduction processing can effectively suppress the influence of low-frequency noise.
[0108] In this embodiment, in S102, the audio signal is divided into two frequency bands with equal frequencies, specifically including:
[0109] Perform short-time Fourier transform on the audio signal, and divide the transformed frequency band into two frequency bands with equal frequencies.
[0110] In S102, the parameter requirements for short-time Fourier transform are as follows:
[0111] (1) The number of points in the fft window is 2048;
[0112] (2) The frame length is 2048;
[0113] (3) The frame shift is 512;
[0114] (4) The window function selects the hanning window.
[0115] See FIG. 5 showing the schematic diagram of the distribution of four types of snoring sounds of the present invention.
[0116] Snoring sounds are mainly divided into four types, and the classification rules are as follows:
[0117] Type A: Low-frequency single-syllable snoring.
[0118] Type B: Double sounds with low and medium frequencies.
[0119] Type C: Double sounds with low and high frequencies.
[0120] Type D: Triple tones with low, medium, and high frequencies.
[0121] In this embodiment, the low frequency shown indicates a frequency less than 350 Hz (a first frequency value); the medium frequency shown indicates a frequency greater than 350 Hz and less than 850 Hz (a second frequency value); and the high frequency indicates a frequency greater than 850 Hz.
[0122] Since the frequency of snoring is mainly distributed in the low-frequency part, comparing the frequency band proportions can filter out some non-snoring sounds.
[0123] Here’s how it works:
[0124] Figures (a) through (e) in Figure 6 below show spectrograms of snoring and some non-snoring sounds. (a) shows spectrogram 1 of some snoring sounds; (b) shows spectrogram 2 of some snoring sounds; (c) shows spectrogram 1 of some non-snoring sounds (such as human voices, music, etc.); (d) shows spectrogram 2 of some non-snoring sounds (such as human voices, music, etc.); and (e) shows spectrogram 3 of some non-snoring sounds (such as human voices, music, etc.). The majority of the snoring signal's frequency lies within the range [0, 1000 Hz]. Calculate the average loudness value, mean1, for the range [0, 1000 Hz] and mean2 for the range [1000 Hz, 2000 Hz]. Calculate the ratio of the two frequency band loudness means as follows: ratio = mean1 / mean2.
[0125] If the ratio is greater than or equal to 2, the signal is considered to be a suspected snoring signal and the judgment continues;
[0126] If the ratio is less than 2, the signal is determined to be a non-snoring signal.
[0127] In S103 of this embodiment, if the ratio is greater than 2, performing spectrum transformation on the audio signal to obtain a spectrum signal specifically includes:
[0128] If the ratio is greater than 2, a fast Fourier transform is performed on the audio signal to obtain a spectrum signal.
[0129] Specifically, as shown in FIG7 , the frequency bands are divided with a window length of 200 Hz, with Freq0, Freq1, Freq2, Freq3, Freq4, Freq5…Freq13 as the horizontal axis and the average loudness of each frequency band as the vertical axis.
[0130] Freq0 represents 0HZ, and the corresponding loudness is Am0;
[0131] Freq1 represents (0,200HZ], and the corresponding loudness is Am1;
[0132] Freq2 represents (200,400HZ], and the corresponding loudness is Am2;
[0133] Freq3 represents (400,600HZ], and the corresponding loudness is Am3;
[0134] Freq4 represents (600,800HZ], and the corresponding loudness is Am4;
[0135] Freq5 represents (800,1000HZ], and the corresponding loudness is Am5;
[0136] Freq6 represents (1000,1200HZ], and the corresponding loudness is Am6;
[0137] Freq7 represents (1200,1400HZ], and the corresponding loudness is Am7;
[0138] Freq8 represents (1400,1600HZ], and the corresponding loudness is Am8;
[0139] Freq9 represents (1600,1800HZ], and the corresponding loudness is Am9;
[0140] Freq10 represents (1800,2000HZ], and the corresponding loudness is Am10;
[0141] Freq11 represents (2000,2200HZ], and the corresponding loudness is Am11;
[0142] Freq12 represents (2200,2400HZ], and the corresponding loudness is Am12;
[0143] Freq13 represents (2400,2600HZ], and the corresponding loudness is Am13.
[0144] In Figure 7, (a) shows the original audio signal spectrum, and (b) shows the image obtained after frequency band segmentation, that is, the frequency-loudness peak trajectory.
[0145] In this embodiment, after obtaining the number of maximum values and the distribution window to which the maximum values belong based on the frequency-loudness peak trajectory, peak correction is also performed when the number of maximum values is equal to 2, specifically including:
[0146] If the first maximum value is located in the third frequency band and the frequency band loudness ratio between the third frequency band and the adjacent second frequency band is between [0.75, 1.25], the distribution window to which the third maximum value belongs is corrected to the second frequency band; wherein the frequency of the third frequency band is greater than the frequency of the second frequency band.
[0147] Peak correction means that when the peak trace has some acceptable data errors, it is corrected to the data recognized by the peak matching template.
[0148] This includes meeting the following conditions:
[0149] When the peak trajectory length is 2, either of the following conditions (1) or (2) is satisfied.
[0150] (1) The first extreme point is Freq1. The average loudness ratio of the frequency bands Freq1 and Freq2 is between [0.75, 1.25]. The frequency band loudness ratio refers to the ratio of the average loudness of each frequency band.
[0151] (2) The first extreme point is Freq3, and the average loudness ratio of the Freq3 and Freq2 bands is between [0.75, 1.25];
[0152] Correct the first extreme value (maximum) point to Freq2.
[0153] As shown in FIG8 , (1) represents the loudness ratio r = Am1 / Am2 of (Freq1, Am1) and (Freq2, Am2). When r∈[0.75,1.25], the first extreme point in the peak trajectory is corrected to Freq2.
[0154] Similarly, (2) represents the case of (Freq3, Am3) and (Freq2, Am2). When the first extreme point is 3 or 1 and is within the acceptable error range with the loudness of the 2-band, it is considered that the noise data of (0, 200HZ] or [400HZ, 600HZ] affects the change of the peak point.
[0155] 5 and the above description, Class A snoring has a peak at the low frequency, i.e., 300 Hz; Class B snoring has a peak before the low frequency, i.e., 300 Hz, and a second peak in the mid-frequency part, i.e., 300-850 Hz; Class C snoring has a peak before the low frequency, i.e., 300 Hz, and a second peak after the high frequency part, i.e., 850 Hz; Class D snoring has a peak before the low frequency, i.e., 300 Hz, a second peak in the mid-frequency part, i.e., 300-850 Hz, and a third peak in the high frequency part, i.e., after 850 Hz.
[0156] The number of peaks is 1: (corresponding to Class A of snoring classification)
[0157] The first maximum value is at [Freq2], indicating that it has significant performance in the [200, 400HZ] frequency band.
[0158] The number of peaks is 2: (corresponding to the B / C category of snoring)
[0159] The first maximum is at [Freq2], indicating that it has a significant performance in the frequency band of [200, 400HZ]. The second maximum is one of [Freq4, Freq7, Freq8, Freq9, Freq10, Freq11], indicating that it is distributed in [600, 800HZ] or after 1200HZ.
[0160] The reason why Freq3 is not included is the result after peak correction.
[0161] The reason why it is after 1200HZ is the result of actual observation and statistics, which is basically after 1200HZ.
[0162] The number of peaks is 3: (corresponding to category D of snoring classification)
[0163] The first maximum value is at [Freq2], indicating that it has significant performance in the [200, 400 Hz] frequency band;
[0164] The second maximum value is one of [Freq3.Freq4], indicating that it is distributed in [600, 800HZ];
[0165] The third maximum value is one of [Freq7.Freq8.Freq9.Freq10.Freq11], indicating that there is distribution after 1200HZ.
[0166] Based on the above analysis, the snore classification rules of this embodiment can be derived, as follows.
[0167] (1) The number of peaks is 1, the position of the extreme point is Freq2, and x represents the extreme point, as shown in Figure 9.
[0168] (2) The number of peaks is 2. Does the trajectory distribution conform to the following: the first maximum value is at [Freq2], and the second maximum value is one of [Freq4, Freq7, Freq8, Freq9, Freq10, Freq11]?
[0169] As shown in FIG10 , the number of peak points is 2 and the position is (Freq2, Freq4), which is determined to be snoring.
[0170] As shown in FIG11 , the number of peak points is 2 and the position is (Freq2, Freq10), which is determined to be snoring.
[0171] (3) The number of peaks is 3. Does the distribution conform to ([Freq2][Freq3.Freq4][Freq7.Freq8.Freq9.Freq10.Freq11]))?
[0172] As shown in FIG12 , the number of extreme value points is 3 and the positions are (Freq2, Freq4, Freq10), which is judged as snoring.
[0173] As shown in FIG13 , this embodiment further discloses a snoring detection device, comprising:
[0174] The audio signal acquisition module 1301 is configured to acquire an audio signal to be detected;
[0175] The loudness mean ratio calculation module 1302 is configured to divide the audio signal into two frequency bands of equal frequency; obtain the frequency band loudness mean of the two frequency bands respectively, and calculate the ratio of the frequency band loudness mean of the two frequency bands;
[0176] The peak trajectory acquisition module 1303 is configured to determine whether the ratio is greater than 2. If so, perform spectrum transformation on the audio signal to obtain a spectrum signal, and divide the frequency band into a window with a preset frequency value as a window; average each divided window to obtain a frequency-loudness peak trajectory;
[0177] The distribution window acquisition module 1304 is configured to acquire the number of maximum values and the distribution window to which the maximum values belong based on the frequency-loudness peak trajectory;
[0178] The snoring recognition module 1305 is configured to determine whether the number of maximum values and the distribution window to which the maximum values belong meet the snoring classification rules. If so, it recognizes that the audio signal includes snoring.
[0179] Furthermore, the snoring recognition module specifically performs the following processing:
[0180] If the number of maximum values is 1, determining whether the distribution window to which the maximum value belongs is located in the low-frequency part, and if so, recognizing that the audio signal includes snoring; the frequency of the low-frequency part is less than the first frequency value;
[0181] If the number of maxima is 2, determining the distribution window to which the maxima belong, determining whether one of the maxima is located in the low-frequency part and whether the other maxima is located in the intermediate-frequency part or the high-frequency part, and if so, identifying that the audio signal includes snoring; the frequency of the intermediate-frequency part is between the first frequency value and the second frequency value, and the frequency of the high-frequency part is greater than the second frequency value;
[0182] If the number of maximum values is 3, it is determined whether the distribution windows to which the maximum values belong are located in the low frequency part, the middle frequency part and the high frequency part respectively. If so, it is recognized that the audio signal includes snoring.
[0183] Furthermore, the snoring detection device further includes a peak correction module, which is specifically configured to perform the following processing if it is determined that the number of maximum values is equal to 2 after the distribution window acquisition module:
[0184] If the first maximum value is located in the first frequency band and the frequency band loudness ratio between the first frequency band and the adjacent second frequency band is between [0.75, 1.25], the distribution window to which the first maximum value belongs is corrected to the second frequency band; wherein the frequency of the second frequency band is greater than the frequency of the first frequency band.
[0185] And / or, the peak correction module is specifically configured to perform the following processing if it is determined that the number of maximum values is equal to 2 after the distribution window acquisition module:
[0186] If the first maximum value is located in the third frequency band and the frequency band loudness ratio between the third frequency band and the adjacent second frequency band is between [0.75, 1.25], the distribution window to which the third maximum value belongs is corrected to the second frequency band; wherein the frequency of the third frequency band is greater than the frequency of the second frequency band.
[0187] For further functional descriptions of the audio signal acquisition module 1301 , loudness-to-mean ratio calculation module 1302 , peak trajectory acquisition module 1303 , distribution window acquisition module 1304 , and snoring recognition module 1305 in this embodiment, please refer to the aforementioned scalp and hair snoring detection method.
[0188] The present snoring detection method and device are based on a study of the spectral characteristics of a Fourier transform of an audio sampling signal to the frequency domain. Taking an audio signal as input, the original sound segment is first subjected to noise reduction. Frequency bands N1 and N2 are then divided and short-time Fourier transformed (SFT). The mean loudness values within bands N1 and N2 are calculated and compared to obtain a ratio (ratio). If the ratio is less than 2, the sound is eliminated and classified as non-snoring; if it is greater than 2, the detection continues. A fast Fourier transform is then performed on the entire audio signal to transfer the time domain information to the frequency domain. The spectral signal is then divided into a window of 200 Hz, with the portion [0 Hz: 2600 Hz] being divided. The average value of each window is taken, starting with 0 (the 0-200 Hz range is smoothed, so (0, 0) represents the sound intensity at 0 Hz). The 13 average values are arranged in frequency order to form a signal of length 14. The maximum value of this signal is calculated to form a frequency-loudness peak trajectory. This peak trajectory is then matched against a preset template for determination. If a match is found, the sound is classified as snoring; otherwise, it is classified as non-snoring.
[0189] FIG14 is a schematic diagram showing the hardware structure of an electronic device 600 for the snore detection method provided in this embodiment. As shown in FIG13 , the electronic device 140 includes:
[0190] One or more processors 1401 and a memory 1402 , with one processor 1401 being used as an example in FIG14 .
[0191] The processor 1401 and the memory 1402 may be connected via a bus or other means. FIG14 takes the bus connection as an example.
[0192] Memory 1402, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the snoring detection method in the embodiments of this application. Processor 1401 executes the non-volatile software programs, instructions, and modules stored in memory 1402 to execute various functional applications of the terminal device or server and perform data processing, thereby implementing the snoring detection method in the above-mentioned method embodiments.
[0193] Memory 1402 may include a program storage area and a data storage area. The program storage area may store an operating system and applications required for at least one function; the data storage area may store data generated based on the use of the snoring detection device. Furthermore, memory 1402 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state memory device. In some embodiments, memory 1402 may optionally include memory remote from processor 1401. Such remote memory may be connected to the snoring detection device via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0194] The one or more modules are stored in the memory 1402 and, when executed by the one or more processors 1401, perform the snoring detection method in any of the above method embodiments, for example, execute steps 101 to S105 of the method described above in FIG. 1 to implement the functions of modules 1301-1305 in FIG. 13 .
[0195] The above-mentioned product can execute the method provided in the embodiment of this application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of this application.
[0196] The electronic devices of the embodiments of the present application exist in various forms, including but not limited to:
[0197] (1) Mobile communication devices: These devices are characterized by their mobile communication capabilities and are primarily designed to provide voice and data communications. These terminals include smartphones (e.g., iPhones), multimedia phones, feature phones, and low-end phones.
[0198] (2) Ultra-mobile personal computer devices: These devices fall under the category of personal computers, have computing and processing capabilities, and generally also have mobile Internet access. These terminals include PDAs, MIDs, and UMPCs, such as the iPad.
[0199] (3) Server: A device that provides computing services. The server consists of a microcontroller, hard disk, memory, system bus, etc. The server is similar to a general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.
[0200] (4) Other electronic devices with data interaction functions.
[0201] An embodiment of the present application provides a non-volatile computer-readable storage medium storing computer-executable instructions. The computer-executable instructions are executed by one or more microcontrollers, such as a processor 1401 in FIG. 14 . This enables the one or more microcontrollers to perform the snoring detection method in any of the above-described method embodiments, for example, executing steps 101 to S105 of the method in FIG. 1 described above, thereby implementing the functions of modules 1301-1302 in FIG. 13 .
[0202] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0203] Through the description of the above embodiments, it can be clearly understood by those skilled in the art that each embodiment can be implemented by means of software plus a general hardware platform, or of course by hardware. It can be understood by those skilled in the art that all or part of the processes in the above embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0204] The above description is merely a preferred embodiment of the present invention; however, the scope of protection of the present invention is not limited thereto. Any person skilled in the art who, within the technical scope disclosed by the present invention, makes equivalent substitutions or modifications based on the technical solutions and improved concepts of the present invention shall be covered by the scope of protection of the present invention.
[0205] Industrial Usability
[0206] The present invention provides a snoring detection method and device, which are based on spectrum signal analysis. Compared with deep learning methods, the computational complexity is smaller, the method is easier to implement, and the snoring detection device is more practical.
Claims
1. A snoring detection method, characterized in that: include: Acquire the audio signal to be detected; Divide the audio signal into two frequency bands; Obtain the average frequency band loudness of the two frequency bands respectively, and calculate the ratio of the average frequency band loudness of the two frequency bands; If the ratio is greater than a set threshold, the audio signal is subjected to spectrum transformation to obtain a spectrum signal, and the frequency band is divided into a window with a preset frequency value; an average value is taken for each divided window to obtain a frequency-loudness peak trajectory; Obtain the number of maximum values and the distribution window to which the maximum values belong based on the frequency-loudness peak trajectory; It is determined whether the number of maximum values and the distribution window to which the maximum values belong conform to the snoring classification rule. If so, it is identified that the audio signal includes snoring.
2. The snoring detection method according to claim 1, characterized in that: Determine whether the number of maximum values and the distribution window to which the maximum values belong meet the snoring classification rules. If yes, identify that the audio signal includes snoring, specifically including: If the number of maximum values is 1, determining whether the distribution window to which the maximum value belongs is located in the low-frequency part, and if so, recognizing that the audio signal includes snoring; the frequency of the low-frequency part is less than the first frequency value; If the number of maximum values is 2, determine the distribution window to which the maximum values belong, determine whether one of the maximum values is located in the low frequency part, and whether the other maximum value is located in the intermediate frequency part or the high frequency part, and if so, identify that the audio signal includes snoring; the frequency of the intermediate frequency part is between the first frequency value and the second frequency value, and the frequency of the high frequency part is greater than the second frequency value; If the number of maximum values is 3, it is determined whether the distribution windows to which the maximum values belong are located in the low frequency part, the middle frequency part and the high frequency part respectively. If so, it is recognized that the audio signal includes snoring.
3. The snoring detection method according to claim 2, characterized in that: After obtaining the number of maximum values and the distribution window to which the maximum values belong based on the frequency-loudness peak trajectory, peak correction is also performed when the number of maximum values is equal to 2, specifically including: If the first maximum value is located in the first frequency band, and the frequency band loudness ratio between the first frequency band and the adjacent second frequency band is between [0.75, 1.25], the distribution window to which the first maximum value belongs is corrected to the second frequency band; wherein the frequency of the second frequency band is greater than the frequency of the first frequency band.
4. The snoring detection method according to claim 2, characterized in that: After obtaining the number of maximum values and the distribution window to which the maximum values belong based on the frequency-loudness peak trajectory, peak correction is also performed when the number of maximum values is equal to 2, specifically including: If the first maximum value is located in the third frequency band, and the frequency band loudness ratio between the third frequency band and the adjacent second frequency band is between [0.75, 1.25], the distribution window to which the third maximum value belongs is corrected to the second frequency band; wherein the frequency of the third frequency band is greater than the frequency of the second frequency band.
5. The snoring detection method according to claim 1, characterized in that: Divide the audio signal into two frequency bands of equal frequency, including: Perform short-time Fourier transform on the audio signal and divide the transformed frequency band into two frequency bands of equal frequency.
6. The snoring detection method according to claim 1, characterized in that: If the ratio is greater than a set threshold, performing spectrum transformation on the audio signal to obtain a spectrum signal, specifically including: If the ratio is greater than a set threshold, a fast Fourier transform is performed on the audio signal to obtain a spectrum signal.
7. The snoring detection method according to claim 5, characterized in that: Before performing short-time Fourier transform on the audio signal, it also includes: Perform pre-emphasis processing and / or noise reduction processing on the audio signal to be detected.
8. The snoring detection method according to claim 7, characterized in that: The pre-emphasis processing specifically includes: The audio signal to be detected is pre-emphasized by a first order first filter.
9. The snoring detection method according to claim 7 or 8, characterized in that: The noise reduction process specifically includes: Performing a short-time Fourier transform on a pre-stored or input noisy audio signal; Calculate the mean and standard deviation of the noise audio signal in frequency; Performing short-time Fourier transform on the audio signal to be detected; Calculate thresholds based on statistical information of noise; The mask signal is determined by comparing the value of the audio signal to be detected after short-time Fourier transformation with the threshold value; smoothing the mask signal in frequency and time using a second filter; The mask signal is superimposed on the value of the audio signal after short-time Fourier transformation, and then inverted to the audio signal.
10. A snoring detection device, characterized in that: include: An audio signal acquisition module, configured to acquire an audio signal to be detected; The loudness mean ratio calculation module is configured to divide the audio signal into two frequency bands with equal frequencies; obtain the frequency band loudness mean values of the two frequency bands respectively, and calculate the ratio of the frequency band loudness mean values of the two frequency bands; The peak trajectory acquisition module is configured to determine whether the ratio is greater than 2. If so, perform spectrum transformation on the audio signal to obtain a spectrum signal, and divide the frequency band into a window with a preset frequency value; take an average value for each divided window to obtain a frequency-loudness peak trajectory; A distribution window acquisition module is configured to acquire the number of maximum values and the distribution window to which the maximum values belong based on the frequency-loudness peak trajectory; The snoring recognition module is configured to determine whether the number of maximum values and the distribution window to which the maximum values belong conform to the snoring classification rule, and if so, recognize that the audio signal includes snoring.
11. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores an application program, and the processor is used to run the application program in the memory to execute the steps of the snoring detection method according to any one of claims 1 to 10.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps of the snoring detection method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Sleep quality monitoring method based on smartphone
CN108523901A
Snore recognition method and snore-stopping device
CN108697328A
Autonomously updated abnormal sound detection algorithm without negative sample
CN112735474A
Apnea judgment method and device and electronic equipment
CN113314143A
Sleep talking identification method and device and electronic equipment
CN113421586A
Cited By
Snore monitoring method and device for sleep apnea pathology identification
CN120570572A
