A high-accuracy continuous phase detection method for digital audio
By calculating the correlation coefficient and time slice division of the left and right channel audio signals, and combining the inversion threshold and continuous normal signal threshold, the false alarm problem when the low-level ratio is large in the existing technology is solved, and high-accuracy continuous phase detection of digital audio signals is achieved.
Patent Information
- Application Number
- CN202310056396.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-17
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2043-01-17
AI Technical Summary
The existing continuous phase detection method for digital audio signals is prone to false alarms when the audio signal has a high proportion of low levels, and is unable to accurately calculate the time period for reverse phase alarms.
By calculating the correlation coefficient of the left and right channel audio signals, adopting the method of time slice division and phase state queue management, and combining the inversion threshold, inversion sensitivity and continuous normal signal threshold, high-accuracy continuous phase detection of digital audio signals is achieved.
It effectively filters out low-level channel data, reduces the false positive rate, and can accurately detect short-term reverse phase fault tolerance and long-term reverse phase alarm, thereby improving the accuracy of time period recognition of reverse phase alarm.
Smart Images

Figure CN116168724B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of digital audio signal processing, and in particular to a high-accuracy digital audio continuous phase detection method. Background Art
[0002] Conventional continuous phase detection of digital audio signals typically employs a statistical algorithm. The algorithm first calculates the signed correlation coefficient of the left and right channel audio signal sampling values for a specific time slot. When the correlation coefficient falls below the inversion threshold, it indicates that the time slot is inverted. When the cumulative time slot reaches the minimum detection duration and the proportion of inverted time slots reaches the inverted duration percentage, an inversion alarm is triggered. This method typically counts all sampling values, including low-level values, when calculating the signed correlation coefficient of the time slot sampling values. This can lead to false alarms for audio signals with a high proportion of low levels. The calculation of the inverted duration percentage does not consider the distribution of normal signals, making it impossible to accurately calculate the time period for inverted alarms. Summary of the Invention
[0003] The present invention mainly solves the problem that the general algorithm in the continuous phase detection of digital audio signals has false alarms when the low level ratio is too high and the time period of the reverse phase alarm cannot be accurately calculated. It provides a high-accuracy digital audio continuous phase detection method. The linear relationship between the left and right channel variables X and Y is calculated according to the statistical algorithm. The range of values is [-1, +1]. The expression in the instantaneous state is: R XY =∫X(t)Y(t)dt. The audio signal can be understood as the superposition of many ideal sine waves. The phase difference expression of the two signals is:
[0004]
[0005] The present invention solves the above technical problems mainly through the following technical solutions: a high-accuracy digital audio continuous phase detection method, comprising the following steps:
[0006] S001, dividing the digital audio signal of the most recent second by time length to obtain a number of time slices;
[0007] S002. Calculate the correlation coefficient P for each time slice using the following formula:
[0008]
[0009] Where C is the phase statistics of this time slice, and S is the effective statistics of this time slice;
[0010] S003. Calculate the phase state once per second: Count the correlation coefficients of all time slices in this 1 second. When the proportion of time slices with a correlation coefficient lower than the inversion threshold r reaches the inversion sensitivity s, the phase state of this 1 second is determined to be inversion; otherwise, the state of this 1 second is determined to be normal. The state of this 1 second is added to the end of the phase state queue.
[0011] S004. Continue to process subsequent digital audio signals according to steps S001 to S003 until a phase state queue of T seconds is met, where T is the minimum detection time. When the queue is full of T seconds and a new second is generated, the first second of the queue is deleted according to the first-in-first-out principle, and the latest second is added to the end of the queue.
[0012] S005. Calculate the proportion of reverse phase states in the phase state queue. When the reverse phase state proportion exceeds u, and the first second of the queue is reverse phase, and the continuous normal signal in the queue is less than v seconds, the signal is determined to be reverse phase. u is the reverse phase state proportion threshold, and v is the continuous normal signal threshold.
[0013] S006. When the signal is determined to be inverted, if the proportion of inverted states in the phase state queue is less than u, and the last second of the queue is normal, and the continuous normal signal in the queue exceeds v seconds, it is determined that the signal inversion is completed.
[0014] Preferably, in step S002, the correlation coefficient P of each time slice is calculated as follows:
[0015] S011. Set the phase statistics C and the effective statistics S to 0; take the left channel PCM value and the right channel PCM value of the first sampling point from the stereo sampling point queue of this time slice;
[0016] S012, respectively calculating the left channel volume value and the right channel volume value of the current sampling point;
[0017] S013. When either or both of the left channel volume value or the right channel volume value are lower than L, take the left channel PCM value and the right channel PCM value of the next sampling point and jump to step S012. When both the left channel volume value and the right channel volume value are not lower than L, enter S014; L is the low level threshold.
[0018] S014. If the left channel PCM value and the right channel PCM value of the currently processed sampling point are both positive or negative, the phase statistic C is increased by 1; otherwise, C is decreased by 1.
[0019] S015, the effective statistical number S is increased by 1; if all sampling points of this time slice have been taken out, then go to step S016, otherwise take the left channel PCM value and the right channel PCM value of the next sampling point and jump to step S012;
[0020] S016. Calculate the correlation coefficient P of the current time slice according to the time slice correlation coefficient formula.
[0021] Preferably, in step S012, the volume value V is calculated according to the following formula:
[0022]
[0023] Where y(i) is the sampling value sequence of the left channel or the right channel, i = 1, 2, ..., N, N is the number of sampling points in a time slice, and q is the quantization accuracy.
[0024] Preferably, the length t of each time slice is 50 milliseconds, the sampling frequency f is 48,000 Hz, the quantization accuracy q is 16 bits, and the number N of sampling points in each time slice is 2,400.
[0025] Preferably, the low level threshold L is -48dBFS.
[0026] Preferably, the reverse phase threshold r is -0.75, the reverse phase sensitivity s is 60%, the minimum detection time T is 60 seconds, the reverse phase state proportion threshold u is 90%, and the continuous normal signal threshold v is 4 seconds.
[0027] The substantial effect of the present invention is that filtering out stereo data of low-level channels less than -48dBFS can reduce the misjudgment rate. By introducing the calculation of the inversion sensitivity per second and the inversion duration ratio within the duration, and taking the priority inversion sensitivity being less than the inversion duration ratio, it is possible to meet the requirements of short-term inversion fault tolerance and long-term inversion alarm accuracy. Introducing a continuous normal signal threshold can understand the distribution of normal signals within the duration. At the same time, introducing an alarm mechanism for inversion in the first second and a recovery mechanism for normality in the last second can more accurately reflect the inversion time period. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0029] The technical solution of the present invention will be further specifically described below through embodiments and in conjunction with the accompanying drawings.
[0030] Embodiment: This embodiment provides a high-accuracy digital audio continuous phase detection method, such as Figure 1 As shown, the following steps are included:
[0031] S001. Divide the digital audio signal of the most recent second by time length to obtain a number of time slices; a time slice here refers to a sequence of sampling points of the digital audio signal with a duration of t milliseconds;
[0032] S002. Calculate the correlation coefficient P for each time slice using the following formula:
[0033]
[0034] Where C is the phase statistics of this time slice, and S is the effective statistics of this time slice;
[0035] Each time slice is t milliseconds, the sampling frequency is f Hz, the quantization accuracy is q bits, and the number of stereo sampling points in the time slice is Each stereo sampling point is divided into two sampling values for the left and right channels, and the value range is [-2 q-1 ,2 q-1 -1], the left and right channel sampling value sequence is y(i), i = 1, 2, ... N, and the volume value formula is:
[0036]
[0037] Generally, t is 50 milliseconds, when f is 48000 Hz, q is 16, N is 2400, and the sampling value range is [-32768, 32767].
[0038] S003. Calculate the phase state once per second: Count the correlation coefficients of all time slices in this 1 second. When the proportion of time slices with a correlation coefficient lower than the inversion threshold r reaches the inversion sensitivity s, the phase state of this 1 second is determined to be inversion; otherwise, the state of this 1 second is determined to be normal. The state of this 1 second is added to the end of the phase state queue.
[0039] S004. Continue to process subsequent digital audio signals according to steps S001 to S003 until a phase state queue of T seconds is met, where T is the minimum detection time. When the queue is full of T seconds and a new second is generated, delete the first second of the queue according to the first-in-first-out principle and add the latest second to the end of the queue. That is, except for the initial stage, the phase state queue is always kept at T seconds.
[0040] S005. Calculate the proportion of reverse phase states in the phase state queue. When the reverse phase state proportion exceeds u, and the first second of the queue is reverse phase, and the continuous normal signal in the queue is less than v seconds, the signal is determined to be reverse phase. According to the settings, a reverse phase alarm can be triggered. u is the reverse phase state proportion threshold, and v is the continuous normal signal threshold. This step is triggered only when the length of the phase state queue is equal to T seconds. If it is less than T seconds, the phase state will continue to be detected and added to the queue.
[0041] S006. When the signal is determined to be inverted, when the proportion of inverted states in the phase state queue is less than u, and the last second of the queue is normal, and the continuous normal signal in the queue exceeds v seconds, it is determined that the signal inversion is completed and the inverted alarm can be released as needed.
[0042] Generally, the reverse phase threshold r is -0.75, the reverse phase sensitivity s is 60%, the minimum detection time T is 60 seconds, the reverse phase state ratio threshold u is 90%, and the continuous normal signal threshold v is 4 seconds.
[0043] In step S002, the correlation coefficient P of each time slice is calculated as follows:
[0044] S011. Set the phase statistics C and the effective statistics S to 0; take the left channel PCM value and the right channel PCM value of the first sampling point from the stereo sampling point queue of this time slice;
[0045] S012, respectively calculating the left channel volume value and the right channel volume value of the current sampling point;
[0046] S013. When either or both of the left channel volume value or the right channel volume value are lower than L, take the left channel PCM value and the right channel PCM value of the next sampling point and jump to step S012. When both the left channel volume value and the right channel volume value are not lower than L, enter S014. L is the low level threshold, generally -48dBFS.
[0047] S014. If the left channel PCM value and the right channel PCM value of the currently processed sampling point are both positive or negative, the phase statistic C is increased by 1; otherwise, C is decreased by 1.
[0048] S015, the effective statistical number S is increased by 1; if all sampling points of this time slice have been taken out, then go to step S016, otherwise take the left channel PCM value and the right channel PCM value of the next sampling point and jump to step S012;
[0049] S016. Calculate the correlation coefficient P of the current time slice according to the time slice correlation coefficient formula.
[0050] This solution filters out stereo data from low-level channels with a frequency less than -48dBFS, reducing the false positive rate. By introducing a per-second calculation based on the sensitivity of the inversion and a per-second calculation based on the percentage of the inversion duration, with the priority set to be less than the percentage of the inversion duration, this approach ensures fault tolerance for short-term inversions and accurate alarms for long-term inversions. Introducing a continuous normal signal threshold allows for understanding the distribution of normal signals within a given duration. Simultaneously, introducing an alarm mechanism for inversions in the first second and a recovery mechanism for normality in the last second can more accurately reflect the inversion time period.
[0051] The specific embodiments described herein are merely illustrative of the spirit of the present invention. Persons skilled in the art may make various modifications, additions, or substitutions to the described specific embodiments without departing from the spirit of the present invention or exceeding the scope of the appended claims.
[0052] Although this document frequently uses terms such as time slice, low-level threshold, and correlation coefficient, the use of other terms is not excluded. These terms are used merely to more conveniently describe and explain the essence of the present invention; interpreting them as any additional limitations is contrary to the spirit of the present invention.
Claims
1. A high-accuracy digital audio continuous phase detection method, characterized in that: The following steps are involved: S001, dividing the digital audio signal of the most recent second by time length to obtain a number of time slices; S002. Calculate the correlation coefficient P for each time slice using the following formula: Where C is the phase statistics of this time slice, and S is the effective statistics of this time slice; S003. Calculate the phase state once per second: Count the correlation coefficients of all time slices in this 1 second. When the proportion of time slices with a correlation coefficient lower than the inversion threshold r reaches the inversion sensitivity s, the phase state of this 1 second is determined to be inversion; otherwise, the state of this 1 second is determined to be normal. The state of this 1 second is added to the end of the phase state queue. S004. Continue to process subsequent digital audio signals according to steps S001 to S003 until a phase state queue of T seconds is met, where T is the minimum detection time. When the queue is full of T seconds and a new second is generated, the first second of the queue is deleted according to the first-in-first-out principle, and the latest second is added to the end of the queue. S005. Calculate the proportion of reverse phase states in the phase state queue. When the reverse phase state proportion exceeds u, and the first second of the queue is reverse phase, and the continuous normal signal in the queue is less than v seconds, the signal is determined to be reverse phase. u is the reverse phase state proportion threshold, and v is the continuous normal signal threshold. S006. When the signal is determined to be inverted, if the proportion of inverted states in the phase state queue is less than u, and the last second of the queue is normal, and the continuous normal signal in the queue exceeds v seconds, it is determined that the signal inversion is completed.
2. The high-accuracy digital audio continuous phase detection method according to claim 1, characterized in that: In step S002, the correlation coefficient P of each time slice is calculated as follows: S011. Set the phase statistics C and the effective statistics S to 0; take the left channel PCM value and the right channel PCM value of the first sampling point from the stereo sampling point queue of this time slice; S012, respectively calculating the left channel volume value and the right channel volume value of the current sampling point; S013. When either or both of the left channel volume value or the right channel volume value are lower than L, take the left channel PCM value and the right channel PCM value of the next sampling point and jump to step S012. When both the left channel volume value and the right channel volume value are not lower than L, enter S014; L is the low level threshold. S014. If the left channel PCM value and the right channel PCM value of the currently processed sampling point are both positive or both negative, the phase statistic C is increased by 1; Otherwise, C decreases by 1; S015, the effective statistical number S is increased by 1; if all sampling points of this time slice have been taken out, then go to step S016, otherwise take the left channel PCM value and the right channel PCM value of the next sampling point and jump to step S012; S016. Calculate the correlation coefficient P of the current time slice according to the time slice correlation coefficient formula.
3. The high-accuracy digital audio continuous phase detection method according to claim 2, characterized in that: In step S012, the volume value V is calculated according to the following formula: Where y(i) is the sampling value sequence of the left channel or the right channel, i = 1, 2, ..., N, N is the number of sampling points in a time slice, and q is the quantization accuracy.
4. The high-accuracy digital audio continuous phase detection method according to claim 3, characterized in that: The length of each time slice t is 50 milliseconds, the sampling frequency f is 48000 Hz, the quantization accuracy q is 16 bits, and the number of sampling points N in each time slice is 2400.
5. The high-accuracy digital audio continuous phase detection method according to claim 2, characterized in that: The low level threshold L is -48dBFS.
6. A high-accuracy digital audio continuous phase detection method according to claim 1 or 5, characterized in that: The reverse phase threshold r is -0.75, the reverse phase sensitivity s is 60%, the minimum detection time T is 60 seconds, the reverse phase state ratio threshold u is 90%, and the continuous normal signal threshold v is 4 seconds.
Citation Information
Patent Citations
Method for detecting instantaneous phase of audio signal with damping coefficient
CN113257278A
Audio signal processing apparatus and method
CN1756446A