Key recognition method, device, equipment and medium
By sampling the PCM data stream and combining multiple frames of historical data to calculate the energy amplitude of the DTMF frequency table, the problem of insufficient DTMF signal detection accuracy is solved, and higher key recognition accuracy is achieved.
Patent Information
- Application Number
- CN202411182394.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2044-08-26
AI Technical Summary
The DTMF signal detection accuracy in the prior art is relatively poor, resulting in an inaccurate key recognition method.
By sampling the received analog signal into a pulse code modulation (PCM) data stream, combining the current PCM data frame with multiple frames of historical PCM data frames, the energy amplitude of the target PCM data in the DTMF frequency table is determined, the Goertzel algorithm is used to calculate the energy amplitude in parallel, and the energy threshold is corrected to improve detection accuracy.
The detection range is expanded, the calculation error of the energy amplitude is reduced, and the recognition accuracy of the DTMF signal is improved.
Smart Images

Figure CN119299018B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of communication, and particularly relates to a key recognition method and device, equipment and medium. BACKGROUND
[0002] Dual-Tone Multi-Frequency (DTMF) technology is an in-band communication signal transmitted by a telephone device through an audio frequency band on a telephone line between the telephone device and other communication devices and a switching center, and is usually used for quickly and reliably transmitting telephone numbers. DTMF signal detection (i.e., terminal device key recognition) is also an important part of various service implementations. A DTMF signal is formed by superimposing two audio signals of different frequencies, and each frequency combination represents a different key or number. When a user presses a key on a terminal device, a corresponding DTMF signal is generated, and DTMF signal detection is used to detect key or number information. The key recognition method in the related art has poor accuracy. SUMMARY
[0003] Embodiments of the present application provide an implementation scheme different from the related art to solve the technical problem of poor accuracy of the key recognition method in the related art.
[0004] In a first aspect, the present application provides a key recognition method, comprising:
[0005] sampling a received analog signal into a pulse code modulation (PCM) data stream;
[0006] for a current PCM data frame in the PCM data stream, determining a target PCM data corresponding to the current PCM data frame based on the current PCM data frame and a preset number of historical PCM data frames before the current PCM data frame;
[0007] determining a maximum energy amplitude in each energy amplitude corresponding to the target PCM data on each low-frequency frequency in a DTMF frequency table, to obtain a first energy amplitude, and determining a maximum energy amplitude in each energy amplitude corresponding to the target PCM data on each high-frequency frequency in the DTMF frequency table, to obtain a second energy amplitude;
[0008] determining a number corresponding to a target frequency pair corresponding to the first energy amplitude and the second energy amplitude in the DTMF frequency table, the number being used to determine a key value corresponding to the analog signal.
[0009] In a second aspect, the present application provides a key recognition device, comprising:
[0010] a sampling unit configured to sample a received analog signal into a pulse code modulation (PCM) data stream;
[0011] a target PCM data determination unit, configured to determine target PCM data corresponding to a current PCM data frame in the PCM data stream based on the current PCM data frame and a preset number of historical PCM data frames before the current PCM data frame;
[0012] a maximum energy amplitude determination unit, configured to determine a maximum energy amplitude among energy amplitudes corresponding to each low-frequency frequency in a dual-tone multi-frequency (DTMF) frequency table of the target PCM data, to obtain a first energy amplitude, and determine a maximum energy amplitude among energy amplitudes corresponding to each high-frequency frequency in the DTMF frequency table of the target PCM data, to obtain a second energy amplitude;
[0013] a key value identification unit, configured to determine a number corresponding to a target frequency pair of the first energy amplitude and the second energy amplitude in the DTMF frequency table, the number being used to determine a key value corresponding to the analog signal.
[0014] In a third aspect, an electronic device is provided, comprising:
[0015] a processor; and a memory configured to store executable instructions of the processor;
[0016] wherein the processor is configured to implement the method in the first aspect, or any possible implementation of the first aspect, by executing the executable instructions.
[0017] In a fourth aspect, a computer readable storage medium is provided, having stored thereon a computer program, the computer program being executable by a processor to implement the method in the first aspect, or any possible implementation of the first aspect.
[0018]
[0019] The application provides sampling of a received analog signal into a pulse code modulation (PCM) data stream; for a current PCM data frame in the PCM data stream, determining target PCM data corresponding to the current PCM data frame based on the current PCM data frame and a preset number of historical PCM data frames before the current PCM data frame; determining a maximum energy amplitude in each energy amplitude corresponding to each low-frequency frequency of a dual-tone multi-frequency (DTMF) frequency table of the target PCM data, obtaining a first energy amplitude, and determining a maximum energy amplitude in each energy amplitude corresponding to each high-frequency frequency of the DTMF frequency table of the target PCM data, obtaining a second energy amplitude; determining a target frequency pair corresponding to the first energy amplitude and the second energy amplitude in a number corresponding to the DTMF frequency table, and the number is used to determine a scheme of a key value corresponding to the analog signal. The target PCM data determined by the current PCM data frame and the buffered multiple historical PCM data frames is used as a detection object, the maximum energy amplitude corresponding to each low-frequency frequency and each high-frequency frequency of the target PCM data in the DTMF frequency table is calculated, the key value corresponding to the target DTMF signal corresponding to the current PCM data frame is determined, compared with the scheme of determining the key value only according to the maximum energy amplitude corresponding to each low-frequency frequency and each high-frequency frequency of the current PCM data frame in the DTMF frequency table in the related art, the target PCM data determined according to the current PCM data frame and the multiple historical PCM data frames is used as the detection object, more information of the target DTMF signal corresponding to the current PCM data frame can be provided, the detection range is expanded, the calculation error of the energy amplitude is reduced, and the technical effect of improving the accuracy of identifying the key value corresponding to the target DTMF analog signal corresponding to the current PCM data frame in the analog signal is achieved. BRIEF DESCRIPTION OF DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the following will briefly introduce the drawings needed to be used in the embodiments or the related art description. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can also obtain other drawings according to these drawings without any creative effort. In the drawings:
[0021] Figure 1 The flowchart of the key recognition method provided by an embodiment of the present application;
[0022] Figure 2 The structural schematic diagram of a key recognition system provided by an embodiment of the present application;
[0023] Figure 3 The structural schematic diagram of a key recognition device provided by an embodiment of the present application;
[0024] Figure 4 A structural schematic diagram of an electronic device is provided for an embodiment of the present application. DETAILED DESCRIPTION
[0025] Embodiments of the present application are described in detail below with reference to examples illustrated in the accompanying drawings. The embodiments described below are examples and are intended to explain the present application, and should not be understood as limiting the present application.
[0026] The terms "first" and "second" and the like in the specification, claims and drawings of the embodiments of the present application are used to distinguish similar objects, and do not necessarily have to be used to describe a particular order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the present application can be implemented in other orders than the order illustrated or described in the present application. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a list of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to such processes, methods, products or devices.
[0027] First, the following explains some of the terms used in the embodiments of the present application, so as to facilitate understanding by those skilled in the art.
[0028] A DTMF signal is composed of two different frequency sound signals, a low frequency signal and a high frequency signal, which are transmitted through a telephone line or other communication channels, used to dial a phone number or issue a command to the switching system. The high frequency group contains four tone signals, with frequencies of 1209 Hz, 1336 Hz, 1477 Hz and 1633 Hz; the low frequency group also contains four tone signals, with frequencies of 697 Hz, 770 Hz, 852 Hz and 941 Hz. In this way, by combining the signals in the two frequency groups, the numbers 0-9 on the telephone keypad and the two special symbols * and # can be represented.
[0029] The DTMF (Dual-Tone Multi-Frequency) frequency table lists the dual-tone combinations used to represent different numbers, symbols and functions. The following is a detailed content of the DTMF frequency table:
[0030]
[0031]
[0032] PCM (Pulse Code Modulation) data is a type of data generated using PCM technology, which is a method of converting analog signals into digital signals, including three key steps: sampling, quantization, and encoding.
[0033] SLIC (Subscriber Line Interface Circuit) chips play a crucial role in communication systems, particularly in telephone communication networks. They serve as a bridge between telephone user terminal equipment (such as telephones) and telephone exchanges, responsible for signal conversion, processing, and control to ensure clear, stable, and efficient communication. The main functions of SLIC chips include receiving analog signals from telephone lines, converting them into digital signals, and implementing communication functions such as audio amplification, noise suppression, and call transfer through digital signal processing and call control. Additionally, SLIC chips can convert processed digital signals back into analog signals and send them to telephone lines.
[0034] To use DTMF signals, devices need to be able to detect and decode these signals. The detection of DTMF signals usually involves audio signal processing and frequency analysis. Decoders analyze the received audio signals to find low and high frequency components and map them to corresponding numbers, letters, or special characters. However, the accuracy of DTMF signal detection in related technologies is poor.
[0035] To solve this technical problem, the present application provides a key recognition method, device, equipment and medium, which solves the technical problem of poor accuracy of DTMF signal detection in related technologies.
[0036] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of the present application will be described below with reference to the drawings.
[0037] Figure 1A flowchart of a key recognition method is provided for an exemplary embodiment of the present application. The method can be applied to a DTMF signal detection device, which can be used in a communication device or system based on DTMF signal detection technology, such as an automatic voice response system (IVR), an access control system, a voice mail system, a remote control device, a telephone bank and ATM terminal, an interactive voice response system (VRS), a VOIP (Voice over Internet Protocol) system, a telephone conference system, a security monitoring system, and an industrial automation control device, etc. More specifically, in a VOIP system, the DTMF signal detection device is a SLIC chip in a VoIP product in the VOIP system. The method includes at least the following S11-S14:
[0038] S11, sampling the received analog signal into a pulse code modulation (PCM) data stream;
[0039] The analog signal is sent by a terminal device, and includes a DTMF signal corresponding to a key pressed by a user on the terminal device, a noise interference signal, and a busy tone signal, a ringback tone signal, a ringing signal, and other signals. The DTMF signal is used for dialing. The DTMF signal detection device needs to process the received analog signal to identify the key value corresponding to the DTMF signal included in the analog signal.
[0040] The PCM data stream is composed of multiple PCM data frames arranged in sequence. The PCM data frame is a digital signal.
[0041] Specifically, sampling the received analog signal into a pulse code modulation (PCM) data stream includes: the DTMF signal detection device first samples the received analog signal, i.e., converts the continuously time analog signal into discrete sampling values in time; then, quantizes the sampling values, i.e., converts the continuous amplitude values obtained by sampling into a limited number of discrete values; and finally, the quantized discrete values are encoded into binary numbers for storage, transmission, and processing on a digital medium.
[0042] In some embodiments, the sampling rate can be set to 8 kHz, and the Packet Time can be set to 20 ms, i.e., each PCM data frame obtained by sampling contains 20 ms of audio data, containing 160 sample points of 8000 Hz x 0.020 s.
[0043] In some embodiments, the analog signal is received from a telephone set, and sampling the received analog signal into a pulse code modulation (PCM) data stream in S11 includes:
[0044] detecting the on-hook and off-hook state of the telephone set;
[0045] When detecting that the phone is in an off-hook state, the analog signal received to the phone is sampled into a pulse code modulation (PCM) data stream.
[0046] Further, when detecting that the phone is in an on-hook state, the analog signal is not sampled.
[0047] In the application scenario of phone key recognition, if the phone is in an on-hook state, key recognition is definitely not needed, and thus sampling of the analog signal can be stopped, thereby saving computing resources.
[0048] S12, for a current PCM data frame in the PCM data stream, determining target PCM data corresponding to the current PCM data frame based on the current PCM data frame and a preset number of historical PCM data frames before the current PCM data frame.
[0049] In some embodiments, the current PCM data frame and the preset number of historical PCM data frames before the current PCM data frame can be spliced, and the spliced PCM data corresponding to the obtained current PCM data frame is taken as the target PCM data.
[0050] The target PCM data determined according to the current PCM data frame and the preset number of historical PCM frames before the current PCM data frame in the cache is used for subsequent calculation of energy amplitudes, which can expand the detection range of the energy amplitudes, thereby further improving the key recognition accuracy.
[0051] Considering that the duration of a DTMF signal is about 90 milliseconds in general (the user presses and releases at the same time), the value of the preset number should be no more than 4, and considering that the signal energy amplitude of a specific frequency can be quickly detected, the target PCM data does not need to include a complete signal, and thus the value of the preset number can be set to any value in a range from 1 to 4.
[0052] S13, determining a maximum energy amplitude in each energy amplitude corresponding to each low-frequency frequency of a dual-tone multi-frequency (DTMF) frequency table for the target PCM data, obtaining a first energy amplitude, and determining a maximum energy amplitude in each energy amplitude corresponding to each high-frequency frequency of the DTMF frequency table for the target PCM data, obtaining a second energy amplitude.
[0053] Specifically, the low-frequency frequencies and the high-frequency frequencies in the DTMF frequency table each include four frequencies, a total of eight frequencies. For the target PCM data, the energy amplitudes of the target PCM data on the eight frequencies need to be calculated, and the maximum value of the four energy amplitudes of the target PCM data on the four low-frequency frequencies is taken as the first energy amplitude, and the maximum value of the four energy amplitudes of the target PCM data on the four high-frequency frequencies is taken as the second energy amplitude.
[0054] The method for calculating the energy amplitude of the target PCM data at each frequency in the DTMF frequency table can also use other calculation methods in addition to the scheme provided in the present application.
[0055] In one specific embodiment provided in the present application, in S13, the maximum energy amplitude among the energy amplitudes corresponding to each low frequency in the dual-tone multi-frequency DTMF frequency table of the target PCM data is determined, including:
[0056] The maximum energy amplitude among the energy amplitudes corresponding to each low frequency in the dual-tone multi-frequency DTMF frequency table of the target PCM data is determined according to the Goertzel algorithm.
[0057] Specifically, each low frequency and the target PCM data can be sequentially used as the input of the Goertzel algorithm to calculate the energy amplitude of the target PCM data at each low frequency, and the maximum value among the calculated multiple energy amplitudes is used as the first energy amplitude.
[0058] Similarly, in S13, the maximum energy amplitude among the energy amplitudes corresponding to each high frequency in the dual-tone multi-frequency DTMF frequency table of the target PCM data is determined, including:
[0059] The maximum energy amplitude among the energy amplitudes corresponding to each high frequency in the dual-tone multi-frequency DTMF frequency table of the target PCM data is determined according to the Goertzel algorithm.
[0060] Specifically, each high frequency and the target PCM data can be sequentially used as the input of the Goertzel algorithm to calculate the energy amplitude of the target PCM data at each high frequency, and the maximum value among the calculated multiple energy amplitudes is used as the second energy amplitude.
[0061] More specifically, the energy amplitudes of the target PCM data at the eight frequencies in the DTMF frequency table are calculated using the Goertzel algorithm, and the maximum value among the four energy amplitudes of the target PCM data at the four low frequencies is used as the first energy amplitude, and the maximum value among the four energy amplitudes of the target PCM data at the four high frequencies is used as the second energy amplitude.
[0062] In the scheme provided in the present application, the Goertzel algorithm is used to calculate the energy amplitude, which can quickly determine whether the signal of the target detection frequency exists in the PCM data, without the need to analyze the complete signal, and is convenient and efficient in real-time voice transmission scenarios where voice frames exist.
[0063] In some embodiments, the maximum energy amplitude among the energy amplitudes corresponding to each low frequency in the dual-tone multi-frequency DTMF frequency table of the target PCM data is determined according to the Goertzel algorithm, including:
[0064] determining the energy amplitudes corresponding to the target PCM data at each low frequency frequency and each high frequency frequency in the DTMF frequency table according to the Goertzel algorithm in parallel using multiple threads;
[0065] determining the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at each low frequency frequency.
[0066] The calculation of the energy amplitudes corresponding to the target PCM data at each high frequency frequency can also be performed in parallel.
[0067] Specifically, since the energy amplitudes of the target PCM data at eight frequencies need to be calculated respectively, and the process of calculating the energy amplitude of the target PCM data at each frequency is independent of each other, in order to avoid high latency caused by the energy amplitude calculation process, the energy amplitudes corresponding to the target PCM data at each low frequency frequency and each high frequency frequency in the DTMF frequency table according to the Goertzel algorithm can be determined in parallel using multiple threads, and the maximum value among the four energy amplitudes of the target PCM data at four low frequency frequencies is taken as the first energy amplitude, and the maximum value among the four energy amplitudes of the target PCM data at four high frequency frequencies is taken as the second energy amplitude.
[0068] S14, determining the number corresponding to the target frequency pair corresponding to the first energy amplitude and the second energy amplitude in the DTMF frequency table, the number being used to determine the key value corresponding to the analog signal.
[0069] Specifically, according to the DTMF frequency table, the number corresponding to the target frequency pair corresponding to the first energy amplitude and the second energy amplitude in the DTMF frequency table can be found, and the number is taken as the key value corresponding to the target DTMF signal included in the analog signal corresponding to the current PCM data frame.
[0070] In some embodiments, the current PCM data frame is a valid PCM data frame, and the valid PCM data frame is a PCM data frame in which the maximum energy amplitude corresponding to each low frequency frequency and each high frequency frequency in the DTMF frequency table is greater than an energy threshold, and the method further comprises the following S15:
[0071] S15, correcting the energy threshold according to the first energy amplitude and the second energy amplitude, and the corrected energy threshold being used to determine whether the next frame of PCM data frame of the current PCM data frame is a valid PCM data frame.
[0072] Specifically, after determining the first energy amplitude and the second energy amplitude corresponding to the target PCM data, the first energy amplitude and the second energy amplitude are compared with the energy threshold value respectively. When the first energy amplitude and the second energy amplitude are both greater than the energy threshold value, the current PCM data frame corresponding to the target PCM data is determined as a valid PCM data frame, i.e., the signal corresponding to the current PCM data frame is determined as a valid signal. If the first energy amplitude and the second energy amplitude are not both greater than the energy threshold value, the current PCM data frame corresponding to the target PCM data is determined as an invalid PCM data frame, i.e., the signal corresponding to the current PCM data frame is determined as an invalid signal, for example, a noise interference signal.
[0073] The energy threshold value is a self-learning threshold value, which can be corrected according to the maximum energy amplitude corresponding to the historical valid PCM data frame. The initial value of the energy threshold value is set artificially at the beginning of the algorithm, which is used to determine whether the first PCM data frame is a valid PCM data frame. The specific value of the initial value can be reasonably set by relevant personnel, and the present application does not limit this.
[0074] By continuously correcting the energy threshold value used to determine whether the PCM data frame is valid according to the true calculation result, the energy threshold value can tend to the true level, the accuracy of determining whether the PCM data frame is valid can be improved, and the accuracy of DTMF signal detection can be further improved.
[0075] In some embodiments, in S15, the energy threshold value is corrected according to the first energy amplitude and the second energy amplitude, including:
[0076] The average of the first energy amplitude, the second energy amplitude, and the maximum energy amplitude corresponding to the historical valid PCM data frame at each low frequency frequency and each high frequency frequency in the DTMF frequency table is taken as the corrected energy threshold value.
[0077] For example, if the current PCM data frame is the first PCM data frame, the target PCM data corresponding to the current PCM data frame is determined (as the current PCM data frame is the first one, the target PCM data is still the current PCM data frame itself), the maximum energy amplitudes corresponding to the target PCM data at the low frequency and the high frequency are further determined, and the two maximum energy amplitudes are compared with the current energy threshold value (which is the initial value at this time), if the two maximum energy amplitudes are greater than the current energy threshold value, the average of the two maximum energy amplitudes and the current energy threshold value (i.e. the initial value) is determined, and the average is taken as the new energy threshold value, so as to complete the correction of the energy threshold value. For example, for the next frame of PCM data frame, the target PCM data corresponding to the next frame of PCM data frame is determined, and the maximum energy amplitudes corresponding to the target PCM data at the low frequency and the high frequency are further determined, and the two maximum energy amplitudes are compared with the current energy threshold value (which has been corrected once at this time), if the two maximum energy amplitudes are greater than the current energy threshold value, the average of the two maximum energy amplitudes, the two maximum energy amplitudes corresponding to the first frame of PCM data frame and the current energy threshold value is determined, and the average is taken as the new energy amplitude, so as to complete the second correction of the energy threshold value, if the two maximum energy amplitudes are not greater than the current energy threshold value, the energy threshold value is not corrected.
[0078] In some embodiments, the method further comprises the following S16:
[0079] S16, if the energy amplitude of the previous frame of PCM data frame of the current PCM data frame at the target frequency pair is less than the energy threshold value, it is determined that the current PCM data frame corresponds to the beginning of the target DTMF signal; if the energy amplitude of the next frame of PCM data frame of the current PCM data frame at the target frequency pair is less than the energy threshold value, it is determined that the current PCM data frame corresponds to the end of the target DTMF signal.
[0080] Specifically, after determining that the current PCM data frame is a valid PCM data frame, the size relationship between the two energy amplitudes corresponding to the previous frame of PCM data frame of the current PCM data frame at the target frequency pair and the energy threshold value is judged, if the two energy amplitudes corresponding to the previous frame of PCM data frame at the target frequency pair are both less than the energy threshold value, it is determined that the current PCM data frame corresponds to the beginning of the target DTMF signal; the size relationship between the two energy amplitudes corresponding to the next frame of PCM data frame of the current PCM data frame at the target frequency pair and the energy threshold value is judged, if the two energy amplitudes corresponding to the next frame of PCM data frame at the target frequency pair are both less than the energy threshold value, it is determined that the current PCM data frame corresponds to the end of the target DTMF signal.
[0081] Further, after determining the key value corresponding to the target DTMF signal corresponding to the current PCM data frame, the key value is reported to the upper layer application to complete subsequent processing tasks according to the key value.
[0082] If it is determined that the current PCM data frame corresponds to the start or end of the target DTMF signal, the same is reported.
[0083] Figure 2 A structure diagram of a key recognition system according to an exemplary embodiment of the present application is provided, which includes:
[0084] A telephone state detection unit 21 is configured to detect the state of the telephone, and sample the received analog signal into a PCM data stream when the telephone is in an off-hook state;
[0085] A PCM data buffering unit 22 is configured to buffer a preset number of PCM data frames, and splice the latest acquired current PCM data frame to obtain target PCM data corresponding to the current PCM data frame.
[0086] A DTMF detection unit 23 is configured to calculate the energy amplitude of the target PCM data corresponding to the current PCM data frame at each frequency in a DTMF frequency table, and determine the maximum energy amplitude of the corresponding energy amplitude at the low frequency and the maximum energy amplitude of the corresponding energy amplitude at the high frequency.
[0087] An energy threshold detection and self-learning unit 24 is configured to compare the maximum energy amplitude of the corresponding energy amplitude at the low frequency and the maximum energy amplitude of the corresponding energy amplitude at the high frequency of the target PCM data corresponding to the current PCM data frame with an energy threshold, and if both maximum energy amplitudes are greater than the energy threshold, it is determined that the current PCM data frame is a valid PCM data frame, so that the target frequency pair corresponding to the two maximum energy amplitudes is taken as the key value corresponding to the target DTMF signal corresponding to the current PCM data frame, and the key value is output. Further, the energy threshold detection and self-learning unit is also configured to correct the energy threshold according to the two maximum energy amplitudes.
[0088] In some embodiments, the energy threshold detection and self-learning unit 24 is also configured to determine whether the current PCM data frame corresponds to the start or end event of the target DTMF signal corresponding to the current PCM data frame. Specifically, if the energy amplitude of the previous PCM data frame at the target frequency pair is less than the energy threshold, it is determined that the current PCM data frame corresponds to the start of the target DTMF signal; if the energy amplitude of the next PCM data frame at the target frequency pair is less than the energy threshold, it is determined that the current PCM data frame corresponds to the end of the target DTMF signal.
[0089] The execution principles and interaction processes of the constituent units in the system embodiments, such as the telephone state detection unit 21, the PCM data buffering unit 22, the DTMF detection unit 23, and the energy threshold detection and self-learning unit 24, can be referred to the description of the method embodiments as described above, and will not be described here.
[0090] The application provides a method for sampling a received analog signal into a pulse code modulation (PCM) data stream; determining, for a current PCM data frame in the PCM data stream, a target PCM data corresponding to the current PCM data frame based on the current PCM data frame and a preset number of historical PCM data frames before the current PCM data frame; determining a maximum energy amplitude in each of energy amplitudes corresponding to each low-frequency frequency in a dual-tone multi-frequency (DTMF) frequency table of the target PCM data, to obtain a first energy amplitude, and determining a maximum energy amplitude in each of energy amplitudes corresponding to each high-frequency frequency in the DTMF frequency table of the target PCM data, to obtain a second energy amplitude; determining a target frequency pair corresponding to the first energy amplitude and the second energy amplitude in the DTMF frequency table, and the target frequency pair is used to determine a scheme of a key value corresponding to the analog signal. The target PCM data determined by the current PCM data frame and the buffered multiple historical PCM data frames is used as a detection object, the maximum energy amplitudes corresponding to each low-frequency frequency and each high-frequency frequency in the DTMF frequency table of the target PCM data are calculated, and the key value corresponding to the target DTMF signal corresponding to the current PCM data frame is determined. Compared with the scheme in the related art that only determines the key value according to the maximum energy amplitudes corresponding to each low-frequency frequency and each high-frequency frequency in the DTMF frequency table of the current PCM data frame, the target PCM data determined according to the current PCM data frame and the multiple historical PCM data frames is used as the detection object, more information of the target DTMF signal corresponding to the current PCM data frame can be provided, the detection range is expanded, the calculation error of the energy amplitude is reduced, and the technical effect of improving the accuracy of identifying the key value corresponding to the target DTMF signal corresponding to the current PCM data frame in the analog signal is achieved.
[0091] Figure 3 A structural schematic diagram of a key recognition device provided for an exemplary embodiment of the application;
[0092] The device comprises:
[0093] The sampling unit 31 is configured to sample the received analog signal into a pulse code modulation (PCM) data stream.
[0094] The target PCM data determination unit 32 is configured to determine target PCM data corresponding to a current PCM data frame in the PCM data stream based on the current PCM data frame and historical PCM data frames of a preset number of frames before the current PCM data frame.
[0095] The maximum energy amplitude determination unit 33 is configured to determine a maximum energy amplitude of each of energy amplitudes corresponding to the target PCM data at each low-frequency frequency in a dual-tone multi-frequency (DTMF) frequency table, to obtain a first energy amplitude, and determine a maximum energy amplitude of each of energy amplitudes corresponding to the target PCM data at each high-frequency frequency in the DTMF frequency table, to obtain a second energy amplitude.
[0096] The key value identification unit 34 is configured to determine a number corresponding to a target frequency pair of the first energy amplitude and the second energy amplitude in the DTMF frequency table, and the number is used to determine a key value corresponding to the analog signal.
[0097] In some embodiments, the current PCM data frame is a valid PCM data frame, and the valid PCM data frame is a PCM data frame in which a maximum energy amplitude corresponding to each low-frequency frequency and each high-frequency frequency in a DTMF frequency table is greater than an energy threshold.
[0098] The apparatus is further configured to:
[0099] The energy threshold is corrected according to the first energy amplitude and the second energy amplitude, and the corrected energy threshold is used to determine whether a next frame of PCM data frame of the current PCM data frame is a valid PCM data frame.
[0100] In some embodiments, the apparatus is further configured to:
[0101] If an energy amplitude of a previous frame of PCM data frame of the current PCM data frame at the target frequency pair is less than the energy threshold, it is determined that the current PCM data frame corresponds to a start of the target DTMF signal.
[0102] If an energy amplitude of a next frame of PCM data frame of the current PCM data frame at the target frequency pair is less than the energy threshold, it is determined that the current PCM data frame corresponds to an end of the target DTMF signal.
[0103] In some embodiments, when the apparatus is configured to correct the energy threshold according to the first energy amplitude and the second energy amplitude, the apparatus is specifically configured to:
[0104] The average of the first energy amplitude, the second energy amplitude, and the maximum energy amplitude of each low frequency in the DTMF frequency table corresponding to the historical valid PCM data is taken as the corrected energy threshold.
[0105] In some embodiments, the analog signal is received from a telephone set, and the apparatus is configured to sample the received analog signal into a pulse code modulation (PCM) data stream, in particular by:
[0106] detecting an on-hook or off-hook state of the telephone set;
[0107] sampling the analog signal received from the telephone set into a pulse code modulation (PCM) data stream when the telephone set is detected in the off-hook state.
[0108] In some embodiments, the apparatus is configured to determine the maximum energy amplitude of each energy amplitude of each low frequency in the dual-tone multi-frequency (DTMF) frequency table corresponding to the target PCM data, in particular by:
[0109] determining the maximum energy amplitude of each energy amplitude of each low frequency in the dual-tone multi-frequency (DTMF) frequency table corresponding to the target PCM data according to the Goertzel algorithm.
[0110] In some embodiments, the apparatus is configured to determine the maximum energy amplitude of each energy amplitude of each low frequency in the dual-tone multi-frequency (DTMF) frequency table corresponding to the target PCM data according to the Goertzel algorithm, in particular by:
[0111] determining the maximum energy amplitude of each energy amplitude of each low frequency in the dual-tone multi-frequency (DTMF) frequency table corresponding to the target PCM data according to the Goertzel algorithm using multiple threads in parallel;
[0112] determining the maximum energy amplitude of each energy amplitude of each low frequency in the dual-tone multi-frequency (DTMF) frequency table corresponding to the target PCM data.
[0113] It should be understood that the apparatus embodiments and the method embodiments can correspond to each other, and similar descriptions can be referred to the method embodiments. To avoid repetition, no further description is given here. Specifically, the apparatus can perform the above-mentioned method embodiments, and the foregoing and other operations and / or functions of each module in the apparatus are respectively for the corresponding flow in each method in the above-mentioned method embodiments, and for the sake of brevity, no further description is given here.
[0114] The device of the embodiments of the present application is described above from the perspective of functional modules in combination with the drawings. It should be understood that the functional modules can be implemented in the form of hardware, or in the form of instructions of software, or in the form of a combination of hardware and software modules. Specifically, the steps of the method embodiments in the embodiments of the present application can be completed by the integrated logic circuit of hardware in the processor and / or instructions of software. The steps of the method disclosed in the embodiments of the present application can be directly embodied as hardware code processing for execution by the processor, or can be executed by a combination of hardware and software modules in the code processing. Alternatively, the software module can be located in a mature storage medium in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, and the like. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method embodiments in combination with the hardware thereof.
[0115] Figure 4 is a schematic block diagram of an electronic device provided by the embodiments of the present application, which can include:
[0116] The memory 401 is used to store a computer program and transmit the program code to the processor 402. In other words, the processor 402 can call and run the computer program from the memory 401 to implement the method in the embodiments of the present application.
[0117] For example, the processor 402 can be used to execute the above method embodiments according to the instructions in the computer program.
[0118] In some embodiments of the present application, the processor 402 can include but is not limited to:
[0119] A general processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and the like.
[0120] In some embodiments of the present application, the memory 401 includes but is not limited to:
[0121] The non-volatile memory can be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a Random Access Memory (RAM) used as an external cache. By way of example, and not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
[0122] In some embodiments of the present application, the computer program can be divided into one or more modules, which are stored in the memory 401 and executed by the processor 402 to complete the method provided by the present application. The one or more modules can be a series of computer program instruction segments capable of completing a specific function, which are used to describe the execution process of the computer program in the electronic device.
[0123] As shown in Figure 4 The electronic device can further include:
[0124] The transceiver 403 can be connected to the processor 402 or the memory 401.
[0125] The processor 402 can control the transceiver 403 to communicate with other devices, specifically, can send information or data to other devices, or receive information or data sent by other devices. The transceiver 403 can include a transmitter and a receiver. The transceiver 403 can further include an antenna, and the number of antennas can be one or more.
[0126] It should be understood that the various components within the electronic device are connected via a bus system, which includes, in addition to a data bus, a power supply bus, a control bus, and a state signal bus.
[0127] The application also provides a computer storage medium, which stores a computer program, and the computer program enables a computer to execute the method of the method embodiment when executed by the computer. Alternatively, the application embodiment also provides a computer program product containing instructions, and the instructions enable the computer to execute the method of the method embodiment when executed by the computer.
[0128] When implemented by using software, the computer program product can be implemented in the form of a computer program product in whole or in part. The computer program product includes one or more computer instructions. When loaded and executed by a computer, the computer program instructions produce the flow or function of the embodiment of the application in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through a wired (for example, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (for example, infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. containing one or more available media sets. The available medium can be a magnetic medium (for example, floppy disk, hard disk, magnetic tape), an optical medium (for example, digital video disc (DVD)), or a semiconductor medium (for example, solid state disk (SSD)) and the like.
[0129] Those skilled in the art can realize that the modules and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the application.
[0130] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other manners. For example, the described device embodiments are merely illustrative. For example, the division of the modules is merely logical function division. An actual implementation can be another division manner, for example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or modules, and can be in electrical, mechanical or other forms.
[0131] The modules illustrated as separated components can or can not be physically separated, and the components illustrated as modules can be or can not be physical modules, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments. For example, the functional modules in the embodiments of the present application can be integrated into a processing module, or each module can be physically present separately, or two or more modules can be integrated into one module.
[0132] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined target, and can be implemented entirely or partially by using software, hardware (such as a processing circuit or a memory) or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that includes the functions of the module or unit.
[0133] The above merely provides a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A key recognition method characterized by, The method comprises: sampling the received analog signal into a pulse code modulation (PCM) data stream; for a current PCM data frame in the PCM data stream, splicing the current PCM data frame with a preset number of historical PCM data frames before the current PCM data frame to obtain spliced PCM data, and taking the spliced PCM data as target PCM data corresponding to the current PCM data frame; determining a maximum energy amplitude among energy amplitudes corresponding to each low frequency in a dual-tone multi-frequency (DTMF) frequency table for the target PCM data, to obtain a first energy amplitude, and determining a maximum energy amplitude among energy amplitudes corresponding to each high frequency in the DTMF frequency table for the target PCM data, to obtain a second energy amplitude; determining a number corresponding to a target frequency pair corresponding to the first energy amplitude and the second energy amplitude in the DTMF frequency table, the number being used to determine a key value corresponding to the analog signal.
2. The method according to claim 1, characterized in that The current PCM data frame is a valid PCM data frame, and the valid PCM data frame is a PCM data frame in which maximum energy amplitudes corresponding to each low frequency and each high frequency in a DTMF frequency table are greater than an energy threshold value, The method further comprises: correcting the energy threshold value according to the first energy amplitude and the second energy amplitude, and taking the corrected energy threshold value to determine whether a next frame of PCM data frame of the current PCM data frame is a valid PCM data frame.
3. The method of claim 2, wherein, The method further comprises: if an energy amplitude of a previous frame of PCM data frame of the current PCM data frame on the target frequency pair is less than the energy threshold value, determining that the current PCM data frame corresponds to a start of a target DTMF signal; if an energy amplitude of a next frame of PCM data frame of the current PCM data frame on the target frequency pair is less than the energy threshold value, determining that the current PCM data frame corresponds to an end of the target DTMF signal.
4. The method according to claim 2, characterized in that The method further comprises: correcting the energy threshold value according to the first energy amplitude and the second energy amplitude, and taking an average of the first energy amplitude, the second energy amplitude, and maximum energy amplitudes corresponding to each low frequency and each high frequency in a DTMF frequency table of historical valid PCM data frames as the corrected energy threshold value.
5. The method of claim 1, wherein, The analog signal is received from a telephone set, and sampling the received analog signal into a pulse code modulation (PCM) data stream comprises: detecting an on-hook or off-hook state of the telephone set; when detecting that the telephone set is in the off-hook state, sampling an analog signal received from the telephone set into a pulse code modulation (PCM) data stream.
6. The method of claim 1, wherein, The method further comprises: determining the maximum energy amplitude among the energy amplitudes corresponding to each low frequency in the DTMF frequency table for the target PCM data according to the Goertzel algorithm.
7. The method of claim 6, wherein, The method further comprises: determining the maximum energy amplitude among the energy amplitudes corresponding to each low frequency in the DTMF frequency table for the target PCM data according to the Goertzel algorithm. determining a maximum energy amplitude among the respective energy amplitudes corresponding to the target PCM data at the respective low-frequency frequencies in a dual-tone multi-frequency (DTMF) frequency table; determining a maximum energy amplitude among the respective energy amplitudes corresponding to the target PCM data at the respective low-frequency frequencies.
8. A key recognition device, characterized by comprising: The method comprises: sampling a received analog signal into a pulse code modulation (PCM) data stream; determining, for a current PCM data frame in the PCM data stream, target PCM data corresponding to the current PCM data frame by splicing the current PCM data frame with a preset number of historical PCM data frames preceding the current PCM data frame; determining a maximum energy amplitude among the respective energy amplitudes corresponding to the target PCM data at the respective low-frequency frequencies in a dual-tone multi-frequency (DTMF) frequency table, obtaining a first energy amplitude, and determining a maximum energy amplitude among the respective energy amplitudes corresponding to the target PCM data at the respective high-frequency frequencies in the DTMF frequency table, obtaining a second energy amplitude; determining a target frequency pair corresponding to the first energy amplitude and the second energy amplitude in the DTMF frequency table, the target frequency pair being used to determine a key value corresponding to the analog signal.
9. An electronic device, comprising: The method comprises: a processor; and a memory storing executable instructions of the processor; wherein the processor is configured to execute the executable instructions to perform the method of any one of claims 1-7. The computer program, when executed by a processor, implements the method of any one of claims 1-7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that,
Citation Information
Patent Citations
Dual-tone multi-frequency detection method, system, medium and equipment
CN114582374A
Dial detection method and device in dual-tone multiband transmission scene and electronic equipment
CN114979814A