Key identification method and device, equipment and medium
By sampling and processing DTMF signals, combining the information of current and multi-frame historical data frames, the maximum energy amplitude is calculated in the DTMF frequency table, which solves the problem of low detection accuracy of DTMF signal in the prior art and improves the accuracy of key recognition sex.
Patent Information
- Application Number
- CN202411182394.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-08-26
AI Technical Summary
In the prior art, the accuracy of DTMF signal detection is poor, resulting in low accuracy of the key recognition method.
By sampling the analog signal for pulse code modulation PCM data stream, the target PCM data is determined in combination with the current and multi-frame historical data frames, the maximum energy amplitude of low and high frequency frequencies is calculated in the DTMF frequency table, and the corresponding key key value is determined.
It improves the accuracy of DTMF signal detection, reduces the energy amplitude calculation error, and enhances the accuracy of key recognition.
Smart Images

Figure CN119299018A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and in particular, relates to a key recognition method, device, equipment and medium. Background Art
[0002] Dual-Tone Multi-Frequency (DTMF) technology is an in-band communication signal transmitted between a telephone device and other communication equipment and a switching center on a telephone line through an audio frequency band. It is usually used to quickly and reliably transmit telephone numbers. DTMF signal detection (i.e., terminal device key recognition) has also become an important part of various business implementations. DTMF signals are composed of two audio signals of different frequencies superimposed. 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. DTMF signal detection is used to detect key or digital information. The key recognition method in the related art has poor accuracy. Summary of the invention
[0003] The embodiment of the present application provides 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] The received analog signal is sampled into a pulse code modulated PCM data stream;
[0006] 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;
[0007] Determine the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at each low frequency in the dual-tone multi-frequency DTMF frequency table to obtain a first energy amplitude, determine the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at each high frequency in the DTMF frequency table to obtain a second energy amplitude;
[0008] Determine a number corresponding to a target frequency pair corresponding to the first energy amplitude and the second energy amplitude in the DTMF frequency table, wherein the number is 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, used for sampling the received analog signal into a pulse code modulation PCM data stream;
[0011] a target PCM data determining unit, configured to determine, for a current PCM data frame in the PCM data stream, 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;
[0012] A maximum energy amplitude determination unit is used to determine the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at the low frequencies in the dual-tone multi-frequency (DTMF) frequency table to obtain a first energy amplitude, and to determine the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at the high frequencies in the DTMF frequency table to obtain a second energy amplitude;
[0013] The key value recognition unit is used to determine the corresponding number of the target frequency pair corresponding to the first energy amplitude and the second energy amplitude in the DTMF frequency table, and the number is used to determine the key value of the key corresponding to the analog signal.
[0014] In a third aspect, the present application provides an electronic device, including:
[0015] Processor; and
[0016] A memory, configured to store executable instructions of the processor;
[0017] The processor is configured to execute the first aspect, or any method in any possible implementation manner of the first aspect, by executing the executable instructions.
[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the computer program implements the first aspect, or any method in any possible implementation manner of the first aspect.
[0019] The present application provides a method for sampling a received analog signal into a pulse code modulated PCM data stream; for a current PCM data frame in the PCM data stream, determining the 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 the maximum energy amplitude among various energy amplitudes corresponding to the target PCM data at various low frequencies in a dual-tone multi-frequency DTMF frequency table to obtain a first energy amplitude, determining the maximum energy amplitude among various energy amplitudes corresponding to the target PCM data at various high frequencies in the DTMF frequency table to obtain a second energy amplitude; determining the corresponding numbers of the target frequency pairs corresponding to the first energy amplitude and the second energy amplitude in the DTMF frequency table, the numbers being used to determine the key value corresponding to the analog signal, comparing the current PCM data frame with the cached The target PCM data determined by multiple frames of historical PCM data frames is used as the detection object, and the key value corresponding to the target DTMF signal corresponding to the current PCM data frame is determined by calculating the maximum energy amplitude corresponding to each low-frequency frequency and each high-frequency frequency in the DTMF frequency table of the target PCM data. Compared with the scheme in the related art that only determines the key value according to the maximum energy amplitude corresponding to each low-frequency frequency and each high-frequency frequency in the DTMF frequency table of the current PCM data frame, using the target PCM data determined according to the current PCM data frame and multiple frames of historical PCM data frames as the detection object can provide more information on the target DTMF signal corresponding to the current PCM data frame, expand the detection range, thereby reducing the calculation error of the energy amplitude, and thus achieving 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. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following is a brief introduction to the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0021] Figure 1 A flowchart of a key recognition method provided in one embodiment of the present application;
[0022] Figure 2 A structural diagram of a key recognition system provided in one embodiment of the present application;
[0023] Figure 3 A schematic diagram of the structure of a key recognition device provided in one embodiment of the present application;
[0024] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, but cannot be understood as limiting the present application.
[0026] The terms "first" and "second" etc. in the specification, claims and drawings of the embodiments of the present application are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that this scheme is implemented in other orders in addition to the order illustrated or described in the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0027] First, some terms in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.
[0028] DTMF signals consist of two different frequency sound signals, a low frequency signal and a high frequency signal, which are transmitted through telephone lines or other communication channels to dial telephone numbers or issue commands to switching systems. The high frequency group contains four tone signals with frequencies of 1209Hz, 1336Hz, 1477Hz and 1633Hz; the low frequency group also contains four tone signals with frequencies of 697Hz, 770Hz, 852Hz and 941Hz. In this way, by combining the signals in these 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 are the details of the DTMF frequency table:
[0030]
[0031]
[0032] PCM (Pulse Code Modulation) data is a type of data generated using PCM technology. PCM technology is a method of converting analog signals into digital signals, including three key steps: sampling, quantization, and encoding.
[0033] SLIC (Subscriber Line Interface Circuit) chip plays a vital role in communication systems, especially telephone communication networks. It is 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 calls. Its main functions include receiving analog signals from telephone lines, converting them into digital signals, and implementing call functions such as audio amplification, noise suppression and call transfer through digital signal processing and call control. In addition, the SLIC chip can also convert the processed digital signals back into analog signals and send them to the telephone lines.
[0034] In order to use DTMF signals, the device needs to be able to detect and decode these signals. The detection of DTMF signals usually involves the processing and frequency analysis of audio signals. The decoder analyzes the received audio signal, finds the low-frequency and high-frequency components, and maps them to corresponding numbers, letters or special characters. However, the accuracy of DTMF signal detection in related technologies is poor.
[0035] In order to solve this technical problem, the present application provides a key recognition method, device, equipment and medium, which are used to solve the technical problem of poor accuracy of DTMF signal detection in the related art.
[0036] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are 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 repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0037] Figure 1A flow chart of a key recognition method provided for an exemplary embodiment of the present application, the method can be applied to a DTMF signal detection device, the DTMF signal detection device can be used in a communication device or system based on a DTMF signal detection technology, the communication device or system based on the DTMF signal detection technology, for example, includes an automatic voice response system (IVR), a door control system, a voice mail system, a remote control device, a telephone bank and an 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, and the method at least includes 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 the terminal device, and includes the DTMF signal corresponding to the key, a noise interference signal, and other signals such as a busy tone signal, a ringback tone signal, and a ringing signal generated when the user presses a key on the terminal device. The DTMF signal is used for dialing, and the DTMF signal detection device needs to process the received analog signal and 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, and the PCM data frames are digital signals.
[0041] Specifically, the received analog signal is sampled into a pulse code modulation PCM data stream, including: the DTMF signal detection device first samples the received analog signal, that is, converts the temporally continuous analog signal into temporally discrete sampling values; then, these sampling values are quantized, that is, converts the sampled continuous amplitude values into a finite number of discrete values; finally, the quantized discrete values are encoded into binary numbers for storage, transmission and processing on digital media.
[0042] In some embodiments, the sampling rate may be set to 8 kHz, and the Packet Time may be set to 20 ms, that is, each PCM data frame obtained by sampling contains 20 ms of audio data, including 8000 Hz×0.020 s=160 sample points.
[0043] In some embodiments, the analog signal is received from a telephone set, and in S11, the received analog signal is sampled into a pulse code modulation PCM data stream, including:
[0044] Detect the on / off status of the phone;
[0045] When it is detected that the telephone is in the off-hook state, the analog signal received to the telephone is sampled as a pulse code modulation PCM data stream.
[0046] Further, when it is detected that the telephone is in the on-hook state, the analog signal is not sampled.
[0047] When the application scenario is telephone key recognition, if the telephone is in an on-hook state, key recognition is definitely not required, so the 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 may be spliced with a preset number of historical PCM data frames before the current PCM data frame, and the spliced PCM data corresponding to the obtained current PCM data frame may be used as the target PCM data.
[0050] The target PCM data determined based on the current PCM data frame and the cached historical PCM frames a preset number of frames before the current PCM data frame is used for subsequent energy amplitude calculation, which can expand the detection range of the energy amplitude and further improve the key recognition accuracy.
[0051] Considering that under normal circumstances (when the user presses and releases the button), the duration of a DTMF signal is about 90 milliseconds, the value of the preset number should not be greater than 4. In addition, considering that the signal energy amplitude of a specific frequency can be quickly detected, the input target PCM data does not need to contain a complete signal, so the value of the preset number can be set to any value between 1 and 4.
[0052] S13, determining the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at each low frequency in the dual-tone multi-frequency DTMF frequency table, obtaining a first energy amplitude, determining the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at each high frequency in the DTMF frequency table, obtaining a second energy amplitude;
[0053] Specifically, the DTMF frequency table includes four low-frequency frequencies and four high-frequency frequencies, totaling eight frequencies. For the target PCM data, it is necessary to calculate the energy amplitudes of the target PCM data at the eight frequencies respectively, and take the maximum value of the four energy amplitudes of the target PCM data at the four low-frequency frequencies as the first energy amplitude, and take the maximum value of the four energy amplitudes of the target PCM data at the four high-frequency frequencies as the second energy amplitude.
[0054] Among them, the method for calculating the energy amplitude of the target PCM data at each frequency in the DTMF frequency table may adopt other calculation methods besides the solution provided in the present application.
[0055] In a specific embodiment provided in the present application, in S13, determining the maximum energy amplitude among various energy amplitudes corresponding to various low-frequency frequencies in the dual-tone multi-frequency DTMF frequency table of the target PCM data includes:
[0056] The maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at the respective low-frequency frequencies in the dual-tone multi-frequency DTMF frequency table is determined according to the Goertzel algorithm.
[0057] Specifically, each low frequency and target PCM data may be used as input of the Goertzel algorithm in turn, the energy amplitude of the target PCM data at each low frequency may be calculated, and the maximum value of the calculated multiple energy amplitudes may be used as the first energy amplitude.
[0058] Similarly, in S13, determining the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at the high frequency frequencies in the DTMF frequency table includes:
[0059] The maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at the various high-frequency frequencies in the dual-tone multi-frequency DTMF frequency table is determined according to the Goertzel algorithm.
[0060] Specifically, each high frequency and target PCM data may be used as input of the Goertzel algorithm in sequence, the energy amplitude of the target PCM data at each high frequency may be calculated, and the maximum value of the calculated multiple energy amplitudes may be used as the second energy amplitude.
[0061] More specifically, the Goertzel algorithm is used to calculate the energy amplitudes of the target PCM data at the eight frequencies in the DTMF frequency table respectively, and the maximum value of the four energy amplitudes of the target PCM data at the four low-frequency frequencies is used as the first energy amplitude, and the maximum value of the four energy amplitudes of the target PCM data at the four high-frequency frequencies is used as the second energy amplitude.
[0062] In the solution provided in the present application, the Goertzel algorithm is used when calculating the energy amplitude, which can quickly determine whether there is a signal of the target detection frequency in the PCM data without analyzing the complete signal. It is convenient and efficient to use in real-time voice transmission scenarios where voice frames exist.
[0063] In some embodiments, determining the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at the respective low-frequency frequencies in the dual-tone multi-frequency DTMF frequency table according to the Goertzel algorithm includes:
[0064] Using multiple threads to execute in parallel, according to the Goertzel algorithm, the energy amplitude corresponding to each low frequency and the energy amplitude corresponding to each high frequency of the target PCM data in the dual-tone multi-frequency DTMF frequency table are determined;
[0065] Determine the maximum energy amplitude among various energy amplitudes corresponding to the target PCM data at various low-frequency frequencies.
[0066] The calculation of each energy amplitude corresponding to each high frequency frequency of the target PCM data can also be performed in parallel.
[0067] Specifically, since the energy amplitudes of the target PCM data at eight frequencies need to be calculated separately, 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 delay caused by the energy amplitude calculation process, multiple threads can be used to execute in parallel to determine the energy amplitudes corresponding to each low-frequency frequency and the energy amplitudes corresponding to each high-frequency frequency in the DTMF frequency table according to the Goertzel algorithm, and further take the maximum value of the four energy amplitudes of the target PCM data at the four low-frequency frequencies as the first energy amplitude, and take the maximum value of the four energy amplitudes of the target PCM data at the four high-frequency frequencies as the second energy amplitude.
[0068] S14, determining the corresponding number of the target frequency pair corresponding to the first energy amplitude and the second energy amplitude in the DTMF frequency table, the number is used to determine the key value corresponding to the analog signal.
[0069] Specifically, according to the DTMF frequency table, the corresponding number of 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 used as the key value corresponding to the target DTMF signal corresponding to the current PCM data frame included in the analog signal.
[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 whose maximum energy amplitude corresponding to each low frequency and each high frequency in the DTMF frequency table is greater than the energy threshold, and the method further includes the following S15:
[0071] S15. Correct the energy threshold according to the first energy amplitude and the second energy amplitude. The corrected energy threshold is used to determine whether the next 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 will be compared with the energy threshold respectively. When the first energy amplitude and the second energy amplitude are both greater than the energy threshold, the current PCM data frame corresponding to the target PCM data is regarded as a valid PCM data frame, that is, the signal corresponding to the current PCM data frame is determined to be a valid signal; if the first energy amplitude and the second energy amplitude are not both greater than the energy threshold, the current PCM data frame corresponding to the target PCM data is determined to be an invalid PCM data frame, that is, the signal corresponding to the current PCM data frame is determined to be an invalid signal, such as a noise interference signal.
[0073] The energy threshold 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 algorithm will manually set the initial value of the energy threshold at the beginning 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 this application does not impose any restrictions on this.
[0074] By continuously correcting the energy threshold used to determine whether the PCM data frame is valid according to the actual calculation result, the energy threshold can be made closer to the actual level, thereby improving the accuracy of determining whether the PCM data frame is valid and further improving the accuracy of DTMF signal detection.
[0075] In some embodiments, in S15, the energy threshold is corrected according to the first energy amplitude and the second energy amplitude, including:
[0076] The first energy amplitude, the second energy amplitude, and the average value of the maximum energy amplitudes corresponding to each low frequency and each high frequency in the DTMF frequency table of the historical valid PCM data frame are used as the corrected energy threshold.
[0077] For example, if the current PCM data frame is the first PCM data frame, determine the target PCM data corresponding to the current PCM data frame (since the current PCM data frame is the first one, the target PCM data is still the current PCM data frame itself), further determine the maximum energy amplitudes corresponding to the target PCM data at the low frequency and high frequency respectively, and compare these two maximum energy amplitudes with the current energy threshold (this is the initial value). If the two maximum energy amplitudes are greater than the current energy threshold, the average value of the two maximum energy amplitudes and the current energy threshold (ie, the initial value) is determined, and the average value is used as the new energy threshold, thereby completing the correction of the energy threshold. For another example, for the next frame of PCM data, the target PCM data corresponding to the next frame of PCM data 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 (which has been corrected once at this time). If the two maximum energy amplitudes are greater than the current energy threshold, the average value of the two maximum energy amplitudes, the two maximum energy amplitudes corresponding to the first frame of PCM data and the current energy threshold is determined, and the average value is used as the new energy amplitude, thereby completing the second correction of the energy threshold. If the two maximum energy amplitudes are not greater than the current energy threshold, the energy threshold is not corrected.
[0078] In some embodiments, the method further includes the following S16:
[0079] S16. 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 beginning 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.
[0080] Specifically, after determining that the current PCM data frame is a valid PCM data frame, the relationship between the two energy amplitudes corresponding to the previous PCM data frame at the target frequency pair and the energy threshold will be determined for the previous PCM data frame of the current PCM data frame. If the two energy amplitudes corresponding to the previous PCM data frame at the target frequency pair are both smaller than the energy threshold, it can be determined that the current PCM data frame corresponds to the beginning of the target DTMF signal; for the next PCM data frame of the current PCM data frame, the relationship between the two energy amplitudes corresponding to the next PCM data frame at the target frequency pair and the energy threshold will be determined. If the two energy amplitudes corresponding to the next PCM data frame at the target frequency pair are both smaller than the energy threshold, it can be 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 may be reported so that the upper layer application completes subsequent event 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, it will also be reported.
[0083] Figure 2 A structural diagram of a key recognition system provided by an exemplary embodiment of the present application, the structure includes:
[0084] The telephone state detection unit 21 is used to detect the state of the telephone. When it is detected that the telephone is in an off-hook state, the received analog signal is sampled as a PCM data stream;
[0085] A PCM data buffer unit 22, used for buffering a preset number of PCM data frames, for splicing with the latest acquired current PCM data frame to obtain target PCM data corresponding to the current PCM data frame;
[0086] The DTMF detection unit 23 is used to calculate the energy amplitude of the target PCM data corresponding to the current PCM data frame at each frequency in the DTMF frequency table, and determine the maximum value of the energy amplitude corresponding to the low frequency and the maximum value of the energy amplitude corresponding to the high frequency;
[0087] The energy threshold detection and self-learning unit 24 is used to compare the maximum energy amplitude of the energy amplitude corresponding to the target PCM data corresponding to the current PCM data frame at the low frequency and the maximum energy amplitude of the energy amplitude corresponding to the high frequency with the energy threshold. If both maximum energy amplitudes are greater than the energy threshold, the current PCM data frame can be judged as a valid PCM data frame, so that the corresponding numbers of the target frequency pairs corresponding to the two maximum energy amplitudes in the DTMF frequency table are used as the key values corresponding to the target DTMF signal corresponding to the current PCM data frame, and the key values are output; further, the energy threshold detection and self-learning unit is also used 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 used 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 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 the start of the target DTMF signal; if the energy amplitude of the next 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 the end of the target DTMF signal.
[0089] The execution principles and interaction processes of the various components in the system embodiment, such as the phone state detection unit 21, the PCM data cache unit 22, the DTMF detection unit 23, and the energy threshold detection and self-learning unit 24, can be found in the description of the above method embodiment and will not be repeated here.
[0090] The present application provides a method for sampling a received analog signal into a pulse code modulated PCM data stream; for a current PCM data frame in the PCM data stream, determining the target PCM data corresponding to the current PCM data frame based on the current PCM data frame and the historical PCM data frames of a preset number of frames before the current PCM data frame; determining the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at each low frequency in a dual-tone multi-frequency DTMF frequency table to obtain a first energy amplitude, determining the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at each high frequency in the DTMF frequency table to obtain a second energy amplitude; determining the corresponding numbers of the target frequency pairs corresponding to the first energy amplitude and the second energy amplitude in the DTMF frequency table, the numbers being used to determine the key value corresponding to the analog signal, and comparing the current PCM data frame with the cached data. The target PCM data determined by multiple frames of historical PCM data frames is used as the detection object, and the key value corresponding to the target DTMF signal corresponding to the current PCM data frame is determined by calculating 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. 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 current PCM data frame in the DTMF frequency table, using the target PCM data determined according to the current PCM data frame and multiple frames of historical PCM data frames as the detection object can provide more information on the target DTMF signal corresponding to the current PCM data frame, expand the detection range, thereby reducing the calculation error of the energy amplitude, and thus achieving 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.
[0091] Figure 3 A structural schematic diagram of a key recognition device provided by an exemplary embodiment of the present application;
[0092] The device comprises:
[0093] The sampling unit 31 is used to sample the received analog signal into a pulse code modulation PCM data stream;
[0094] A target PCM data determining unit 32 is used to determine, for a current PCM data frame in the PCM data stream, 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;
[0095] The maximum energy amplitude determination unit 33 is used to determine the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at the low frequencies in the dual-tone multi-frequency (DTMF) frequency table to obtain a first energy amplitude, and to determine the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at the high frequencies in the DTMF frequency table to obtain a second energy amplitude;
[0096] The key value recognition unit 34 is used to determine the corresponding number of the target frequency pair corresponding to the first energy amplitude and the second energy amplitude in the DTMF frequency table, and the number is used to determine the key value of the key 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 whose maximum energy amplitude corresponding to each low frequency and each high frequency in the DTMF frequency table is greater than an energy threshold.
[0098] The device is also used for:
[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 PCM data frame next to the current PCM data frame is a valid PCM data frame.
[0100] In some embodiments, the device is further used to:
[0101] If the energy amplitude of the previous PCM data frame of the current PCM data frame on the target frequency pair is less than the energy threshold, determining that the current PCM data frame corresponds to the beginning of the target DTMF signal;
[0102] If the energy amplitude of the subsequent 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 the end of the target DTMF signal.
[0103] In some embodiments, when the device is used to modify the energy threshold according to the first energy amplitude and the second energy amplitude, it is specifically used to:
[0104] The first energy amplitude, the second energy amplitude, and an average value of maximum energy amplitudes corresponding to each low frequency and each high frequency of historical valid PCM data in the DTMF frequency table are used as the corrected energy threshold.
[0105] In some embodiments, the analog signal is received from a telephone, and the apparatus, when used to sample the received analog signal into a pulse code modulation (PCM) data stream, is specifically used to:
[0106] Detecting the on-hook and off-hook status of the telephone;
[0107] When it is detected that the telephone is in an off-hook state, the analog signal received from the telephone is sampled as a pulse code modulation PCM data stream.
[0108] In some embodiments, when the device is used to determine the maximum energy amplitude of each energy amplitude corresponding to each low frequency frequency in the dual-tone multi-frequency DTMF frequency table of the target PCM data, it is specifically used to:
[0109] The maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at the respective low-frequency frequencies in the dual-tone multi-frequency (DTMF) frequency table is determined according to the Goertzel algorithm.
[0110] In some embodiments, when the device is used to determine the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at each low frequency in the dual-tone multi-frequency DTMF frequency table according to the Goertzel algorithm, it is specifically used to:
[0111] Using multiple threads to execute in parallel according to the Goertzel algorithm to determine the energy amplitudes corresponding to the target PCM data at the respective low-frequency frequencies in the dual-tone multi-frequency DTMF frequency table;
[0112] The maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at the low-frequency frequencies is determined.
[0113] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, no further description is given here. Specifically, the device may perform the above method embodiment, and the above and other operations and / or functions of each module in the device are the corresponding processes in each method in the above method embodiment, respectively, and no further description is given here for the sake of brevity.
[0114] The above describes the device of the embodiment of the present application from the perspective of the functional module in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in hardware form, can be implemented by instructions in software form, and can also be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software form instructions in the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or a combination of hardware and software modules in the decoding processor to perform. Optionally, the software module can be located in a mature storage medium in the field 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, etc. The storage medium is located in a memory, and the processor reads the information in the memory, and completes the steps in the above method embodiment in conjunction with its hardware.
[0115] Figure 4 is a schematic block diagram of an electronic device provided in an embodiment of the present application, and the electronic device may include:
[0116] The memory 401 and the processor 402, the memory 401 is used to store the 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 embodiment of the present application.
[0117] For example, the processor 402 may be configured to execute the above method embodiments according to instructions in the computer program.
[0118] In some embodiments of the present application, the processor 402 may include but is not limited to:
[0119] General-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
[0120] In some embodiments of the present application, the memory 401 includes but is not limited to:
[0121] Volatile memory and / or non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM) or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DR RAM).
[0122] In some embodiments of the present application, the computer program may 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 may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device.
[0123] like Figure 4 As shown, the electronic device may also include:
[0124] The transceiver 403 may be connected to the processor 402 or the memory 401 .
[0125] The processor 402 may control the transceiver 403 to communicate with other devices, specifically, to send information or data to other devices, or to receive information or data sent by other devices. The transceiver 403 may include a transmitter and a receiver. The transceiver 403 may further include an antenna, and the number of antennas may be one or more.
[0126] It should be understood that the various components in the electronic device are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.
[0127] The present application also provides a computer storage medium on which a computer program is stored, and when the computer program is executed by a computer, the computer can perform the method of the above method embodiment. In other words, the present application embodiment also provides a computer program product containing instructions, and when the instructions are executed by a computer, the computer can perform the method of the above method embodiment.
[0128] When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated 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 a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (digital video disc, DVD)), or a semiconductor medium (e.g., a solid state drive (solid state disk, SSD)), etc.
[0129] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0130] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the module is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0131] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. For example, each functional module in each embodiment of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may 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 goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a 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 part of an overall module or unit that includes the function of the module or unit.
[0133] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A key recognition method, characterized in that: include: The received analog signal is sampled into a pulse code modulated 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; Determine the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at each low frequency in the dual-tone multi-frequency DTMF frequency table to obtain a first energy amplitude, determine the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at each high frequency in the DTMF frequency table to obtain a second energy amplitude; Determine a number corresponding to a target frequency pair corresponding to the first energy amplitude and the second energy amplitude in the DTMF frequency table, wherein the number is 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 whose maximum energy amplitude corresponding to each low frequency and each high frequency in the DTMF frequency table is greater than the energy threshold. The method further comprises: 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 PCM data frame next to the current PCM data frame is a valid PCM data frame.
3. The method according to claim 2, characterized in that The method further comprises: If the energy amplitude of the previous PCM data frame of the current PCM data frame on the target frequency pair is less than the energy threshold, determining that the current PCM data frame corresponds to the beginning of the target DTMF signal; If the energy amplitude of the subsequent 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 the end of the target DTMF signal.
4. The method according to claim 2, characterized in that: Modifying the energy threshold according to the first energy amplitude and the second energy amplitude includes: The first energy amplitude, the second energy amplitude, and an average value of maximum energy amplitudes corresponding to each low frequency and each high frequency in the DTMF frequency table of a historical valid PCM data frame are used as the revised energy threshold.
5. The method according to claim 1, characterized in that The analog signal is received from a telephone, and the received analog signal is sampled into a pulse code modulation PCM data stream, including: Detecting the on-hook and off-hook status of the telephone; When it is detected that the telephone is in an off-hook state, the analog signal received from the telephone is sampled as a pulse code modulation PCM data stream.
6. The method according to claim 1, characterized in that Determining the maximum energy amplitude of each energy amplitude corresponding to each low frequency frequency in the dual tone multi-frequency (DTMF) frequency table of the target PCM data comprises: The maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at the respective low-frequency frequencies in the dual-tone multi-frequency (DTMF) frequency table is determined according to the Goertzel algorithm.
7. The method according to claim 6, characterized in that Determining the maximum energy amplitude of each energy amplitude corresponding to each low frequency in the dual-tone multi-frequency DTMF frequency table of the target PCM data according to the Goertzel algorithm includes: Using multiple threads to execute in parallel according to the Goertzel algorithm to determine the energy amplitudes corresponding to the target PCM data at the respective low-frequency frequencies in the dual-tone multi-frequency DTMF frequency table; The maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at the low-frequency frequencies is determined.
8. A key recognition device, characterized in that: include: A sampling unit, used for sampling the received analog signal into a pulse code modulation PCM data stream; a target PCM data determining unit, configured to determine, for a current PCM data frame in the PCM data stream, 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; A maximum energy amplitude determination unit is used to determine the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at the low frequencies in the dual-tone multi-frequency (DTMF) frequency table to obtain a first energy amplitude, and to determine the maximum energy amplitude among the energy amplitudes corresponding to the target PCM data at the high frequencies in the DTMF frequency table to obtain a second energy amplitude; The key value recognition unit is used to determine the corresponding number of the target frequency pair corresponding to the first energy amplitude and the second energy amplitude in the DTMF frequency table, and the number is used to determine the key value of the key corresponding to the analog signal.
9. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 7 by executing the executable instructions.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
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
Method and device for filtering dual-tone multi-frequency signals
CN115550495A
Processing chip by digital signals and double-sound multi-frequency detector of relative method
CN1159693A
Method and apparatus for detecting signal misalignment
US6046977A