WO2020143521A1 - Digital audio signal sampling frequency detection method and device - Google Patents

Digital audio signal sampling frequency detection method and device Download PDF

Info

Publication number
WO2020143521A1
WO2020143521A1 PCT/CN2020/070061 CN2020070061W WO2020143521A1 WO 2020143521 A1 WO2020143521 A1 WO 2020143521A1 CN 2020070061 W CN2020070061 W CN 2020070061W WO 2020143521 A1 WO2020143521 A1 WO 2020143521A1
Authority
WO
WIPO (PCT)
Prior art keywords
clock signal
frequency
reference clock
sampling rate
sampling
Prior art date
Application number
PCT/CN2020/070061
Other languages
French (fr)
Chinese (zh)
Inventor
蒋松鹰
姚炜
管少钧
Original Assignee
上海艾为电子技术股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 上海艾为电子技术股份有限公司 filed Critical 上海艾为电子技术股份有限公司
Publication of WO2020143521A1 publication Critical patent/WO2020143521A1/en

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R23/00Arrangements for measuring frequencies; Arrangements for analysing frequency spectra
    • G01R23/02Arrangements for measuring frequency, e.g. pulse repetition rate; Arrangements for measuring period of current or voltage
    • G01R23/10Arrangements for measuring frequency, e.g. pulse repetition rate; Arrangements for measuring period of current or voltage by converting frequency into a train of pulses, which are then counted, i.e. converting the signal into a square wave
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R23/00Arrangements for measuring frequencies; Arrangements for analysing frequency spectra
    • G01R23/02Arrangements for measuring frequency, e.g. pulse repetition rate; Arrangements for measuring period of current or voltage
    • G01R23/15Indicating that frequency of pulses is either above or below a predetermined value or within or outside a predetermined range of values, by making use of non-linear or digital elements (indicating that pulse width is above or below a certain limit)

Definitions

  • the invention relates to the technical field of integrated circuits, in particular to a method and device for detecting the sampling frequency of digital audio signals.
  • the audio amplifier chip plays the role of receiving digital audio signals sent by music software and controlling the speakers to play the corresponding audio.
  • Music software usually supports multiple audio formats, and the sampling frequencies of audio signals corresponding to different audio formats are also different.
  • the software needs to configure a theoretical sampling frequency matching the sampling frequency of the actually transmitted audio signal.
  • the theoretical sampling frequency does not match the sampling frequency of the actually transmitted audio signal At this time, the audio amplifier chip is prone to damage.
  • the present invention proposes a method and device for detecting the sampling frequency of digital audio signals to prevent the audio amplifier chip from being damaged when the sampling frequency of the software configuration is wrong.
  • the first aspect of the present application provides a method for detecting a sampling frequency of a digital audio signal, including:
  • the judgment result indicates that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency, the judgment result is output.
  • the method before calculating the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal, the method further includes:
  • the method before calculating the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal, the method further includes:
  • the calculating the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal includes:
  • the judging whether the sampling frequency of the digital audio signal matches the pre-configured theoretical sampling frequency to obtain a judgment result includes:
  • the absolute value of the difference is greater than or equal to the threshold, it is determined that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency; if the absolute value of the difference is less than the threshold, then It is determined that the sampling frequency of the digital audio signal matches the theoretical sampling frequency.
  • the second aspect of the present application provides a detection device for a sampling frequency of a digital audio signal, including:
  • a calculation unit configured to acquire a reference clock signal and a sampling rate clock signal, and calculate the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal;
  • the comparison unit is used to calculate the sampling frequency of the digital audio signal according to the number of pulses and the frequency of the reference clock signal, and determine whether the sampling frequency of the digital audio signal matches the pre-configured theoretical sampling frequency to obtain a judgment As a result, if the judgment result indicates that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency, the judgment result is output.
  • the counting unit is used to obtain the reference clock signal and the sampling rate clock signal, and calculate the pulse number of the sampling rate clock signal within one cycle of the reference clock signal;
  • the latch unit is used to store the calculated pulse number.
  • the calculation unit includes:
  • the counting unit is used to obtain a reference clock signal and a sampling rate clock signal, and calculate the total number of pulses of the sampling rate clock signal in N cycles of the reference clock signal, where N is a preset positive integer;
  • a counting and averaging unit is used to obtain the total number of pulses, and divide the total number of pulses by N to obtain the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal.
  • the device further includes:
  • a frequency divider configured to obtain the reference clock signal and divide the reference clock signal to obtain a reference clock signal whose frequency is less than the frequency of the sampling rate clock signal
  • the reference clock signal acquired by the calculation unit is: a reference clock signal whose frequency is less than the frequency of the sampling rate clock signal obtained by the frequency divider.
  • the device further includes:
  • a synchronization unit configured to obtain a reference clock signal and a sampling rate clock signal, and adjust the reference clock signal to obtain a reference clock signal synchronized with the sampling rate clock signal;
  • the invention provides a method and a device for detecting the sampling frequency of a digital audio signal, which uses a reference clock signal and a sampling rate clock signal of a digital audio signal to detect the sampling frequency of the digital audio signal.
  • the output of the detection result can enable the software to adjust the sampling frequency of the digital audio signal in time or adjust the theoretical sampling frequency, which can prevent the audio amplification chip
  • the damage occurs when the sampling frequency of the software configuration is wrong.
  • FIG. 1 is a schematic flowchart of a method for detecting a sampling frequency of a digital audio signal disclosed in an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of a method for detecting a sampling frequency of a digital audio signal disclosed in another embodiment of the present invention
  • FIG. 4 is a schematic diagram of a device for detecting a sampling frequency of a digital audio signal disclosed in another embodiment of the present invention.
  • the reference clock signal is a clock signal whose frequency is known and stable.
  • the reference clock signal should be a clock signal whose frequency is less than the frequency of the sampling rate clock signal, or should be a slow clock signal relative to the sampling rate clock signal .
  • the reference clock signal is a clock signal synchronized with the sampling rate clock signal.
  • the sampling frequency of the digital audio signal is generally between 8KHz and 48KHz, therefore, the reference clock signal may be a 1KHz clock signal.
  • sampling rate clock signal is a clock signal transmitted to the audio amplification chip together with the digital audio signal, and the frequency of the sampling rate clock signal is the sampling frequency of the digital audio signal, or, The frequency of the sampling rate clock signal is always equal to the sampling frequency of the digital audio signal.
  • the synchronization of the reference clock signal and the sampling rate clock signal means that one rising edge of each reference clock corresponds exactly to the rising edge of one sampling rate clock. It is not difficult to understand that the frequency of the reference clock signal and the sampling rate clock signal may be different.
  • the calculated pulse number of the sampling rate clock signal in one cycle of the reference clock signal may be regarded as a ratio of the frequency of the sampling rate clock signal to the frequency of the reference clock signal.
  • S103 Calculate the sampling frequency of the digital audio signal according to the number of pulses and the frequency of the reference clock signal.
  • step S103 actually calculates the sampling rate clock signal frequency.
  • sampling frequency is the sampling frequency configured by the software.
  • the judgment whether the sampling frequency of the digital audio signal (which can also be understood as the actual sampling frequency) matches the pre-configured theoretical sampling frequency can be strictly judged whether the actual sampling frequency is equal to the theoretical sampling frequency, if If they are not equal, it is considered that the two frequencies do not match, or an error range can be set. If the error between the actual sampling frequency and the theoretical sampling frequency is within the range, the two frequencies are considered to match. Frequencies do not match.
  • the method for detecting the sampling frequency of a digital audio signal calculates the sampling frequency of the digital audio signal using a reference clock signal and a sampling rate clock signal of the digital audio signal, thereby realizing the sampling frequency of the digital audio signal Real-time detection of, when the detected sampling frequency of the digital audio signal does not match the preset theoretical sampling frequency, the detection result is output, so that the control software can timely adjust the sampling frequency of the digital audio signal or adjust the theory Sampling frequency. Therefore, the method provided by the embodiments of the present application can output the detection result when the sampling frequency of the digital audio signal does not match the pre-configured theoretical sampling frequency, thereby preventing the audio amplifier chip from being damaged when the sampling frequency of the software configuration is wrong effect.
  • Another embodiment of the present application also provides a method for detecting the sampling frequency of a digital audio signal, please refer to FIG. 2, the method includes the following steps:
  • the embodiment of the present application does not require an initial reference clock signal to be acquired, that is to say, the initial reference clock signal acquired in step S201 of the embodiment of the present application may be relative to all
  • the fast clock signal of the sampling rate clock signal that is, the clock signal having a frequency greater than the frequency of the sampling rate clock signal, may not be synchronized with the sampling rate clock signal.
  • the initial reference clock signal obtained in this embodiment of the present application is usually a standard clock signal of an audio playback device integrated with the digital audio amplifier chip, and the frequency of the standard clock signal is relatively high, usually 1 MHz, which is much higher than
  • the common sampling frequency range of digital audio signals ie 8KHz to 48KHz
  • the phase of the standard clock signal is fixed after the audio playback device is started, so it is usually not synchronized with the sampling rate clock signal of the digital audio signal .
  • the first reference clock signal is a reference clock signal obtained by dividing the initial reference clock signal and having a frequency less than the frequency of the sampling rate clock signal.
  • the frequency division processing of the initial reference clock signal is implemented by a frequency divider, that is, the initial reference clock signal is input to the frequency divider, and after the frequency divider processing, the first Reference clock signal.
  • the frequency division processing of the initial reference clock signal to obtain a reference clock signal whose frequency is less than the frequency of the sampling rate clock signal may be considered to be a frequency higher than a preset frequency (or a preset threshold)
  • the reference clock signal is divided by frequency to obtain a reference clock signal whose frequency is a preset frequency (ie, the first reference clock signal), where the preset frequency is less than the frequency of the sampling rate clock signal.
  • the initial reference clock signal with a frequency greater than 1 KHz may be divided to obtain a first reference clock signal with a frequency of 1 KHz.
  • the frequency of the input initial reference clock signal is less than or equal to 1 KHz, no frequency division processing is performed.
  • the above step of determining whether the input initial reference clock signal is less than the preset frequency is actually realized automatically by the frequency divider, or in other words, when the frequency divider is working, the input signal will be automatically performed according to the preset frequency For screening, only the signal with a frequency greater than the preset frequency is subjected to frequency division processing.
  • the above-mentioned preset frequency may also be other values greater than 1 KHz or less than 1 KHz, as long as the preset frequency is lower than or equal to the lower limit of the sampling frequency range of the digital audio signal to be detected.
  • the sampling frequency is usually between 8KHz and 48KHz, so the preset sampling frequency may be less than or equal to 8KHz.
  • it is recommended to set the preset frequency to the sampling frequency range The lower limit of is kept at a certain difference. For example, for a sampling frequency in the range of 8KHz to 48KHz, it is recommended to make the preset frequency less than or equal to 5KHz.
  • the second reference clock signal is a reference clock signal synchronized with the sampling rate clock signal.
  • the synchronization of the second reference clock signal and the sampling rate clock signal means that when the second reference clock signal transitions from low level to high level, the sampling rate clock signal also changes from low level Jump to a high level, or each rising edge of the second reference clock signal simultaneously corresponds to a rising edge of the sampling rate clock signal.
  • steps S202 and S203 are not necessary for implementing the detection method provided by the present invention.
  • steps S202 and S203 may not Execution, and the initial reference clock signal is directly used as the second reference clock signal.
  • step S202 and step S203 the scope of application of the frequency detection method provided by the embodiment of the present application can be expanded, so that the reference clock signal with a sufficiently low frequency and synchronized with the sampling rate clock signal cannot be obtained in the embodiment of the present application It can also work normally when the real-time detection of the sampling frequency of digital audio signals is completed.
  • the N is a preset positive integer.
  • the N may be set to 32 or 64, or may be set to other positive integers.
  • Steps S204 and S205 can be understood as averaging the total number of pulses of the sampling rate clock signal in multiple cycles of the second reference clock signal, and using the obtained average value as the sampling rate clock signal in the first The number of pulses in one cycle of the reference clock signal.
  • step S204 and step S205 are optional. Steps S204 and S205 are performed because there is a certain error in the second reference clock signal, or there may be fluctuations, so the total number of pulses in multiple cycles is averaged to calculate the number of pulses in one cycle to Avoid misjudgment due to fluctuations in the second reference clock signal. If the second reference clock signal fluctuates to a low degree, does not generate or does not generate misjudgments frequently, or allows misjudgments to occur during the execution of the method, then step S204 and step S205 may not be performed and a sample rate clock signal may be directly counted The number of pulses in a cycle is sufficient, instead of averaging the total number of pulses in multiple cycles.
  • the calculation of the pulse number of the sampling rate clock signal within one cycle of the second reference clock signal can also be considered as the calculation of the sampling rate after the second reference clock signal has passed one cycle
  • the number of cycles elapsed by the clock signal that is, the calculated pulse number of the sampling rate clock signal within one cycle of the second reference clock signal can be considered as the frequency of the sampling rate clock signal and the second reference The ratio of the frequency of the clock signal.
  • S206 Calculate the sampling frequency of the digital audio signal according to the number of pulses and the frequency of the second reference clock signal.
  • step S206 may be: multiplying the number of pulses by the frequency of the second reference clock signal, and the result obtained is the frequency of the sampling rate clock signal, that is, the number The sampling frequency of the audio signal (or the actual sampling frequency).
  • the theoretical sampling frequency is a sampling frequency obtained after the sampling rate decoding unit decodes the sampling rate code, and the sampling rate code is pre-configured by software through a register.
  • the absolute value of the difference is greater than or equal to the threshold, it is determined that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency; if the absolute value of the difference is less than the threshold, then It is determined that the sampling frequency of the digital audio signal matches the theoretical sampling frequency.
  • the threshold may be set to 50 Hz or other values, and the recommended value range is 0 Hz to 100 Hz.
  • the method provided by the embodiment of the present application on the basis of real-time detection of the sampling frequency of the digital audio signal, extends the scope of application of the method provided by the embodiment of the present application by adding steps S202 and S203, and utilizes the statistical reference
  • the method of sampling the total pulse number of the clock signal in multiple cycles of the clock signal and then averaging effectively avoids the misjudgment caused by the fluctuation of the reference clock signal.
  • the device includes:
  • the calculating unit 301 is configured to acquire a reference clock signal and a sampling rate clock signal, and calculate the pulse number of the sampling rate clock signal within one cycle of the reference clock signal.
  • the frequency of the reference clock signal is less than the frequency of the sampling rate clock signal, and the reference clock signal and the sampling rate clock signal are synchronized.
  • the comparing unit 302 is used to calculate the sampling frequency of the digital audio signal according to the number of pulses and the frequency of the reference clock signal, and determine whether the sampling frequency of the digital audio signal matches the pre-configured theoretical sampling frequency to obtain Judgment result, if the judgment result indicates that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency, the judgment result is output.
  • the calculation unit 301 and the comparison unit 302 calculate the sampling rate of the digital audio signal according to the frequency of the reference clock signal, that is, the sampling frequency of the digital audio signal, and then the comparison unit 302 determines Whether the sampling frequency of the digital audio signal matches the theoretical sampling frequency pre-configured by the software, and outputs a judgment result when the two frequencies do not match, so that the software can adjust the sampling frequency of the digital audio signal in time, or modify the theoretical sampling frequency, Thereby, real-time detection of the sampling frequency of the digital audio signal is realized, and the damage of the audio amplification chip caused by the mismatch of the sampling frequency of the digital audio signal and the theoretical sampling frequency is effectively avoided.
  • An embodiment of the present application further provides a device for detecting the sampling frequency of a digital audio signal, please refer to FIG. 4, the device includes:
  • the frequency divider 401 is used to obtain the reference clock signal OSC, and divide the reference clock signal OSC to obtain a reference clock signal CLK_REF (denoted as a first reference signal) whose frequency is less than the frequency of the sampling rate clock signal.
  • the synchronization unit 402 is used to obtain the reference clock signal CLK_REF and the sampling rate clock signal WCK whose frequency output from the frequency divider 401 is less than the sampling rate clock signal, and adjust the reference clock signal CLK_REF to obtain a reference synchronized with the sampling rate clock signal WCK Clock signal CLK_REF_SYNC (denoted as synchronization reference signal).
  • the synchronization unit 402 can be implemented by flip-flops, such as T flip-flops and D flip-flops.
  • the frequency divider 401 and the synchronization unit 402 are optional. If the frequency of the reference clock signal OSC is less than the sampling rate clock signal WCK, and the reference clock signal OSC is a signal synchronized with the sampling rate clock signal WCK, the reference clock signal OSC can be directly input without being processed by the frequency divider 401 and the synchronization unit 402 Calculation unit 403.
  • the calculation unit 403 is configured to acquire the reference clock signal CLK_REF_SYNC and the sampling rate clock signal WCK output by the synchronization unit 402, and calculate the number of pulses of the sampling rate clock signal WCK within one cycle of the reference clock signal CLK_REF_SYNC.
  • the calculation unit 403 may use a counter with synchronization enabling and latching functions, and may also use a shift register and a device with latching functions.
  • the calculation unit 403 includes:
  • the counting unit is used to acquire the reference clock signal and the sampling rate clock signal, and calculate the pulse number of the sampling rate clock signal within one cycle of the reference clock signal.
  • the latch unit is used to store the calculated pulse number.
  • the calculation unit 403 includes:
  • the counting unit is used to obtain a reference clock signal and a sampling rate clock signal, and to count the total number of pulses of the sampling rate clock signal in N cycles of the reference clock signal, where N is a preset positive integer.
  • the latch unit is used to store the calculated pulse number.
  • the counting and averaging unit is used to obtain the total pulse number and divide the total pulse number by N to obtain the pulse number of the sampling rate clock signal within one cycle of the reference clock signal WCK_AVG[5:0]( Recorded as the average number of pulses).
  • the counting and averaging unit is generally implemented by a shifted adder.
  • the comparing unit 404 is used to calculate the sampling frequency of the digital audio signal according to the number of pulses and the frequency of the reference clock signal, and determine whether the sampling frequency of the digital audio signal matches the pre-configured theoretical sampling frequency to obtain Judgment result, if the judgment result indicates that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency, the judgment result is output.
  • the comparison unit 404 can basically be implemented by a comparator with a calculation function, or a combination of a calculator and an XOR gate array.
  • the working principle of the comparison unit 404 is to calculate the sampling frequency of the digital audio signal according to the frequency of the reference clock signal and the number of pulses input by the calculation unit 403, and then calculate the digital audio signal The difference between the sampling frequency and the theoretical sampling frequency, and comparing the absolute value of the difference with a preset threshold, if the absolute value of the difference is less than or equal to the threshold, the sampling frequency of the digital audio signal is determined Matches the theoretical frequency, otherwise, it is determined that the sampling frequency of the digital audio signal does not match the theoretical frequency, and if it is determined that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency, the judgment is output result.
  • the device further includes:
  • the sampling rate decoding unit 405 is used to decode the sampling rate code I2SSR[3:0] pre-configured by the software through the register to obtain the theoretical sampling frequency SR_CODE[5:0].
  • the sampling rate decoding unit 405 is connected to the comparison unit 404, and sends the decoded theoretical sampling frequency SR_CODE[5:0] to the comparison unit 404.
  • sampling rate decoding unit may be a sampling decoder.
  • the device provided by the embodiment of the present application effectively expands the scope of application of the device provided by the embodiment of the present application on the basis of effectively detecting the sampling frequency of the digital audio signal in real time, by adding a frequency divider and a synchronization unit before the computing unit
  • a counting and averaging unit is provided in the calculation unit to average the total number of pulses in multiple cycles of the reference clock signal to obtain the number of pulses in one cycle of the reference clock signal, thereby avoiding Misjudgment caused by reference clock signal fluctuations.

Abstract

A digital audio signal sampling frequency detection method and device. The method comprises: by means of a reference clock signal and a sampling rate clock signal of a digital audio signal, detecting the sampling frequency of the digital audio signal; when it is detected that the sampling frequency of the digital audio signal is not matched with a preset theoretical sampling frequency, outputting a detection result, so that software can adjust the sampling frequency of the digital audio signal timely or adjust the theoretical sampling frequency, thereby realizing the effect of preventing the phenomenon that an audio amplifier chip is damaged when the software configures the sampling frequency incorrectly.

Description

数字音频信号的采样频率的检测方法及装置Method and device for detecting sampling frequency of digital audio signal
本申请要求于2019年01月09日提交中国专利局、申请号为201910020489.1、申请名称为“数字音频信号的采样频率的检测方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requires the priority of the Chinese patent application submitted to the China Patent Office on January 09, 2019, with the application number 201910020489.1 and the application name "Sampling Frequency Detection Method and Device for Digital Audio Signals", the entire contents of which are incorporated by reference In this application.
技术领域Technical field
本发明涉及集成电路技术领域,特别涉及一种数字音频信号的采样频率的检测方法及装置。The invention relates to the technical field of integrated circuits, in particular to a method and device for detecting the sampling frequency of digital audio signals.
背景技术Background technique
随着个人电脑的普及,越来越多的用户使用电脑上的音乐软件以及外设的音频播放设备播放音乐。音频放大芯片作为播放设备的重要部件,起到接收音乐软件发送的数字音频信号,并控制喇叭播放对应音频的作用。With the popularity of personal computers, more and more users use music software on computers and peripheral audio playback devices to play music. As an important part of the playback device, the audio amplifier chip plays the role of receiving digital audio signals sent by music software and controlling the speakers to play the corresponding audio.
音乐软件通常都支持多种音频格式,不同的音频格式对应的音频信号的采样频率也不同。音频放大芯片工作时,需要软件为其配置一个与实际传输的音频信号的采样频率相匹配的理论采样频率,当软件配置错误,使得所述理论采样频率与实际传输的音频信号的采样频率不匹配时,音频放大芯片容易发生损坏。Music software usually supports multiple audio formats, and the sampling frequencies of audio signals corresponding to different audio formats are also different. When the audio amplifier chip is working, the software needs to configure a theoretical sampling frequency matching the sampling frequency of the actually transmitted audio signal. When the software configuration is wrong, the theoretical sampling frequency does not match the sampling frequency of the actually transmitted audio signal At this time, the audio amplifier chip is prone to damage.
申请内容Application content
基于上述现有技术的不足,本发明提出一种数字音频信号的采样频率的检测方法及装置,以防止音频放大芯片在软件配置采样频率错误时发生损坏。Based on the above deficiencies of the prior art, the present invention proposes a method and device for detecting the sampling frequency of digital audio signals to prevent the audio amplifier chip from being damaged when the sampling frequency of the software configuration is wrong.
为解决上述问题,现提出的方案如下:In order to solve the above problems, the proposed solutions are as follows:
本申请第一方面提供了一种数字音频信号的采样频率的检测方法,包括:The first aspect of the present application provides a method for detecting a sampling frequency of a digital audio signal, including:
获取参考时钟信号和采样率时钟信号;Obtain reference clock signal and sampling rate clock signal;
计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数;Calculating the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal;
根据所述脉冲数和所述参考时钟信号的频率,计算所述数字音频信号的采样频率;Calculating the sampling frequency of the digital audio signal according to the number of pulses and the frequency of the reference clock signal;
判断所述数字音频信号的采样频率与预先配置的理论采样频率是否匹配,得到判断结果;Judging whether the sampling frequency of the digital audio signal matches the pre-configured theoretical sampling frequency to obtain a judgment result;
若所述判断结果表明所述数字音频信号的采样频率与所述理论采样频率不匹配,则输出所述判断结果。If the judgment result indicates that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency, the judgment result is output.
可选的,所述计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数之前,还包括:Optionally, before calculating the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal, the method further includes:
对所述参考时钟信号进行分频处理,得到频率小于所述采样率时钟信号的频率的参考时钟信号。Frequency-dividing the reference clock signal to obtain a reference clock signal whose frequency is less than the frequency of the sampling rate clock signal.
可选的,所述计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数之前,还包括:Optionally, before calculating the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal, the method further includes:
对所述参考时钟信号进行调整,得到与所述采样率时钟信号同步的参考时钟信号。Adjusting the reference clock signal to obtain a reference clock signal synchronized with the sampling rate clock signal.
可选的,所述计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数,包括:Optionally, the calculating the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal includes:
计算所述参考时钟信号的N个周期内,所述采样率时钟信号的总脉冲数,所述N是预设的正整数;Calculating the total pulse number of the sampling rate clock signal in N cycles of the reference clock signal, where N is a preset positive integer;
用所述总脉冲数除以N,得到所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数。Divide the total number of pulses by N to obtain the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal.
可选的,所述判断所述数字音频信号的采样频率与预先配置的理论采样频率是否匹配,得到判断结果,包括:Optionally, the judging whether the sampling frequency of the digital audio signal matches the pre-configured theoretical sampling frequency to obtain a judgment result includes:
计算所述数字音频信号的采样频率与理论采样频率的差值;Calculating the difference between the sampling frequency of the digital audio signal and the theoretical sampling frequency;
判断所述差值的绝对值是否小于预设的阈值;Determine whether the absolute value of the difference is less than a preset threshold;
其中,若所述差值的绝对值大于或等于所述阈值,则确定所述数字音频信号的采样频率与所述理论采样频率不匹配;若所述差值的绝对值小于所述阈值,则确定所述数字音频信号的采样频率与所述理论采样频率匹配。Wherein, if the absolute value of the difference is greater than or equal to the threshold, it is determined that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency; if the absolute value of the difference is less than the threshold, then It is determined that the sampling frequency of the digital audio signal matches the theoretical sampling frequency.
本申请第二方面提供了一种数字音频信号的采样频率的检测装置,包括:The second aspect of the present application provides a detection device for a sampling frequency of a digital audio signal, including:
计算单元,用于获取参考时钟信号和采样率时钟信号,并计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数;A calculation unit, configured to acquire a reference clock signal and a sampling rate clock signal, and calculate the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal;
比较单元,用于根据所述脉冲数和所述参考时钟信号的频率计算所述数字音频信号的采样频率,并判断所述数字音频信号的采样频率与预先配置的理论 采样频率是否匹配,得到判断结果,若所述判断结果表明所述数字音频信号的采样频率与所述理论采样频率不匹配,则输出所述判断结果。The comparison unit is used to calculate the sampling frequency of the digital audio signal according to the number of pulses and the frequency of the reference clock signal, and determine whether the sampling frequency of the digital audio signal matches the pre-configured theoretical sampling frequency to obtain a judgment As a result, if the judgment result indicates that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency, the judgment result is output.
可选的,所述计算单元,包括:Optionally, the calculation unit includes:
计数单元,用于获取参考时钟信号和采样率时钟信号,并计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数;The counting unit is used to obtain the reference clock signal and the sampling rate clock signal, and calculate the pulse number of the sampling rate clock signal within one cycle of the reference clock signal;
锁存单元,用于保存计算得到的脉冲数。The latch unit is used to store the calculated pulse number.
可选的,所述计算单元,包括:Optionally, the calculation unit includes:
计数单元,用于获取参考时钟信号和采样率时钟信号,并计算所述参考时钟信号的N个周期内,所述采样率时钟信号的总脉冲数,所述N是预设的正整数;The counting unit is used to obtain a reference clock signal and a sampling rate clock signal, and calculate the total number of pulses of the sampling rate clock signal in N cycles of the reference clock signal, where N is a preset positive integer;
锁存单元,用于保存计算得到的总脉冲数;Latch unit, used to save the calculated total pulse number;
计数平均单元,用于获取所述总脉冲数,并用所述总脉冲数除以N,得到所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数。A counting and averaging unit is used to obtain the total number of pulses, and divide the total number of pulses by N to obtain the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal.
可选的,所述装置还包括:Optionally, the device further includes:
分频器,用于获取所述参考时钟信号,并对所述参考时钟信号进行分频处理,得到频率小于采样率时钟信号的频率的参考时钟信号;A frequency divider, configured to obtain the reference clock signal and divide the reference clock signal to obtain a reference clock signal whose frequency is less than the frequency of the sampling rate clock signal;
其中,所述计算单元获取的参考时钟信号是:所述分频器得到的频率小于所述采样率时钟信号的频率的参考时钟信号。Wherein, the reference clock signal acquired by the calculation unit is: a reference clock signal whose frequency is less than the frequency of the sampling rate clock signal obtained by the frequency divider.
可选的,所述装置还包括:Optionally, the device further includes:
同步单元,用于获取参考时钟信号和采样率时钟信号,并对所述参考时钟信号进行调整,得到与所述采样率时钟信号同步的参考时钟信号;A synchronization unit, configured to obtain a reference clock signal and a sampling rate clock signal, and adjust the reference clock signal to obtain a reference clock signal synchronized with the sampling rate clock signal;
其中,所述计算单元获取的参考时钟信号是:与所述采样率时钟信号同步的参考时钟信号。Wherein, the reference clock signal acquired by the calculation unit is: a reference clock signal synchronized with the sampling rate clock signal.
本发明提供了一种数字音频信号的采样频率的检测方法及装置,利用参考时钟信号和数字音频信号的采样率时钟信号,对所述数字音频信号的采样频率进行检测,当检测到的所述数字音频信号的采样频率与预设的理论采样频率不匹配时,输出检测结果,可以使得软件能够及时调节所述数字音频信号的采样频率或调节所述理论采样频率,能够起到防止音频放大芯片在软件配置采样频 率错误时发生损坏的作用。The invention provides a method and a device for detecting the sampling frequency of a digital audio signal, which uses a reference clock signal and a sampling rate clock signal of a digital audio signal to detect the sampling frequency of the digital audio signal. When the sampling frequency of the digital audio signal does not match the preset theoretical sampling frequency, the output of the detection result can enable the software to adjust the sampling frequency of the digital audio signal in time or adjust the theoretical sampling frequency, which can prevent the audio amplification chip The damage occurs when the sampling frequency of the software configuration is wrong.
附图说明BRIEF DESCRIPTION
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly explain the embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings required in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only This is an embodiment of the present application. For a person of ordinary skill in the art, without paying any creative work, other drawings may be obtained according to the provided drawings.
图1是本发明一个实施例公开的数字音频信号的采样频率的检测方法的流程示意图;1 is a schematic flowchart of a method for detecting a sampling frequency of a digital audio signal disclosed in an embodiment of the present invention;
图2是本发明另一实施例公开的数字音频信号的采样频率的检测方法的流程示意图;2 is a schematic flowchart of a method for detecting a sampling frequency of a digital audio signal disclosed in another embodiment of the present invention;
图3是本发明一个实施例公开的数字音频信号的采样频率的检测装置的示意图;3 is a schematic diagram of a device for detecting a sampling frequency of a digital audio signal disclosed in an embodiment of the present invention;
图4是本发明另一实施例公开的数字音频信号的采样频率的检测装置的示意图。4 is a schematic diagram of a device for detecting a sampling frequency of a digital audio signal disclosed in another embodiment of the present invention.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
本申请实施例提供的数字音频信号的采样频率的检测方法,请参考图1,包括以下步骤:For the method for detecting the sampling frequency of the digital audio signal provided by the embodiment of the present application, please refer to FIG.
S101、获取参考时钟信号和采样率时钟信号。S101. Obtain a reference clock signal and a sampling rate clock signal.
需要说明的是,在一个可选方案中,所述参考时钟信号是,频率已知且稳定不变的时钟信号。为了实现本申请实施例提供的检测方法,所述参考时钟信号应该是频率小于所述采样率时钟信号的频率的时钟信号,或者说,应该是相对于所述采样率时钟信号的慢速时钟信号。并且,所述参考时钟信号是与所述采样率时钟信号同步的时钟信号。具体的,通常数字音频信号的采样频率在8KHz到48KHz之间,因此,所述参考时钟信号可以是1KHz的时钟信号。It should be noted that, in an alternative solution, the reference clock signal is a clock signal whose frequency is known and stable. In order to implement the detection method provided by the embodiment of the present application, the reference clock signal should be a clock signal whose frequency is less than the frequency of the sampling rate clock signal, or should be a slow clock signal relative to the sampling rate clock signal . And, the reference clock signal is a clock signal synchronized with the sampling rate clock signal. Specifically, the sampling frequency of the digital audio signal is generally between 8KHz and 48KHz, therefore, the reference clock signal may be a 1KHz clock signal.
需要说明的是,所述采样率时钟信号,是与数字音频信号一起向音频放大芯片传输的一个时钟信号,所述采样率时钟信号的频率,就是所述数字音频信号的采样频率,或者说,所述采样率时钟信号的频率,总是等于所述数字音频信号的采样频率。It should be noted that the sampling rate clock signal is a clock signal transmitted to the audio amplification chip together with the digital audio signal, and the frequency of the sampling rate clock signal is the sampling frequency of the digital audio signal, or, The frequency of the sampling rate clock signal is always equal to the sampling frequency of the digital audio signal.
本实施例中,参考时钟信号和采样率时钟信号同步,是指,每一个参考时钟的一个上升沿恰好对应一个采样率时钟的上升沿。不难理解,参考时钟信号和采样率时钟信号的频率是可以不一样的。In this embodiment, the synchronization of the reference clock signal and the sampling rate clock signal means that one rising edge of each reference clock corresponds exactly to the rising edge of one sampling rate clock. It is not difficult to understand that the frequency of the reference clock signal and the sampling rate clock signal may be different.
S102、计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数。S102. Calculate the number of pulses of the sampling rate clock signal in one cycle of the reference clock signal.
需要说明的是,计算得到的所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数,可以认为是所述采样率时钟信号的频率与所述参考时钟信号的频率的比值。It should be noted that the calculated pulse number of the sampling rate clock signal in one cycle of the reference clock signal may be regarded as a ratio of the frequency of the sampling rate clock signal to the frequency of the reference clock signal.
S103、根据所述脉冲数和所述参考时钟信号的频率,计算所述数字音频信号的采样频率。S103. Calculate the sampling frequency of the digital audio signal according to the number of pulses and the frequency of the reference clock signal.
需要说明的是,由于所述采样率时钟信号的频率总是等于所述数字音频信号的采样频率,步骤S103中计算所述数字音频信号的采样频率,实际上也是计算所述采样率时钟信号的频率。It should be noted that, since the frequency of the sampling rate clock signal is always equal to the sampling frequency of the digital audio signal, calculating the sampling frequency of the digital audio signal in step S103 actually calculates the sampling rate clock signal frequency.
S104、判断所述数字音频信号的采样频率与预先配置的理论采样频率是否匹配,得到判断结果。S104. Determine whether the sampling frequency of the digital audio signal matches the pre-configured theoretical sampling frequency to obtain a judgment result.
需要说明的是,所述理论采样频率,就是软件配置的采样频率。It should be noted that the theoretical sampling frequency is the sampling frequency configured by the software.
需要说明的是,所述判断数字音频信号的采样频率(也可以理解成实际采样频率)与所述预先配置的理论采样频率是否匹配,可以是严格地判断实际采样频率是否等于理论采样频率,若不相等则认为两个频率不匹配,也可以是设定一个误差范围,若实际采样频率与理论采样频率的误差在所述范围内,则认为两个频率匹配,若在范围外,则认为两个频率不匹配。It should be noted that the judgment whether the sampling frequency of the digital audio signal (which can also be understood as the actual sampling frequency) matches the pre-configured theoretical sampling frequency can be strictly judged whether the actual sampling frequency is equal to the theoretical sampling frequency, if If they are not equal, it is considered that the two frequencies do not match, or an error range can be set. If the error between the actual sampling frequency and the theoretical sampling frequency is within the range, the two frequencies are considered to match. Frequencies do not match.
S105、若所述判断结果表明所述数字音频信号的采样频率与所述理论采样频率不匹配,则输出所述判断结果。S105. If the judgment result indicates that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency, output the judgment result.
需要说明的是,所述在判断结果表明实际采样频率与理论采样频率不匹配时输出采样结果,可以采用下述方式实现,当然具体实现方式可以有多种,包 括下述实现方式在内的所有能够达到如步骤S105所述的效果的具体实现方式,都在本申请保护范围内:It should be noted that the output of the sampling result when the judgment result indicates that the actual sampling frequency does not match the theoretical sampling frequency can be implemented in the following manner, of course, there may be multiple specific implementation manners, including all of the following implementation manners The specific implementation methods that can achieve the effect described in step S105 are within the scope of protection of this application:
第一种方式,若所述实际采样频率与所述理论采样频率匹配,则不输出任何信号,当实际采样频率与理论采样频率不匹配时,向软件输出报警信号。In the first way, if the actual sampling frequency matches the theoretical sampling frequency, no signal is output, and when the actual sampling frequency does not match the theoretical sampling frequency, an alarm signal is output to the software.
第二种方式,在所述实际采样频率与所述理论采样频率匹配时,向软件输出信号1,当所述实际采样频率与所述理论采样频率不匹配时,向软件输出信号0,从而向软件表明目前配置的理论采样频率与实际采样频率不匹配。当然也可以在匹配时输出0,不匹配时输出1。In the second way, when the actual sampling frequency matches the theoretical sampling frequency, a signal 1 is output to the software, and when the actual sampling frequency does not match the theoretical sampling frequency, a signal 0 is output to the software, thereby The software indicates that the currently configured theoretical sampling frequency does not match the actual sampling frequency. Of course, it is also possible to output 0 when matching and 1 when not matching.
本申请实施例提供的数字音频信号的采样频率的检测方法,利用参考时钟信号和数字音频信号的采样率时钟信号计算所述数字音频信号的采样频率,从而实现对所述数字音频信号的采样频率的实时检测,当检测到的所述数字音频信号的采样频率与预设的理论采样频率不匹配时,输出检测结果,使得控制软件能够及时调节所述数字音频信号的采样频率或调节所述理论采样频率。因此,本申请实施例提供的方法,能够在所述数字音频信号的采样频率与预先配置的理论采样频率不匹配时输出检测结果,起到防止音频放大芯片在软件配置采样频率错误时发生损坏的作用。The method for detecting the sampling frequency of a digital audio signal provided by an embodiment of the present application calculates the sampling frequency of the digital audio signal using a reference clock signal and a sampling rate clock signal of the digital audio signal, thereby realizing the sampling frequency of the digital audio signal Real-time detection of, when the detected sampling frequency of the digital audio signal does not match the preset theoretical sampling frequency, the detection result is output, so that the control software can timely adjust the sampling frequency of the digital audio signal or adjust the theory Sampling frequency. Therefore, the method provided by the embodiments of the present application can output the detection result when the sampling frequency of the digital audio signal does not match the pre-configured theoretical sampling frequency, thereby preventing the audio amplifier chip from being damaged when the sampling frequency of the software configuration is wrong effect.
本申请另一实施例还提供了一种数字音频信号的采样频率的检测方法,请参考图2,所述方法包括以下步骤:Another embodiment of the present application also provides a method for detecting the sampling frequency of a digital audio signal, please refer to FIG. 2, the method includes the following steps:
S201、获取初始参考时钟信号和采样率时钟信号。S201. Acquire an initial reference clock signal and a sampling rate clock signal.
需要说明的是,不同于上述实施例,本申请实施例对于获取的初始参考时钟信号不做要求,也就是说,本申请实施例的步骤S201中获取的初始参考时钟信号,可以是相对于所述采样率时钟信号的快速时钟信号,也就是频率大于所述采样率时钟信号的频率的时钟信号,也可以不与所述采样率时钟信号同步。It should be noted that, unlike the above-mentioned embodiment, the embodiment of the present application does not require an initial reference clock signal to be acquired, that is to say, the initial reference clock signal acquired in step S201 of the embodiment of the present application may be relative to all The fast clock signal of the sampling rate clock signal, that is, the clock signal having a frequency greater than the frequency of the sampling rate clock signal, may not be synchronized with the sampling rate clock signal.
实际上,本申请实施例获取的初始参考时钟信号,通常是集成了所述数字音频放大芯片的音频播放设备的标准时钟信号,所述标准时钟信号的频率较高,通常为1MHz,远高于数字音频信号常见的采样频率范围(即8KHz到48KHz),且所述标准时钟信号的相位是所述音频播放设备启动后就固定的,因此通常也不会与数字音频信号的采样率时钟信号同步。In fact, the initial reference clock signal obtained in this embodiment of the present application is usually a standard clock signal of an audio playback device integrated with the digital audio amplifier chip, and the frequency of the standard clock signal is relatively high, usually 1 MHz, which is much higher than The common sampling frequency range of digital audio signals (ie 8KHz to 48KHz), and the phase of the standard clock signal is fixed after the audio playback device is started, so it is usually not synchronized with the sampling rate clock signal of the digital audio signal .
S202、对初始参考时钟信号进行分频处理,得到第一参考时钟信号。S202. Perform frequency division processing on the initial reference clock signal to obtain a first reference clock signal.
上述第一参考时钟信号为对初始参考时钟信号分频后得到的,频率小于采样率时钟信号的频率的参考时钟信号。The first reference clock signal is a reference clock signal obtained by dividing the initial reference clock signal and having a frequency less than the frequency of the sampling rate clock signal.
需要说明的是,所述对初始参考时钟信号进行分频处理,是通过分频器实现的,也就是将所述初始参考时钟信号输入分频器,经过分频器处理后,就得到第一参考时钟信号。It should be noted that the frequency division processing of the initial reference clock signal is implemented by a frequency divider, that is, the initial reference clock signal is input to the frequency divider, and after the frequency divider processing, the first Reference clock signal.
所述分频器的结构及其工作原理属于现有技术,此处不再赘述。The structure and working principle of the frequency divider belong to the prior art, and will not be repeated here.
需要说明的是,所述对初始参考时钟信号进行分频处理,得到频率小于所述采样率时钟信号的频率的参考时钟信号,可以认为是对频率高于预设频率(或者说预设阈值)的参考时钟信号进行分频处理,得到频率为预设频率的参考时钟信号(即第一参考时钟信号),其中所述预设频率是小于所述采样率时钟信号的频率。It should be noted that the frequency division processing of the initial reference clock signal to obtain a reference clock signal whose frequency is less than the frequency of the sampling rate clock signal may be considered to be a frequency higher than a preset frequency (or a preset threshold) The reference clock signal is divided by frequency to obtain a reference clock signal whose frequency is a preset frequency (ie, the first reference clock signal), where the preset frequency is less than the frequency of the sampling rate clock signal.
具体的,可以是对频率大于1KHz的初始参考时钟信号进行分频,得到频率为1KHz的第一参考时钟信号,当输入的初始参考时钟信号频率小于或等于1KHz时,不进行分频处理。上述判断输入的初始参考时钟信号是否小于预设频率的步骤,实际上是由分频器自动实现的,或者说,分频器工作时,会根据所述预设的频率自动对输入的信号进行筛选,仅对筛选出的频率大于所述预设的频率的信号进行分频处理。Specifically, the initial reference clock signal with a frequency greater than 1 KHz may be divided to obtain a first reference clock signal with a frequency of 1 KHz. When the frequency of the input initial reference clock signal is less than or equal to 1 KHz, no frequency division processing is performed. The above step of determining whether the input initial reference clock signal is less than the preset frequency is actually realized automatically by the frequency divider, or in other words, when the frequency divider is working, the input signal will be automatically performed according to the preset frequency For screening, only the signal with a frequency greater than the preset frequency is subjected to frequency division processing.
需要说明的是,上述预设的频率也可以是大于1KHz或小于1KHz的其他值,只要保证所述预设频率低于或等于需要检测的数字音频信号的采样频率范围的下限即可。例如,对于常见的数字音频信号,其采样频率通常在8KHz到48KHz之间,因此所述预设的采样频率可以小于或等于8KHz。但为了避免采样频率出现波动,并更准确的计算所述采样率时钟信号在所述参考时钟信号的一个周期的脉冲数,推荐在设定所述预设频率时使其与所述采样频率范围的下限保持一定的差值,例如,对于8KHz到48KHz范围内的采样频率,推荐使所述预设频率小于或等于5KHz。It should be noted that the above-mentioned preset frequency may also be other values greater than 1 KHz or less than 1 KHz, as long as the preset frequency is lower than or equal to the lower limit of the sampling frequency range of the digital audio signal to be detected. For example, for a common digital audio signal, the sampling frequency is usually between 8KHz and 48KHz, so the preset sampling frequency may be less than or equal to 8KHz. However, in order to avoid fluctuations in the sampling frequency and more accurately calculate the number of pulses of the sampling rate clock signal in one cycle of the reference clock signal, it is recommended to set the preset frequency to the sampling frequency range The lower limit of is kept at a certain difference. For example, for a sampling frequency in the range of 8KHz to 48KHz, it is recommended to make the preset frequency less than or equal to 5KHz.
S203、对第一参考时钟信号进行调整,得到第二参考时钟信号。S203. Adjust the first reference clock signal to obtain a second reference clock signal.
第二参考时钟信号为与所述采样率时钟信号同步的参考时钟信号。The second reference clock signal is a reference clock signal synchronized with the sampling rate clock signal.
需要说明的是,所述第二参考时钟信号与采样率时钟信号同步是指,当所 述第二参考时钟信号从低电平跳变至高电平,所述采样率时钟信号也从低电平跳变至高电平,或者说,第二参考时钟信号的每一个上升沿都同时对应一个所述采样率时钟信号的上升沿。It should be noted that the synchronization of the second reference clock signal and the sampling rate clock signal means that when the second reference clock signal transitions from low level to high level, the sampling rate clock signal also changes from low level Jump to a high level, or each rising edge of the second reference clock signal simultaneously corresponds to a rising edge of the sampling rate clock signal.
需要说明的是,步骤S202和S203对于实现本发明提供的检测方法并不是必须的。如本申请提供的上一个实施例所述,当获取的初始参考时钟信号相对于所述采样率时钟信号是慢速时钟信号,且与所述采样率时钟信号同步时,步骤S202和S203可以不执行,而直接将初始参考时钟信号作为第二参考时钟信号。当然,也可以只执行S202或S203中的任意一步而不执行另一步,然后将处理后的参考时钟信号作为第二参考时钟信号,只要获取的初始参考时钟信号是满足对应的需要的参考时钟信号即可。It should be noted that steps S202 and S203 are not necessary for implementing the detection method provided by the present invention. As described in the previous embodiment provided by the present application, when the acquired initial reference clock signal is a slow clock signal with respect to the sampling rate clock signal and is synchronized with the sampling rate clock signal, steps S202 and S203 may not Execution, and the initial reference clock signal is directly used as the second reference clock signal. Of course, it is also possible to perform only one step in S202 or S203 without performing another step, and then use the processed reference clock signal as the second reference clock signal, as long as the acquired initial reference clock signal is a reference clock signal that meets the corresponding needs That's it.
通过增加步骤S202和步骤S203,可以扩宽本申请实施例提供的频率检测方法的适用范围,使本申请实施例可以在无法获取到频率足够低且与所述采样率时钟信号同步的参考时钟信号时也能正常工作,完成对数字音频信号的采样频率的实时检测。By adding step S202 and step S203, the scope of application of the frequency detection method provided by the embodiment of the present application can be expanded, so that the reference clock signal with a sufficiently low frequency and synchronized with the sampling rate clock signal cannot be obtained in the embodiment of the present application It can also work normally when the real-time detection of the sampling frequency of digital audio signals is completed.
S204、统计第二参考时钟信号的N个周期内,所述采样率时钟信号的总脉冲数。S204. Count the total pulses of the sampling rate clock signal in N cycles of the second reference clock signal.
所述N是预设的正整数。The N is a preset positive integer.
可选的,所述N可以设置为32或64,也可以设置为其他正整数。Optionally, the N may be set to 32 or 64, or may be set to other positive integers.
S205、用总脉冲数除以N,得到采样率时钟信号在第二参考时钟信号的一个周期内的脉冲数。S205. Divide the total pulse number by N to obtain the pulse number of the sampling rate clock signal within one cycle of the second reference clock signal.
步骤S204和步骤S205可以理解成是,对所述第二参考时钟信号的多个周期内采样率时钟信号的总脉冲数进行平均,将得到的平均值作为所述采样率时钟信号在所述第二参考时钟信号的一个周期内的脉冲数。Steps S204 and S205 can be understood as averaging the total number of pulses of the sampling rate clock signal in multiple cycles of the second reference clock signal, and using the obtained average value as the sampling rate clock signal in the first The number of pulses in one cycle of the reference clock signal.
需要说明的是,步骤S204和步骤S205是可选的。执行步骤S204和步骤S205是因为,所述第二参考时钟信号存在一定的误差,或者说可能会产生波动,因此通过多个周期内的总脉冲数取平均以计算一个周期内的脉冲数,以避免由于第二参考时钟信号的波动导致的误判。如果第二参考时钟信号波动程度较低,不会产生或不会频繁产生误判,又或者允许方法执行过程中出现误判,那么可以不执行步骤S204和步骤S205,直接统计采样率时钟信号一个周期内的脉冲数 即可,而不必对多个周期内的总脉冲数取平均。It should be noted that step S204 and step S205 are optional. Steps S204 and S205 are performed because there is a certain error in the second reference clock signal, or there may be fluctuations, so the total number of pulses in multiple cycles is averaged to calculate the number of pulses in one cycle to Avoid misjudgment due to fluctuations in the second reference clock signal. If the second reference clock signal fluctuates to a low degree, does not generate or does not generate misjudgments frequently, or allows misjudgments to occur during the execution of the method, then step S204 and step S205 may not be performed and a sample rate clock signal may be directly counted The number of pulses in a cycle is sufficient, instead of averaging the total number of pulses in multiple cycles.
需要说明的是,所述计算采样率时钟信号在第二参考时钟信号的一个周期内的脉冲数,也可以认为是,计算在所述第二参考时钟信号经过了一个周期后,所述采样率时钟信号经过的周期数,也就是说,计算得到的所述第二参考时钟信号一个周期内的采样率时钟信号的脉冲数,可以认为是所述采样率时钟信号的频率与所述第二参考时钟信号的频率的比值。It should be noted that the calculation of the pulse number of the sampling rate clock signal within one cycle of the second reference clock signal can also be considered as the calculation of the sampling rate after the second reference clock signal has passed one cycle The number of cycles elapsed by the clock signal, that is, the calculated pulse number of the sampling rate clock signal within one cycle of the second reference clock signal can be considered as the frequency of the sampling rate clock signal and the second reference The ratio of the frequency of the clock signal.
S206、根据所述脉冲数和第二参考时钟信号的频率,计算所述数字音频信号的采样频率。S206. Calculate the sampling frequency of the digital audio signal according to the number of pulses and the frequency of the second reference clock signal.
需要说明的是,步骤S206的具体实现方式可以是,用所述脉冲数乘以所述第二参考时钟信号的频率,得到的结果即为所述采样率时钟信号的频率,也就是所述数字音频信号的采样频率(或者说实际采样频率)。It should be noted that the specific implementation of step S206 may be: multiplying the number of pulses by the frequency of the second reference clock signal, and the result obtained is the frequency of the sampling rate clock signal, that is, the number The sampling frequency of the audio signal (or the actual sampling frequency).
S207、计算所述数字音频信号的采样频率与理论采样频率的差值。S207. Calculate the difference between the sampling frequency of the digital audio signal and the theoretical sampling frequency.
需要说明的是,所述理论采样频率是,采样率译码单元对采样率编码进行译码后得到的采样频率,所述采样率编码由软件通过寄存器预先配置。It should be noted that the theoretical sampling frequency is a sampling frequency obtained after the sampling rate decoding unit decodes the sampling rate code, and the sampling rate code is pre-configured by software through a register.
S208、判断所述差值的绝对值是否小于预设的阈值,得到判断结果。S208. Determine whether the absolute value of the difference is less than a preset threshold to obtain a judgment result.
其中,若所述差值的绝对值大于或等于所述阈值,则确定所述数字音频信号的采样频率与所述理论采样频率不匹配;若所述差值的绝对值小于所述阈值,则确定所述数字音频信号的采样频率与所述理论采样频率匹配。Wherein, if the absolute value of the difference is greater than or equal to the threshold, it is determined that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency; if the absolute value of the difference is less than the threshold, then It is determined that the sampling frequency of the digital audio signal matches the theoretical sampling frequency.
可选的,所述阈值可以设定为50Hz,也可以设定为其他值,推荐取值范围在0Hz到100Hz。Optionally, the threshold may be set to 50 Hz or other values, and the recommended value range is 0 Hz to 100 Hz.
S209、若判断结果表明数字音频信号的采样频率与理论采样频率不匹配,则输出判断结果。S209. If the judgment result indicates that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency, the judgment result is output.
本申请实施例提供的方法,在实现对数字音频信号的采样频率的实时检测的基础上,通过增设步骤S202和步骤S203扩展了本申请实施例提供的方法的适用范围,并利用统计所述参考时钟信号的多个周期内的采样率时钟信号的总脉冲数然后取平均的方法有效避免了因为参考时钟信号的波动导致的误判。The method provided by the embodiment of the present application, on the basis of real-time detection of the sampling frequency of the digital audio signal, extends the scope of application of the method provided by the embodiment of the present application by adding steps S202 and S203, and utilizes the statistical reference The method of sampling the total pulse number of the clock signal in multiple cycles of the clock signal and then averaging effectively avoids the misjudgment caused by the fluctuation of the reference clock signal.
基于上述数字音频信号的采样频率的检测方法,本申请另一实施例提供了一种数字音频信号的采样频率的采样装置,请参考图3,所述装置包括:Based on the method for detecting the sampling frequency of the digital audio signal, another embodiment of the present application provides a sampling device for the sampling frequency of a digital audio signal, please refer to FIG. 3, the device includes:
计算单元301,用于获取参考时钟信号和采样率时钟信号,并计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数。The calculating unit 301 is configured to acquire a reference clock signal and a sampling rate clock signal, and calculate the pulse number of the sampling rate clock signal within one cycle of the reference clock signal.
需要说明的是,上述参考时钟信号的频率小于采样率时钟信号的频率,并且,参考时钟信号和采样率时钟信号同步。It should be noted that the frequency of the reference clock signal is less than the frequency of the sampling rate clock signal, and the reference clock signal and the sampling rate clock signal are synchronized.
比较单元302,用于根据所述脉冲数和所述参考时钟信号的频率计算所述数字音频信号的采样频率,并判断所述数字音频信号的采样频率与预先配置的理论采样频率是否匹配,得到判断结果,若所述判断结果表明所述数字音频信号的采样频率与所述理论采样频率不匹配,则输出所述判断结果。The comparing unit 302 is used to calculate the sampling frequency of the digital audio signal according to the number of pulses and the frequency of the reference clock signal, and determine whether the sampling frequency of the digital audio signal matches the pre-configured theoretical sampling frequency to obtain Judgment result, if the judgment result indicates that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency, the judgment result is output.
本申请实施例提供的装置的工作原理与上述本申请第一个实施例提供的频率检测方法一致,此处不再赘述。The working principle of the device provided by the embodiment of the present application is consistent with the frequency detection method provided by the above-mentioned first embodiment of the present application, and will not be repeated here.
本申请实施例提供的检测装置中,计算单元301和比较单元302根据参考时钟信号的频率计算出数字音频信号的采样率时钟信号的频率,也就是数字音频信号的采样频率,然后比较单元302判断所述数字音频信号的采样频率和软件预先配置的理论采样频率是否匹配,在两个频率不匹配时输出判断结果,使得软件能够及时调整数字音频信号的采样频率,或者修正所述理论采样频率,从而实现对数字音频信号的采样频率的实时检测,有效避免了数字音频信号的采样频率与所述理论采样频率不匹配导致的音频放大芯片的损坏。In the detection device provided in the embodiment of the present application, the calculation unit 301 and the comparison unit 302 calculate the sampling rate of the digital audio signal according to the frequency of the reference clock signal, that is, the sampling frequency of the digital audio signal, and then the comparison unit 302 determines Whether the sampling frequency of the digital audio signal matches the theoretical sampling frequency pre-configured by the software, and outputs a judgment result when the two frequencies do not match, so that the software can adjust the sampling frequency of the digital audio signal in time, or modify the theoretical sampling frequency, Thereby, real-time detection of the sampling frequency of the digital audio signal is realized, and the damage of the audio amplification chip caused by the mismatch of the sampling frequency of the digital audio signal and the theoretical sampling frequency is effectively avoided.
本申请实施例还提供了一种数字音频信号的采样频率的检测装置,请参考图4,所述装置包括:An embodiment of the present application further provides a device for detecting the sampling frequency of a digital audio signal, please refer to FIG. 4, the device includes:
分频器401,用于获取参考时钟信号OSC,并对参考时钟信号OSC进行分频处理,得到频率小于采样率时钟信号的频率的参考时钟信号CLK_REF(记为第一参考信号)。The frequency divider 401 is used to obtain the reference clock signal OSC, and divide the reference clock signal OSC to obtain a reference clock signal CLK_REF (denoted as a first reference signal) whose frequency is less than the frequency of the sampling rate clock signal.
同步单元402,用于获取分频器401输出的频率小于采样率时钟信号的参考时钟信号CLK_REF和采样率时钟信号WCK,并对参考时钟信号CLK_REF进行调整,得到与采样率时钟信号WCK同步的参考时钟信号CLK_REF_SYNC(记为同步参考信号)。The synchronization unit 402 is used to obtain the reference clock signal CLK_REF and the sampling rate clock signal WCK whose frequency output from the frequency divider 401 is less than the sampling rate clock signal, and adjust the reference clock signal CLK_REF to obtain a reference synchronized with the sampling rate clock signal WCK Clock signal CLK_REF_SYNC (denoted as synchronization reference signal).
其中,同步单元402可以采用触发器来实现,例如T触发器,D触发器等。The synchronization unit 402 can be implemented by flip-flops, such as T flip-flops and D flip-flops.
需要说明的是,分频器401和同步单元402是可选的。若参考时钟信号OSC 的频率小于采样率时钟信号WCK,且参考时钟信号OSC是与采样率时钟信号WCK同步的信号,则参考时钟信号OSC可以不经过分频器401和同步单元402处理,直接输入计算单元403。It should be noted that the frequency divider 401 and the synchronization unit 402 are optional. If the frequency of the reference clock signal OSC is less than the sampling rate clock signal WCK, and the reference clock signal OSC is a signal synchronized with the sampling rate clock signal WCK, the reference clock signal OSC can be directly input without being processed by the frequency divider 401 and the synchronization unit 402 Calculation unit 403.
计算单元403,用于获取同步单元402输出的参考时钟信号CLK_REF_SYNC和采样率时钟信号WCK,并计算所述采样率时钟信号WCK在参考时钟信号CLK_REF_SYNC的一个周期内的脉冲数。The calculation unit 403 is configured to acquire the reference clock signal CLK_REF_SYNC and the sampling rate clock signal WCK output by the synchronization unit 402, and calculate the number of pulses of the sampling rate clock signal WCK within one cycle of the reference clock signal CLK_REF_SYNC.
其中,计算单元403可以采用带有同步使能和锁存功能的计数器,也可以采用移位寄存器和具有锁存功能的器件。The calculation unit 403 may use a counter with synchronization enabling and latching functions, and may also use a shift register and a device with latching functions.
可选的,本申请的另一实施例中,计算单元403,包括:Optionally, in another embodiment of the present application, the calculation unit 403 includes:
计数单元,用于获取参考时钟信号和采样率时钟信号,并计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数。The counting unit is used to acquire the reference clock signal and the sampling rate clock signal, and calculate the pulse number of the sampling rate clock signal within one cycle of the reference clock signal.
锁存单元,用于保存计算得到的脉冲数。The latch unit is used to store the calculated pulse number.
可选的,本申请的另一实施例中,计算单元403,包括:Optionally, in another embodiment of the present application, the calculation unit 403 includes:
计数单元,用于获取参考时钟信号和采样率时钟信号,并统计所述参考时钟信号的N个周期内,所述采样率时钟信号的总脉冲数,所述N是预设的正整数。The counting unit is used to obtain a reference clock signal and a sampling rate clock signal, and to count the total number of pulses of the sampling rate clock signal in N cycles of the reference clock signal, where N is a preset positive integer.
锁存单元,用于保存计算得到的脉冲数。The latch unit is used to store the calculated pulse number.
计数平均单元,用于获取所述总脉冲数,并用所述总脉冲数除以N,得到所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数WCK_AVG[5:0](记为平均脉冲数)。The counting and averaging unit is used to obtain the total pulse number and divide the total pulse number by N to obtain the pulse number of the sampling rate clock signal within one cycle of the reference clock signal WCK_AVG[5:0]( Recorded as the average number of pulses).
其中,计数平均单元,一般采用移位的加法器来实现。Among them, the counting and averaging unit is generally implemented by a shifted adder.
比较单元404,用于根据所述脉冲数和所述参考时钟信号的频率计算所述数字音频信号的采样频率,并判断所述数字音频信号的采样频率与预先配置的理论采样频率是否匹配,得到判断结果,若所述判断结果表明所述数字音频信号的采样频率与所述理论采样频率不匹配,则输出所述判断结果。The comparing unit 404 is used to calculate the sampling frequency of the digital audio signal according to the number of pulses and the frequency of the reference clock signal, and determine whether the sampling frequency of the digital audio signal matches the pre-configured theoretical sampling frequency to obtain Judgment result, if the judgment result indicates that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency, the judgment result is output.
其中,比较单元404基本上可以采用带有计算功能的比较器,或者计算器与异或门阵列组合来实现。The comparison unit 404 can basically be implemented by a comparator with a calculation function, or a combination of a calculator and an XOR gate array.
可选的,本申请的另一实施例中,比较单元404的工作原理是,根据参考时钟信号的频率和计算单元403输入的脉冲数计算数字音频信号的采样频率, 然后计算所述数字音频信号的采样频率和理论采样频率的差值,并对比所述差值的绝对值和预设的阈值,若所述差值的绝对值小于或等于阈值,则判断出所述数字音频信号的采样频率与所述理论频率匹配,否则,判断出所述数字音频信号的采样频率与所述理论频率不匹配,若判断出所述数字音频信号的采样频率和所述理论采样频率不匹配,则输出判断结果。Optionally, in another embodiment of the present application, the working principle of the comparison unit 404 is to calculate the sampling frequency of the digital audio signal according to the frequency of the reference clock signal and the number of pulses input by the calculation unit 403, and then calculate the digital audio signal The difference between the sampling frequency and the theoretical sampling frequency, and comparing the absolute value of the difference with a preset threshold, if the absolute value of the difference is less than or equal to the threshold, the sampling frequency of the digital audio signal is determined Matches the theoretical frequency, otherwise, it is determined that the sampling frequency of the digital audio signal does not match the theoretical frequency, and if it is determined that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency, the judgment is output result.
可选的,本申请另一实施例中,同样还参见图4,所述装置还包括:Optionally, in another embodiment of the present application, also referring to FIG. 4, the device further includes:
采样率译码单元405,用于对软件通过寄存器预先配置的采样率编码I2SSR[3:0]进行译码,得到理论采样频率SR_CODE[5:0]。The sampling rate decoding unit 405 is used to decode the sampling rate code I2SSR[3:0] pre-configured by the software through the register to obtain the theoretical sampling frequency SR_CODE[5:0].
其中,采样率译码单元405与比较单元404相连,将译码得到的理论采样频率SR_CODE[5:0]发送至比较单元404。The sampling rate decoding unit 405 is connected to the comparison unit 404, and sends the decoded theoretical sampling frequency SR_CODE[5:0] to the comparison unit 404.
需要指出的是采样率译码单元可以是采样译码器。It should be pointed out that the sampling rate decoding unit may be a sampling decoder.
本申请实施例提供的装置,在有效地实时检测数字音频信号的采样频率的基础上,通过在计算单元之前增设分频器和同步单元,有效扩宽了本申请实施例提供的装置的适用范围,同时在所述计算单元中设置计数平均单元,对所述参考时钟信号的多个周期内的总脉冲数进行平均,得到所述参考时钟信号的一个周期内的脉冲数,从而避免由于所述参考时钟信号波动导致的误判。The device provided by the embodiment of the present application effectively expands the scope of application of the device provided by the embodiment of the present application on the basis of effectively detecting the sampling frequency of the digital audio signal in real time, by adding a frequency divider and a synchronization unit before the computing unit At the same time, a counting and averaging unit is provided in the calculation unit to average the total number of pulses in multiple cycles of the reference clock signal to obtain the number of pulses in one cycle of the reference clock signal, thereby avoiding Misjudgment caused by reference clock signal fluctuations.
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本申请。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本申请的精神或范围的情况下,在其它实施例中实现。因此,本申请将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments enables those skilled in the art to implement or use this application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown in this document, but should conform to the widest scope consistent with the principles and novel features disclosed in this document.

Claims (13)

  1. 一种数字音频信号的采样频率的检测方法,其特征在于,包括:A method for detecting the sampling frequency of a digital audio signal, characterized in that it includes:
    获取参考时钟信号和采样率时钟信号;Obtain reference clock signal and sampling rate clock signal;
    计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数;Calculating the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal;
    根据所述脉冲数和所述参考时钟信号的频率,计算所述数字音频信号的采样频率;Calculating the sampling frequency of the digital audio signal according to the number of pulses and the frequency of the reference clock signal;
    判断所述数字音频信号的采样频率与预先配置的理论采样频率是否匹配,得到判断结果;Judging whether the sampling frequency of the digital audio signal matches the pre-configured theoretical sampling frequency to obtain a judgment result;
    若所述判断结果表明所述数字音频信号的采样频率与所述理论采样频率不匹配,则输出所述判断结果。If the judgment result indicates that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency, the judgment result is output.
  2. 根据权利要求1所述的方法,其特征在于,所述计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数之前,还包括:The method according to claim 1, wherein the calculating the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal further comprises:
    对所述参考时钟信号进行分频处理,得到频率小于所述采样率时钟信号的频率的参考时钟信号。Frequency-dividing the reference clock signal to obtain a reference clock signal whose frequency is less than the frequency of the sampling rate clock signal.
  3. 根据权利要求1所述的方法,其特征在于,所述计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数之前,还包括:The method according to claim 1, wherein the calculating the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal further comprises:
    对所述参考时钟信号进行调整,得到与所述采样率时钟信号同步的参考时钟信号。Adjusting the reference clock signal to obtain a reference clock signal synchronized with the sampling rate clock signal.
  4. 根据权利要求1所述的方法,其特征在于,所述计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数,包括:The method according to claim 1, wherein the calculating the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal comprises:
    计算所述参考时钟信号的N个周期内,所述采样率时钟信号的总脉冲数,所述N是预设的正整数;Calculating the total pulse number of the sampling rate clock signal in N cycles of the reference clock signal, where N is a preset positive integer;
    用所述总脉冲数除以N,得到所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数。Divide the total number of pulses by N to obtain the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal.
  5. 根据权利要求1所述的方法,其特征在于,所述判断所述数字音频信号的采样频率与预先配置的理论采样频率是否匹配,得到判断结果,包括:The method according to claim 1, wherein the judging whether the sampling frequency of the digital audio signal matches a pre-configured theoretical sampling frequency to obtain a judgment result includes:
    计算所述数字音频信号的采样频率与理论采样频率的差值;Calculating the difference between the sampling frequency of the digital audio signal and the theoretical sampling frequency;
    判断所述差值的绝对值是否小于预设的阈值;Determine whether the absolute value of the difference is less than a preset threshold;
    其中,若所述差值的绝对值大于或等于所述阈值,则确定所述数字音频信 号的采样频率与所述理论采样频率不匹配;若所述差值的绝对值小于所述阈值,则确定所述数字音频信号的采样频率与所述理论采样频率匹配。Wherein, if the absolute value of the difference is greater than or equal to the threshold, it is determined that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency; if the absolute value of the difference is less than the threshold, then It is determined that the sampling frequency of the digital audio signal matches the theoretical sampling frequency.
  6. 根据权利要求1所述的方法,其特征在于,所述参考时钟信号的频率小于所述采样率时钟信号的频率,且与所述采样率时钟信号同步。The method of claim 1, wherein the frequency of the reference clock signal is less than the frequency of the sampling rate clock signal and is synchronized with the sampling rate clock signal.
  7. 一种数字音频信号的采样频率的检测装置,其特征在于,包括:An apparatus for detecting the sampling frequency of a digital audio signal is characterized in that it includes:
    计算单元,用于获取参考时钟信号和采样率时钟信号,并计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数;A calculation unit, configured to acquire a reference clock signal and a sampling rate clock signal, and calculate the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal;
    比较单元,用于根据所述脉冲数和所述参考时钟信号的频率计算所述数字音频信号的采样频率,并判断所述数字音频信号的采样频率与预先配置的理论采样频率是否匹配,得到判断结果,若所述判断结果表明所述数字音频信号的采样频率与所述理论采样频率不匹配,则输出所述判断结果。The comparison unit is used to calculate the sampling frequency of the digital audio signal according to the number of pulses and the frequency of the reference clock signal, and determine whether the sampling frequency of the digital audio signal matches the pre-configured theoretical sampling frequency to obtain a judgment As a result, if the judgment result indicates that the sampling frequency of the digital audio signal does not match the theoretical sampling frequency, the judgment result is output.
  8. 根据权利要求7所述的装置,其特征在于,所述计算单元,包括:The apparatus according to claim 7, wherein the calculation unit comprises:
    计数单元,用于获取参考时钟信号和采样率时钟信号,并计算所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数;The counting unit is used to obtain the reference clock signal and the sampling rate clock signal, and calculate the pulse number of the sampling rate clock signal within one cycle of the reference clock signal;
    锁存单元,用于保存计算得到的脉冲数。The latch unit is used to store the calculated pulse number.
  9. 根据权利要求7所述的装置,其特征在于,所述计算单元,包括:The apparatus according to claim 7, wherein the calculation unit comprises:
    计数单元,用于获取参考时钟信号和采样率时钟信号,并计算所述参考时钟信号的N个周期内,所述采样率时钟信号的总脉冲数,所述N是预设的正整数;The counting unit is used to obtain a reference clock signal and a sampling rate clock signal, and calculate the total number of pulses of the sampling rate clock signal in N cycles of the reference clock signal, where N is a preset positive integer;
    锁存单元,用于保存计算得到的总脉冲数;Latch unit, used to save the calculated total pulse number;
    计数平均单元,用于获取所述总脉冲数,并用所述总脉冲数除以N,得到所述采样率时钟信号在所述参考时钟信号的一个周期内的脉冲数。A counting and averaging unit is used to obtain the total number of pulses, and divide the total number of pulses by N to obtain the number of pulses of the sampling rate clock signal within one cycle of the reference clock signal.
  10. 根据权利要求7所述的装置,其特征在于,还包括:The device according to claim 7, further comprising:
    分频器,用于获取所述参考时钟信号,并对所述参考时钟信号进行分频处理,得到频率小于采样率时钟信号的频率的参考时钟信号;A frequency divider, configured to obtain the reference clock signal and divide the reference clock signal to obtain a reference clock signal whose frequency is less than the frequency of the sampling rate clock signal;
    其中,所述计算单元获取的参考时钟信号是:所述分频器输出的频率小于所述采样率时钟信号的频率的参考时钟信号。Wherein, the reference clock signal acquired by the calculation unit is: a reference clock signal whose frequency output by the frequency divider is less than the frequency of the sampling rate clock signal.
  11. 根据权利要求7所述的装置,其特征在于,还包括:The device according to claim 7, further comprising:
    同步单元,用于获取参考时钟信号和采样率时钟信号,并对所述参考时钟 信号进行调整,得到与所述采样率时钟信号同步的参考时钟信号;A synchronization unit, configured to obtain a reference clock signal and a sampling rate clock signal, and adjust the reference clock signal to obtain a reference clock signal synchronized with the sampling rate clock signal;
    其中,所述计算单元获取的参考时钟信号是:所述同步单元输出的与所述采样率时钟信号同步的参考时钟信号。Wherein, the reference clock signal acquired by the calculation unit is: a reference clock signal output by the synchronization unit and synchronized with the sampling rate clock signal.
  12. 根据权利要求7所述的装置,其特征在于,还包括:The device according to claim 7, further comprising:
    采样率译码单元,用于对预先配置的采样率编码进行译码,得到所述理论采样频率。The sampling rate decoding unit is used for decoding the pre-configured sampling rate code to obtain the theoretical sampling frequency.
  13. 根据权利要求7所述的装置,其特征在于,所述参考时钟信号的频率小于所述采样率时钟信号的频率,且与所述采样率时钟信号同步。The apparatus according to claim 7, wherein the frequency of the reference clock signal is less than the frequency of the sampling rate clock signal and is synchronized with the sampling rate clock signal.
PCT/CN2020/070061 2019-01-09 2020-01-02 Digital audio signal sampling frequency detection method and device WO2020143521A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910020489.1 2019-01-09
CN201910020489.1A CN109459612A (en) 2019-01-09 2019-01-09 The detection method and device of the sample frequency of digital audio and video signals

Publications (1)

Publication Number Publication Date
WO2020143521A1 true WO2020143521A1 (en) 2020-07-16

Family

ID=65616154

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/070061 WO2020143521A1 (en) 2019-01-09 2020-01-02 Digital audio signal sampling frequency detection method and device

Country Status (2)

Country Link
CN (1) CN109459612A (en)
WO (1) WO2020143521A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109459612A (en) * 2019-01-09 2019-03-12 上海艾为电子技术股份有限公司 The detection method and device of the sample frequency of digital audio and video signals
CN109817230A (en) * 2019-03-27 2019-05-28 深圳悦美移动科技有限公司 A kind of the timing regeneration shaping methods and its device of digital audio and video signals
CN112748283A (en) * 2020-12-29 2021-05-04 成都前锋电子仪器有限责任公司 Audio signal sampling method, main control chip and audio module thereof

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1355434A (en) * 2000-11-30 2002-06-26 中国科学院微电子中心 Method and device for measuring frequency and period
US20100295535A1 (en) * 2009-05-20 2010-11-25 Seiko Epson Corporation Frequency measurement device
CN102621384A (en) * 2012-04-09 2012-08-01 浙江中控技术股份有限公司 Frequency measuring method and frequency measuring system
CN103698602A (en) * 2013-12-16 2014-04-02 北京自动化控制设备研究所 Large dynamic high-precision synchronization continuous frequency measurement method
CN104115403A (en) * 2012-10-24 2014-10-22 Abb技术有限公司 Pulse frequency measurement device and method and control system
CN106597096A (en) * 2016-12-02 2017-04-26 武汉新芯集成电路制造有限公司 Clock frequency monitoring method
CN109459612A (en) * 2019-01-09 2019-03-12 上海艾为电子技术股份有限公司 The detection method and device of the sample frequency of digital audio and video signals
CN209356576U (en) * 2019-01-09 2019-09-06 上海艾为电子技术股份有限公司 The detection device of the sample frequency of digital audio and video signals

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3591011B2 (en) * 1994-11-04 2004-11-17 ソニー株式会社 Digital signal processor
JP2003272283A (en) * 2002-03-14 2003-09-26 Victor Co Of Japan Ltd Recorder and recording medium for digital audio signal
JP4842669B2 (en) * 2006-02-27 2011-12-21 株式会社デジタル Anomaly detection device
CN101119110B (en) * 2006-07-31 2011-04-20 智原科技股份有限公司 Frequency comparator
JP5957810B2 (en) * 2011-06-06 2016-07-27 ソニー株式会社 Signal processing apparatus and signal processing method
CN103023507B (en) * 2012-12-06 2016-04-13 北京航天测控技术有限公司 The sampling clock generation method of DAC and device
JP6510487B2 (en) * 2013-03-26 2019-05-08 バラット, ラックラン, ポールBARRATT, Lachlan, Paul Voice filter using sine function
JP6807031B2 (en) * 2015-06-10 2021-01-06 ソニー株式会社 Signal processor, signal processing method, and program
CN105848057A (en) * 2016-04-20 2016-08-10 乐视控股(北京)有限公司 Audio processing method, device and terminal equipment
CN107919136B (en) * 2017-11-13 2021-07-09 河海大学 Digital voice sampling frequency estimation method based on Gaussian mixture model
CN108665905B (en) * 2018-05-18 2021-06-15 宁波大学 Digital voice resampling detection method based on frequency band bandwidth inconsistency

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1355434A (en) * 2000-11-30 2002-06-26 中国科学院微电子中心 Method and device for measuring frequency and period
US20100295535A1 (en) * 2009-05-20 2010-11-25 Seiko Epson Corporation Frequency measurement device
CN102621384A (en) * 2012-04-09 2012-08-01 浙江中控技术股份有限公司 Frequency measuring method and frequency measuring system
CN104115403A (en) * 2012-10-24 2014-10-22 Abb技术有限公司 Pulse frequency measurement device and method and control system
CN103698602A (en) * 2013-12-16 2014-04-02 北京自动化控制设备研究所 Large dynamic high-precision synchronization continuous frequency measurement method
CN106597096A (en) * 2016-12-02 2017-04-26 武汉新芯集成电路制造有限公司 Clock frequency monitoring method
CN109459612A (en) * 2019-01-09 2019-03-12 上海艾为电子技术股份有限公司 The detection method and device of the sample frequency of digital audio and video signals
CN209356576U (en) * 2019-01-09 2019-09-06 上海艾为电子技术股份有限公司 The detection device of the sample frequency of digital audio and video signals

Also Published As

Publication number Publication date
CN109459612A (en) 2019-03-12

Similar Documents

Publication Publication Date Title
WO2020143521A1 (en) Digital audio signal sampling frequency detection method and device
TWI439846B (en) Method and apparatus of controlling an operational status of an electronic device
TW201802700A (en) Systems and methods for controlling isochronous data streams
US10890939B2 (en) Recovery of reference clock on a device
US20190025872A1 (en) Usb device with clock domain correlation
CN209356576U (en) The detection device of the sample frequency of digital audio and video signals
EP3555726B1 (en) Clock gating enable generation
JP2007013853A (en) Audio processing apparatus
US8391469B2 (en) Methods and apparatus to decode dual-tone signals
TWI532037B (en) Integrated circuit,electronic device,computer program product and methods for controlling a gain
US7443213B2 (en) Staged locking of two phase locked loops
CN110061735B (en) Decimal frequency dividing circuit and interface clock frequency dividing circuit using same
TWI789240B (en) Audio processing apparatus and audio processing method for dynamically adjusting audio clock
US20200309832A1 (en) Method and apparatus for estimating a phase relation between binary signals
US7710294B2 (en) For externally clocked digital audio input, determining a valid clock and muting audio during synchronization
US20190181819A1 (en) Automatic gain control apparatus and automatic gain control method
TWI400923B (en) Signal receiving device and frequency judging circuit
JP4651348B2 (en) Digital audio adjustment device
US20130246833A1 (en) Clock generator and information processing apparatus
JP2000138588A (en) Pulse width signal converting circuit
CN113965662A (en) Audio and video output device and audio and video delay calibration method and related components thereof
JP2002305727A (en) Timing adjustment device
JP2001313963A (en) Mute circuit
JPH11317730A (en) Digital receiving device
JP2005017235A (en) Pulse width measuring device and method

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20738480

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20738480

Country of ref document: EP

Kind code of ref document: A1