Audio resampling frequency tracking method, audio chip and audio processing system
By configuring the interpolation kernel unit between the FIFO and DAC units and adjusting the preset values using formulas, the frequency inconsistency problem caused by frequency offset is solved, achieving low-cost and fast audio frequency tracking and ensuring the accuracy and synchronization of the audio resampling process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHUHAI HUGE IC CO LTD
- Filing Date
- 2026-02-03
- Publication Date
- 2026-05-01
AI Technical Summary
In system communication with different source clocks, frequency offset causes inconsistencies in frequency during audio resampling. Existing technologies require the use of high-precision analog PLLs for adjustment, resulting in large circuit area and high cost.
By configuring the interpolation kernel unit between the FIFO unit and the DAC unit, and adjusting the preset value of the interpolation kernel unit using formulas, the FIFO unit is kept in a non-empty and non-full state. Interpolation is performed using a farrow structure or Taylor expansion, avoiding the use of analog PLL for frequency tracking.
It enables fast and low-cost signal frequency tracking, avoids FIFO units being empty or full, ensures that the DAC unit does not experience power interruption, and achieves accuracy and time synchronization in the audio resampling process.
Smart Images

Figure CN121963756A_ABST
Abstract
Description
Audio resampling frequency tracking method, audio chip and audio processing system Technical Field
[0001] This invention belongs to the field of audio signal processing technology, specifically relating to an audio resampling frequency tracking method, an audio chip, and an audio processing system. Background Technology
[0002] Audio resampling refers to the process of changing parameters such as the sampling rate, sampling format, or number of channels of an audio signal, with the aim of making the audio data conform to specific playback, processing, or storage requirements. The main functions of audio resampling include standardizing audio parameters, ensuring compatibility with device requirements, and optimizing file size.
[0003] Frequency tracking during audio resampling is primarily to ensure the accuracy, sound quality, and time synchronization of the resampling process, avoiding distortion or delay. However, in system communication with two different source clocks, frequency offset often occurs. In this case, it is necessary to adjust the frequency of one side to make the rates of both sides consistent. In practical solutions, fractional division of a PLL (Phase-Locked Loop) is generally used for adjustment; however, fractional division of a PLL requires the implementation of an additional high-precision analog PLL, resulting in a relatively large circuit area. Summary of the Invention
[0004] This invention provides an audio resampling frequency tracking method, an audio chip, and an audio processing system, aiming to achieve fast signal frequency tracking at low cost. This invention is achieved through the following technical solutions:
[0005] In a first aspect, the present invention provides an audio resampling frequency tracking method, comprising:
[0006] S100: An interpolation kernel unit is configured between the FIFO unit and the DAC unit. The FIFO unit is used to receive and buffer the pre-amplifier audio data, and the DAC unit is used to play the resampled audio data.
[0007] S200, Configure the interpolation kernel unit to satisfy the following formula 1:
[0008] ——Formula 1;
[0009] Among them, FS in It is the sampling rate of the input signal of the interpolation kernel unit, FS. out It is a fixed sampling rate of the output signal of the interpolation kernel unit. It is a fixed upsampling rate. It is an adjustable downsampling rate;
[0010] S300, Control the interpolation kernel unit to... The preset value is adjusted to a target value, thereby adjusting FS.in Stabilize to a target sampling rate that can keep the FIFO unit in a non-empty and non-full state.
[0011] As a specific technical solution, the method for maintaining the FIFO unit in a non-empty and non-full state in step S300 includes:
[0012] Pre-configure the data volume of the FIFO unit Satisfy the following formula 2:
[0013] ——Formula 2;
[0014] in, This refers to the write pointer that indicates the index of the FIFO cell written to in the previous stage. Refers to the read pointer of the index read by the interpolation kernel unit;
[0015] By The preset value is adjusted to the target value, thereby adjusting the preset value to the target value. It is maintained at a constant value between the state of being fully empty.
[0016] As a specific technical solution, the aforementioned Methods for maintaining a constant value between the fully empty and empty states include:
[0017] A. Configure the half-empty threshold for the FIFO unit Half-air marker position Half-full threshold Half-full marker During the half-empty to half-full counting process, the DAC unit reads the count value of the data. During the counting process from half full to half empty, the DAC unit reads the count value of the data. ;
[0018] B. Real-time monitoring ,when equal Then the half-empty flag is triggered. And on Start adjusting, when equal This triggers the half-full flag. And on Start adjusting;
[0019] C. The preset value is gradually adjusted in increments to the target sampling rate FS that keeps the FIFO unit in a non-empty and non-full state. in The corresponding sampling rate.
[0020] As a specific technical solution, with equal Trigger half-full flag And on When adjustments begin, > Then, the next starting point For the present +Current adjustment step size / 2, when < At that time, the current state will be maintained. No change.
[0021] As a specific technical solution, with equal Triggering the half-empty flag And on When adjustments begin, > Then, the next starting point For the present - Adjust step size / 2, when < At that time, the current state will be maintained. No change.
[0022] As a specific technical solution, for When making adjustments, the initial adjustment step size is preset, and the subsequent adjustment step size is reduced by half each time. The number of bits in the initial adjustment step size is the number of iterations.
[0023] As a specific technical solution, the interpolation kernel unit adopts a linear interpolation method with a farrow structure or an interpolation method with Taylor expansion.
[0024] Secondly, the present invention provides an audio chip, including a FIFO unit, an interpolation kernel unit, and a DAC unit connected in sequence, wherein the FIFO unit, the interpolation kernel unit, and the DAC unit cooperate to perform the method steps of the above-mentioned audio resampling frequency tracking method.
[0025] Thirdly, the present invention also provides an audio processing system, including the audio chip described above and a real-time device for inputting audio signals to the audio chip.
[0026] The audio resampling frequency tracking method, audio chip, and audio processing system provided by this invention have the following advantages: This invention ensures that the FIFO unit will not be empty or full by configuring the interpolation kernel unit to track the signal frequency, and at the same time, it ensures that the DAC will not experience current interruption. Based on this technical approach, the signal frequency tracking algorithm is realized, achieving fast signal frequency tracking without using an analog PLL. This low-cost approach enables fast signal frequency tracking and allows for efficient and flexible audio resampling, which in turn allows for playback of the output results. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 is a flowchart of the audio resampling frequency tracking method provided in an embodiment of the present invention.
[0029] Figure 2 is a block diagram of the audio processing system provided in an embodiment of the present invention.
[0030] Figure 3 illustrates the definition of read and write pointers and data volume in the FIFO unit within the audio resampling frequency tracking method provided in this embodiment of the invention. A schematic diagram.
[0031] Figure 4 is a schematic diagram of defining half-empty threshold and half-full threshold in the FIFO unit in the audio resampling frequency tracking method provided in the embodiment of the present invention.
[0032] Figure 5 illustrates the first step in the video encoding method provided by this embodiment of the invention. Example diagram with adjustments made.
[0033] Figure 6 illustrates the second step in the video encoding method provided by an embodiment of the present invention. Example diagram with adjustments made. Detailed Implementation
[0034] To make the technical solution of the present invention clearer and its technical advantages more apparent, the technical solution of the present invention will be clearly and completely described below in conjunction with specific embodiments. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of the present invention.
[0035] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, components, features, and elements with the same names in different embodiments of this application may have the same meaning or different meanings, the specific meaning of which must be determined by its interpretation in that specific embodiment or further in conjunction with the context of that specific embodiment.
[0036] It should be understood that although the steps in the flowcharts of this application's embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.
[0037] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0038] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
[0039] Referring to Figures 1 and 2, this invention provides an audio resampling frequency tracking method, an audio chip, and an audio processing system, aiming to achieve fast signal frequency tracking at low cost. The audio chip includes a FIFO unit, an interpolation kernel unit, and a DAC unit connected in sequence. The FIFO unit, interpolation kernel unit, and DAC unit cooperate to execute the method steps of the above-described audio resampling frequency tracking method. The audio processing system includes the audio chip and a real-time device for inputting audio signals to the audio chip.
[0040] In this audio processing system, the real-time devices (labeled USB / WIFI / BT in Figure 2) can be USB, WIFI, BT, or other wireless devices. The FIFO unit is used to buffer the preceding data, and the DAC unit is used to play the resampled audio data. To achieve audio resampling frequency tracking, the main purpose of this embodiment is to ensure that the FIFO unit does not become empty or full, and to prevent the DAC unit from experiencing power interruptions. The interpolation kernel unit (referred to as the interpolation core) primarily performs sampling rate conversion on its input and output (as long as the sampling rates differ). The interpolation core can use linear interpolation with a farrow structure or Taylor expansion for interpolation. The interpolation core is not the main function of this invention. Finally, the DAC unit directly uses the output of the interpolation core for playback, completing the entire real-time playback process.
[0041] As shown in Figure 1, the audio resampling frequency tracking method provided in this embodiment includes:
[0042] S100: An interpolation kernel unit is configured between the FIFO unit and the DAC unit. The FIFO unit is used to receive and buffer the pre-amplifier audio data, and the DAC unit is used to play the resampled audio data.
[0043] S200, Configure the interpolation kernel unit to satisfy the following formula 1:
[0044] ——Formula 1;
[0045] Among them, FS in It is the sampling rate of the input signal of the interpolation kernel unit, FS. out It is a fixed sampling rate of the output signal of the interpolation kernel unit. It is a fixed upsampling rate. It is an adjustable downsampling rate;
[0046] S300, Control the interpolation kernel unit to... The default value is adjusted to a target value (target_val), thereby setting FS. in Stabilize to a target sampling rate that can keep the FIFO unit in a non-empty and non-full state.
[0047] The following describes the process of the tracking algorithm:
[0048] Since the interpolation core is configured to satisfy Equation 1; and since the DAC unit generally does not switch sampling rates, it is designed to be easy to operate. Fixed (e.g., an empirical value of 8192), so FS in and Positive correlation.
[0049] Furthermore, the FIFO unit structure is shown in Figure 3, and the data volume of the FIFO unit is pre-configured. The amount of data within a FIFO cell is determined by Formula 2, which satisfies the following condition:
[0050] ——Formula 2;
[0051] in, This refers to the write pointer that indicates the index of the FIFO cell written to in the previous stage. Refers to the read pointer of the index read by the interpolation kernel unit;
[0052] To maintain a FIFO cell in a non-empty and non-full state, it is necessary to... The preset value is adjusted to the target value, thereby adjusting the preset value to the target value. It is maintained at a constant value between the state of being fully empty.
[0053] Referring to Figure 4, further, the aforementioned Methods for maintaining a constant value between the fully empty and empty states include:
[0054] A. Configure the half-empty threshold for the FIFO unit Mid-air marker Half-full threshold Half-full mark During the half-empty to half-full counting process, the DAC unit reads the count value of the data. During the counting process from half full to half empty, the DAC unit reads the count value of the data. ;
[0055] B. Real-time monitoring ,when equal Then the half-empty flag is triggered. And on Start adjusting, when equal This triggers the half-full flag. And on Start adjusting;
[0056] C. The preset value is gradually adjusted in increments to the target sampling rate FS that keeps the FIFO unit in a non-empty and non-full state. in The corresponding sampling rate.
[0057] Among them, with equal Trigger half-full flag And on When adjustments begin, > Then, the next starting point For the present +Current adjustment step size / 2, when < At that time, the current state will be maintained. No change.
[0058] Among them, with equal Triggering the half-empty flag And on When adjustments begin, > Then, the next starting point For the present - Adjust step size / 2, when < At that time, the current state will be maintained. No change.
[0059] As a specific technical solution, for When making adjustments, the initial adjustment step size is preset, and the subsequent adjustment step size is reduced by half each time. The number of bits in the initial adjustment step size is the number of iterations.
[0060] After introducing the configuration of the interpolation core and FIFO unit, the following describes how the tracking algorithm adjusts according to the above flags to prevent the FIFO unit from being empty or full.
[0061] As a concrete example: Suppose the sampling rate of the DAC unit is 48K, and the input sampling rate varies around 44.1K. Set at 8192, the current goal is to adjust... To achieve, ultimately making The number of them remains constant, neither increasing nor decreasing.
[0062] The algorithm flow is as follows:
[0063] Assuming it was set up initially The value is 7300 because the input sampling rate is around 44.1K, so the target value should be around 7526. The following algorithm describes how to go from 7300 to 7526 (i.e., target_val).
[0064] First adjustment:
[0065] As shown in Figure 5, during the first adjustment, since 7300 is smaller than 7526, therefore... It will be triggered first Execute at this time +256=7556, then It will gradually come from Location to The position, when arrive When we are in a certain position, we give -256 = 7300, at this point And from arrive When I arrived again When checking and Who is bigger, if > This means =7556 ratio If 7300 is closer to the target value, then the next adjustment will start from 7300 + 128 = 7428.
[0066] Second time:
[0067] Referring to Figure 6, during the second adjustment, from Starting at =7428, execution begins at this point. +128=7556, then It will gradually come from Location to The position, when arrive When the position is reached, execute again. -128 = 7428, at this point And from arrive When I arrived again When checking and Who is bigger, if > This means =7556 ratio If 7428 is closer to the target value, then the next adjustment will start from 7428+64=7492.
[0068] The third time:
[0069] The third time from Starting at =7492, at this point... +64=7556, then It will gradually come from Location to The position, when arrive When the position is given -64=7492, at this time And from arrive When I arrived again When checking and Who is bigger, if > This means =7556 ratio If 7492 is closer to the target value, then the next adjustment will start from 7492+32=7524.
[0070] Fourth time:
[0071] The fourth time from Starting at =7524, at this point... +32=7556, then It will gradually come from Location to The position, when arrive When the position is given -32=7524, at this time And from arrive When I arrived again When checking and Who is bigger, if < This means =7524 If 7556 is closer to the target value, the next adjustment will start from 7524.
[0072] The fifth time from =7524, at this point we give +16=7540, then It will gradually come from Location to The position, when arrive When the position is given -16=7524, at this time And from arrive When I arrived again When checking and Who is bigger, if < This means =7524 If 7540 is closer to the target value, the next adjustment will start from 7524.
[0073] The fifth time from Starting at =7524, at this point... +8=7532, then It will gradually come from Location to The position, when arrive When the position is given -8 = 7524, at this point And from arrive When I arrived again When checking and Who is bigger, if < This means =7524 If 7532 is closer to the target value, then the next adjustment will start from 7524.
[0074] The sixth time from Starting at =7524, at this point... +4=7528, then It will gradually come from Location to The position, when arrive When the position is given -4 = 7524, at this point And from arrive When I arrived again When checking and Who is bigger, if <= (At this point, either side can be chosen, as they are both close to the target value), which indicates... =7524 If 7528 is closer to the target value, the next adjustment will start from 7524.
[0075] The seventh time from Starting at =7524, at this point... +2=7526, then It will gradually come from Location to The position, when arrive When the position is given -2=7526, at this time And from arrive When I arrived again When checking and Who is bigger, if > (At this point, either side can be chosen, as they are both close to the target value), which indicates... =7526 If 7524 is closer to the target value, then the next adjustment will start from 7524+1=7525.
[0076] The eighth time from Starting at =7525, at this point... +1=7526, then It will gradually come from Location to The position, when arrive When the position is given -1 = 7525, at this point And from arrive When I arrived again When checking and Who is bigger, if > (At this point, either side can be chosen, as they are both close to the target value), which indicates... =7526 =7525 is closer to the target value; adjustment complete. It will lock at 7526, at which point it will no longer be triggered. or When these two thresholds are triggered again, the adjustment will start from the first time.
[0077] The initial adjustment step size can be set according to requirements. The number of bits in the initial adjustment step size is the number of iterations. For example, if it is 256 in the above example, it will iterate 8 times, and if it is 128, it will iterate 7 times. The larger the initial step size, the larger the range that can be covered, but the convergence time will also increase.
[0078] The above explains why when When the value is close to the target value, the corresponding counter count is higher because when... When the target value is approached, the read and write rates of the FIFO units are very close, so it takes a long time to accumulate the same error. However, the counting time of the DAC units is the same, so when As the target value approaches, the number of counters increases.
[0079] The above description discloses only preferred embodiments of the present invention and should not be construed as limiting the scope of the present invention. Therefore, equivalent variations made in accordance with the claims of the present invention are still within the scope of the present invention.
Claims
1. An audio resampling frequency tracking method, characterized in that, include: S100: Configure an interpolation kernel unit between the FIFO unit and the DAC unit, using the FIFO unit to receive and buffer the previous stage audio data, and using the DAC unit to play the resampled audio data; S200: Configure the interpolation kernel unit to satisfy the following formula 1: — Formula 1; where FS in It is the sampling rate of the input signal of the interpolation kernel unit, FS out It is a fixed sampling rate of the output signal of the interpolation kernel unit. It is a fixed upsampling rate. It is an adjustable downsampling rate; S300, control the interpolation kernel unit to... The preset value is adjusted to a target value, thereby adjusting FS. in Stabilize to a target sampling rate that can keep the FIFO unit in a non-empty and non-full state.
2. The audio resampling frequency tracking method according to claim 1, characterized in that, In step S300, the method for maintaining the FIFO unit in a non-empty and non-full state includes: pre-configuring the data volume of the FIFO unit. Satisfy the following formula 2: — Formula 2; where, This refers to the write pointer that indicates the index of the FIFO cell written to in the previous stage. Refers to the read pointer of the index read by the interpolation kernel unit; by... The preset value is adjusted to the target value, thereby adjusting the preset value to the target value. It is maintained at a constant value between the state of being fully empty.
3. The audio resampling frequency tracking method according to claim 2, characterized in that, The Methods for maintaining a constant value between the fully empty and empty states include: A. Configuring a half-empty threshold for the FIFO unit. Half-air marker position Half-full threshold Half-full marker During the half-empty to half-full counting process, the DAC unit reads the count value of the data. During the counting process from half full to half empty, the DAC unit reads the count value of the data. B. Real-time monitoring ,when equal Then the half-empty flag is triggered. And on Start adjusting, when equal This triggers the half-full flag. And on Begin adjusting; C. The preset value is gradually adjusted in increments to the target sampling rate FS that keeps the FIFO unit in a non-empty and non-full state. in The corresponding sampling rate.
4. The audio resampling frequency tracking method according to claim 3, characterized in that, by equal Trigger half-full flag And on When adjustments begin, > Then, the next starting point For the present +Current adjustment step size / 2, when < When, then maintain the current state. No change.
5. The audio resampling frequency tracking method according to claim 3, characterized in that, by equal Triggering the half-empty flag And on When adjustments begin, > Then, the next starting point For the present - Adjust step size / 2, when < When, then maintain the current state. No change.
6. The audio resampling frequency tracking method according to claim 3, characterized in that, right When making adjustments, the initial adjustment step size is preset, and the subsequent adjustment step size is reduced by half each time. The number of bits in the initial adjustment step size is the number of iterations.
7. The audio resampling frequency tracking method according to claim 1, characterized in that, The interpolation kernel unit adopts a linear interpolation method with a farrow structure.
8. The audio resampling frequency tracking method according to claim 1, characterized in that, The interpolation kernel unit uses Taylor expansion for interpolation.
9. An audio chip, characterized in that, It includes a FIFO unit, an interpolation kernel unit, and a DAC unit connected in sequence, wherein the FIFO unit, the interpolation kernel unit, and the DAC unit cooperate to perform the method steps of the audio resampling frequency tracking method according to any one of claims 1-8.
10. An audio processing system, characterized in that, It includes the audio chip as described in claim 9 and a real-time device for inputting audio signals to the audio chip.