CN114255788B - Asynchronous sampling conversion method and conversion device thereof - Google Patents

Asynchronous sampling conversion method and conversion device thereof Download PDF

Info

Publication number
CN114255788B
CN114255788B CN202010994637.2A CN202010994637A CN114255788B CN 114255788 B CN114255788 B CN 114255788B CN 202010994637 A CN202010994637 A CN 202010994637A CN 114255788 B CN114255788 B CN 114255788B
Authority
CN
China
Prior art keywords
time
audio data
sub
data
conversion
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202010994637.2A
Other languages
Chinese (zh)
Other versions
CN114255788A (en
Inventor
余静
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Actions Technology Co Ltd
Original Assignee
Actions Technology Co Ltd
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 Actions Technology Co Ltd filed Critical Actions Technology Co Ltd
Priority to CN202010994637.2A priority Critical patent/CN114255788B/en
Publication of CN114255788A publication Critical patent/CN114255788A/en
Application granted granted Critical
Publication of CN114255788B publication Critical patent/CN114255788B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/10009Improvement or modification of read or write signals
    • G11B20/10222Improvement or modification of read or write signals clock-related aspects, e.g. phase or frequency adjustment or bit synchronisation
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/10009Improvement or modification of read or write signals
    • G11B20/10037A/D conversion, D/A conversion, sampling, slicing and digital quantisation or adjusting parameters thereof
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/10527Audio or video recording; Data buffering arrangements
    • G11B2020/1062Data buffering arrangements, e.g. recording or playback buffers
    • G11B2020/10675Data buffering arrangements, e.g. recording or playback buffers aspects of buffer control
    • G11B2020/10694Data buffering arrangements, e.g. recording or playback buffers aspects of buffer control output interface, i.e. the way data leave the buffer, e.g. by adjusting the clock rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The invention discloses a conversion method and a conversion device for asynchronous sampling, which can convert a first sampling rate of first audio data acquired in each sub-time to obtain second audio data with a second sampling rate when a plurality of sub-times are segmented in advance and conversion proportion corresponding to each sub-time is determined, so that conversion of the sampling rates is realized; meanwhile, the conversion method can be also suitable for an asynchronous clock scene, so that sampling rate conversion under the asynchronous clock scene is realized, and effective transmission and playing of audio data are realized.

Description

Asynchronous sampling conversion method and conversion device thereof
Technical Field
The present invention relates to the field of audio processing technologies, and in particular, to a method and apparatus for converting asynchronous samples.
Background
Because audio data needs to be transmitted and shared between different devices and different regions, problems caused by different sampling rates of input audio data and output audio data need to be solved. For example, a piece of music is stored at a sampling rate of 48kb/s, but when the piece of music is played at a sampling rate of 44.1kb/s, if the sampling rate is not converted, the played audio data may be lost, so that playing distortion occurs and playing effect is reduced.
Also, if two devices are interacting with audio data, the clocks of both devices come from the respective clock systems, and the clock accuracy of the clock systems depends on the accuracy of the crystal oscillators used respectively, the clocks of any two devices are substantially asynchronous, i.e. unsynchronized.
Therefore, how to convert two different sampling rates of the asynchronous clock to realize normal transmission and effective playing of audio data is a technical problem to be solved by those skilled in the art.
Disclosure of Invention
The embodiment of the invention provides a conversion method and a conversion device for asynchronous sampling, which are used for converting two different sampling rates of an asynchronous clock and realizing normal transmission and effective playing of audio data.
In a first aspect, an embodiment of the present invention provides a method for converting asynchronous samples, including:
acquiring first audio data with a first sampling rate, which is input in the current sub-time in a plurality of sub-times which are segmented in advance;
according to the determined conversion proportion corresponding to the current sub-time, converting the first sampling rate to obtain second audio data with a second sampling rate and outputting the second audio data; wherein the clock when the first audio data is acquired is asynchronous with the clock when the second audio data is output.
Optionally, in an embodiment of the present invention, the sub-time is determined according to an input period of the first audio data.
Optionally, in an embodiment of the present invention, the sub-time is an integer multiple of the input period;
and under the same application scene, the divided sub-times are the same.
Optionally, in the embodiment of the present invention, when the current sub-time is a first sub-time, a conversion ratio corresponding to the first sub-time is: determining according to the sampling rate of the first audio data in the ideal state and the sampling rate of the second audio data in the ideal state;
or when the current sub-time is any one of the rest sub-times except the first sub-time, the conversion ratio corresponding to the current sub-time is as follows: and determining according to the data quantity of the first audio data input in the last sub-time and the data quantity of the second audio data output in the last sub-time.
Optionally, in an embodiment of the present invention, the conversion ratio corresponding to the first sub-time is: a ratio of a sampling rate of the first audio data in an ideal state to a sampling rate of the second audio data in an ideal state;
when the current sub-time is any one of the rest sub-times except the first sub-time, the conversion ratio corresponding to the current sub-time is as follows: a ratio of the data amount of the first audio data input in the last sub-time to the data amount of the second audio data output in the last sub-time.
Optionally, in an embodiment of the present invention, the method further includes:
when the conversion ratio corresponding to the current sub-time is determined according to the data amount of the first audio data input in the last sub-time and the data amount of the second audio data output in the last sub-time, determining a compensation value according to the data amount of the first audio data input in the last sub-time and the data amount of the second audio data output in the last sub-time;
and according to the determined compensation value, carrying out compensation processing on the counted data quantity of the first audio data input in the current sub-time.
Optionally, in an embodiment of the present invention, determining the compensation value according to the data amount of the first audio data input in the last sub-time and the data amount of the second audio data output in the last sub-time specifically includes:
judging whether the ratio of the data volume of the first audio data input in the last sub-time to the data volume of the second audio data output in the last sub-time is an integer or not;
if yes, determining that the compensation value is zero;
if not, splitting the data volume of the first audio data input in the last sub-time into a first data volume and a second data volume, and determining the compensation value as the second data volume; the first data amount is an integer multiple of the data amount of the second audio data output in the last sub-time, and the second data amount is a non-integer multiple of the data amount of the second audio data output in the last sub-time.
Optionally, in an embodiment of the present invention, when a ratio of a data amount of the first audio data input in the last sub-time to a data amount of the second audio data output in the last sub-time is a non-integer, the method for determining the conversion ratio corresponding to the current sub-time includes:
and determining the conversion ratio corresponding to the current sub-time according to the first data amount and the data amount of the second audio data output in the last sub-time.
Optionally, in an embodiment of the present invention, according to the determined compensation value, the compensation processing is performed on the data amount of the first audio data input in the counted current sub-time, and specifically includes:
and determining the sum of the counted data quantity of the first audio data input in the current sub-time and the compensation value as the data quantity of the first audio data finally input in the current sub-time.
In a second aspect, an embodiment of the present invention provides a conversion apparatus for asynchronous sampling rate, including:
a first unit for acquiring first audio data with a first sampling rate input in a current sub-time of a plurality of sub-times divided in advance;
the second unit is used for carrying out conversion processing on the first sampling rate according to the determined conversion proportion corresponding to the current sub-time to obtain second audio data with a second sampling rate and outputting the second audio data; wherein the clock when the first audio data is acquired is asynchronous with the clock when the second audio data is output.
The invention has the following beneficial effects:
according to the conversion method and the conversion device for asynchronous sampling, when a plurality of sub-times are segmented in advance and the conversion proportion corresponding to each sub-time is determined, the first sampling rate of the first audio data acquired in each sub-time can be converted to obtain the second audio data with the second sampling rate, so that the conversion of the sampling rate is realized; meanwhile, the conversion method can be also suitable for an asynchronous clock scene, so that sampling rate conversion under the asynchronous clock scene is realized, and effective transmission and playing of audio data are realized.
Drawings
FIG. 1 is a flow chart of an asynchronous sample rate conversion method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an asynchronous sample rate conversion device according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of another asynchronous sample rate conversion device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an asynchronous sample rate playing system according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of another asynchronous sample rate playing system according to an embodiment of the present invention.
Detailed Description
The following describes in detail a specific implementation manner of a conversion method and a conversion device for asynchronous sampling according to an embodiment of the present invention with reference to the accompanying drawings. It should be noted that the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
An embodiment of the present invention provides a conversion method for an asynchronous sampling rate, as shown in fig. 1, including:
s101, acquiring first audio data with a first sampling rate, which is input in the current sub-time in a plurality of sub-times which are segmented in advance;
s102, converting the first sampling rate according to the determined conversion proportion corresponding to the current sub-time to obtain and output second audio data with a second sampling rate; wherein the clock when the first audio data is acquired is asynchronous with the clock when the second audio data is output.
Illustratively, the first audio data and the second audio data differ in that: the clock and sampling rate are different and the actual content to be expressed by the first audio data and the second audio data is the same.
Wherein the actual content to be expressed by the first audio data and the second audio data can be understood as:
if the actual content to be expressed by the first audio data is a piece of music a, the actual content to be expressed by the second audio data is also the piece of music a.
In this way, when a plurality of sub-times are segmented in advance and the conversion proportion corresponding to each sub-time is determined, the first sampling rate of the first audio data acquired in each sub-time can be converted to obtain the second audio data with the second sampling rate, so that the conversion of the sampling rate is realized; meanwhile, the conversion method can be also suitable for an asynchronous clock scene, so that sampling rate conversion under the asynchronous clock scene is realized, and effective transmission and playing of audio data are realized.
Optionally, in an embodiment of the present invention, the sub-time is determined according to an input period of the first audio data.
In practical cases, each application scene differs in transmitting audio data.
In application scenario 1:
the audio data is preconfigured to be input at a constant speed so that the audio data is also acquired at a constant speed, and the term "constant speed" is understood as: inputting audio data with a particularly small input period (where the input period is negligible, indicating that audio data is being input at any time); in addition, in one application scene, the input period is basically constant and basically does not fluctuate, so in the application scene, the input period can be set randomly according to actual needs when the sub-time is divided.
In application scenario 2:
the audio data is pre-configured to be input in a certain input period, for example, but not limited to, 100k of audio data is transmitted every 1s, where 1s is the input period, in other words, when the first input period is reached, 100k of audio data is transmitted, then the audio data is in a waiting phase, and the audio data is not transmitted again in the waiting phase until the second input period is reached, and the above steps are repeated. Thus, audio data having a fixed length is transmitted in a short time.
Meanwhile, in the application scenario 2, the input period is substantially constant, and substantially no fluctuation occurs, so in the application scenario 2, the input period is always maintained. Thus, in dividing the sub-time, the determination can be made according to the input period.
Therefore, the conversion method can be suitable for the bursty transmission mode of the application scene 2, the uniform transmission mode of the application scene 1, and the effective transmission of the audio data can be ensured while the application scene is expanded.
Specifically, in the embodiment of the present invention, the sub-time is an integer multiple of the input period.
Therefore, the sub-time can be reasonably set according to the input period, so that the problem of transmission distortion caused by unreasonable factor time setting is avoided, and effective transmission of the audio data is ensured.
Specifically, in the embodiment of the invention, the divided sub-times are the same in the same application scene.
Since the input period is substantially constant and the sub-time is determined according to the input period in the same application scenario, the divided sub-times are the same to reduce the complexity of the conversion process.
Optionally, in the embodiment of the present invention, when the current sub-time is the first sub-time, the conversion ratio corresponding to the first sub-time is: determining according to the sampling rate of the first audio data in the ideal state and the sampling rate of the second audio data in the ideal state;
or when the current sub-time is any sub-time except the first sub-time, the conversion ratio corresponding to the current sub-time is as follows: and determining according to the data quantity of the first audio data input in the last sub-time and the data quantity of the second audio data output in the last sub-time.
In this way, when the first sub-time is the first time, the conversion proportion corresponding to the first sub-time is determined according to the sampling rate in the ideal state, and as the audio data transmission time is prolonged, deviation may occur, so that the conversion proportion corresponding to the current sub-time can be determined according to the data amount of the first audio data and the second audio data in the last sub-time, and the conversion proportion corresponding to the last sub-time is adjusted, so that the conversion proportion corresponding to the current sub-time is obtained, the deviation is reduced, and the accuracy of audio data transmission is ensured.
Specifically, in the embodiment of the present invention, the conversion ratio corresponding to the first sub-time is: a ratio of a sampling rate of the first audio data in the ideal state to a sampling rate of the second audio data in the ideal state;
when the current sub-time is any one of the rest sub-times except the first sub-time, the conversion ratio corresponding to the current sub-time is as follows: the ratio of the data amount of the first audio data input in the last sub-time to the data amount of the second audio data output in the last sub-time.
Wherein, when the data amount of the first audio data input in the last sub-time and the data amount of the second audio data output in the last sub-time are counted, the statistics can be performed by the following ways:
the starting and stopping of the first counter and the second counter are controlled through a timer, namely, the counted time length is controlled through the timer;
under the control of the timer, the data amount of the first audio data input in one sub-time is counted by the first counter, and the data amount of the second audio data output in one sub-time is counted by the second counter.
To illustrate one point, specifically, in determining the conversion ratio corresponding to the sub-time, the following principle is adopted:
in an ideal state, the first sampling rate of the input first audio data may be represented by Fin, and the second sampling rate of the output second audio data may be represented by Fout. For example, the first sample rate of the first audio data is 96kb/s and the second sample rate of the second audio data is 48kb/s. If the clock of the first audio data is completely synchronous with the clock of the second audio data, the ideal conversion ratio may be: r1=fin/Fout.
The ideal state can be understood as: the preset sampling rate is the same as the actual sampling rate, and the actual sampling rate is always kept unchanged with the increase of time.
However, in the actual process, the actual sampling rate and the ideal sampling rate (which can be regarded as the preset sampling rate) deviate due to the problem of clock accuracy, so the actual conversion ratio is: r2= (Fin/Fout) +r0, after the asynchronous sampling rate is converted by the actual conversion ratio R2, the correctness of the audio data can be ensured, so that the size of R0 (which can be understood as an adjustment variable) needs to be controlled and adjusted to ensure the correctness of the audio data.
The first audio data is input at a speed of the first sampling rate Fin when the first audio data is in an ideal state, so that the first counter is used to detect and count the data amount (denoted by M) of the first audio data input in a certain sub-time. Similarly, if the output second audio data is fetched from the output data buffer at the speed of the second sampling rate Fout when the second audio data is in the ideal state, the second counter can be used to detect and count the data amount (denoted by N) of the second audio data output in a certain sub-time.
Because of the asynchronous relationship of the input clock and the output clock, M/n+.r1, but M/n=r2; by the formula derivation, the following formula 1 can be obtained:
M/N=R2=(Fin/Fout)+R0;
since M and N are both known amounts, which are counted, and Fin and Fout are sampling rates in an ideal state, which are also known amounts, equation 2 can be obtained by deforming equation 1 above:
R0=M/N-(Fin/Fout);
r0 can be obtained by the formula 2.
Thus, by the derivation and calculation of the above formula 1 and formula 2, the adjustment variable R0 corresponding to each sub-time can be determined, that is:
the conversion ratio R2 corresponding to the current sub-time can be redetermined through the adjustment variable R0 corresponding to the last sub-time and the conversion ratio R1 in the ideal state, and the first sampling rate of the first audio data acquired in the current sub-time is converted through the conversion ratio R2 corresponding to the current sub-time so as to ensure effective transmission of the audio data.
Although in principle, the conversion ratio R2 corresponding to the current sub-time is obtained by adjusting and controlling the adjustment variable R0 corresponding to the last sub-time, in the actual conversion process, the conversion ratio R2 corresponding to the current sub-time can be determined by counting the data amount M of the first audio data input in the last sub-time and the data amount N of the second audio data output in the last sub-time, and in the statistical process, the adjustment variable R0 is taken into consideration, so that the principle according to the basis and the actual determination process are consistent.
Optionally, in an embodiment of the present invention, the method further includes:
when the conversion proportion corresponding to the current sub-time is determined according to the data amount of the first audio data input in the last sub-time and the data amount of the second audio data output in the last sub-time, determining a compensation value according to the data amount of the first audio data input in the last sub-time and the data amount of the second audio data output in the last sub-time;
and according to the determined compensation value, carrying out compensation processing on the counted data quantity of the first audio data input in the current sub-time.
Therefore, when the conversion proportion is determined, the accuracy of the conversion proportion determination can be improved, and error accumulation caused by long-time work is eliminated, so that effective transmission of audio data is ensured.
Specifically, in the embodiment of the present invention, determining the compensation value according to the data amount of the first audio data input in the last sub-time and the data amount of the second audio data output in the last sub-time specifically includes:
judging whether the ratio of the data volume of the first audio data input in the last sub-time to the data volume of the second audio data output in the last sub-time is an integer or not;
if yes, determining that the compensation value is zero;
if not, splitting the data quantity of the first audio data input in the last sub-time into a first data quantity and a second data quantity, and determining the compensation value as the second data quantity; the first data amount is an integer multiple of the data amount of the second audio data output in the last sub-time, and the second data amount is a non-integer multiple of the data amount of the second audio data output in the last sub-time.
That is, when the ratio of the data amount of the first audio data input in the last sub-time to the data amount of the second audio data output in the last sub-time is an integer, the determined compensation value is zero, so this case can be regarded as: the data quantity of the first audio data input in the counted current sub-time is not compensated;
when the ratio of the data amount of the first audio data input in the last sub-time to the data amount of the second audio data output in the last sub-time is a non-integer, the determined compensation value is the second data amount, and the second data amount is not zero, so this situation can be regarded as: and compensating the counted data quantity of the first audio data input in the current sub-time.
Therefore, the compensation value can be effectively determined, so that the data quantity of the first audio data input in the counted current sub-time is subjected to compensation processing, and the accuracy of the determined conversion proportion is improved.
Specifically, in the embodiment of the present invention, when the ratio of the data amount of the first audio data input in the last sub-time to the data amount of the second audio data output in the last sub-time is a non-integer, the method for determining the conversion ratio corresponding to the current sub-time includes:
and determining the conversion ratio corresponding to the current sub-time according to the first data amount and the data amount of the second audio data output in the last sub-time.
That is, the ratio of the first data amount to the second audio data amount outputted in the last sub-time is determined as the conversion ratio corresponding to the current sub-time.
For example, assuming that the data amount of the first audio data input in the last sub-time is 13 and the data amount of the second audio data output in the last sub-time is 4, the ratio of 13 to 4 is a non-integer, then:
splitting 13 into 12 and 1, wherein 12 is the first data volume and 1 is the second data volume;
the ratio of 12 to 4 is determined as the conversion ratio corresponding to the current sub-time (i.e. 3).
Therefore, the determined conversion proportion can be an integer, more accurate conversion can be realized when the conversion of the asynchronous sampling rate is carried out, errors caused by the conversion of the conversion proportion by adopting a non-integer are avoided, the conversion accuracy is improved, and the effective transmission of the audio data is ensured.
Specifically, in the implementation of the present invention, according to the determined compensation value, the compensation processing is performed on the data amount of the first audio data input in the counted current sub-time, which specifically includes:
and determining the sum of the counted data quantity of the first audio data input in the current sub-time and the compensation value as the data quantity of the first audio data finally input in the current sub-time.
For example, taking the above example continuously, 1 may be taken as the second data amount corresponding to the last sub-time, so when counting the data amount of the first audio data input in the current sub-time, the first counter does not count from 0, but counts from 1; such as:
the first counter changes the value of the first counter from 1 to 2 when counting the first audio data;
when the first counter counts the second first audio data, the value of the first counter is changed from 2 to 3;
until the statistics of the first counter in the current sub-time is completed.
In this way, the error calculated in the last sub-time (namely, the second data amount) can be used as compensation to compensate the current sub-time, so that the problem of data loss caused by error in the statistics of the data amount is avoided.
The conversion method provided by the embodiment of the invention is described in the following by a specific embodiment.
It is assumed that the running time of the device from turning on to turning off is divided into four sub-times (t 1, t2, t3, and t4, respectively) in advance, and here, four sub-times are taken as an example, but the divided sub-times are not limited to four in practical cases.
Assume that: in an ideal state, the first sampling rate of the first audio data is Fin, and the second sampling rate of the second audio data is Fout, so the conversion ratio at this time is: r1=fin/Fout.
In the sub-time t1, converting the first sampling rate with the conversion ratio of R1;
the sub-time t1 may count that the data amount of the first audio data input in the sub-time t1 is M1, and the data amount of the second audio data output is N1, and if it is assumed that M1/N1 is an integer, the conversion ratio corresponding to the sub-time t2 may be obtained as follows: r22=m1/N1.
In the sub-time t2, converting the first sampling rate with the conversion ratio of R22;
wherein, after the sub-time t2, the data amount of the first audio data input in the sub-time t2 may be counted as M2, the data amount of the second audio data output is N2, if it is assumed that M2/N2 is a non-integer, then the first data amount P1 and the second data amount P2 may be split from M2, and P1/N2 is an integer, and further the conversion ratio corresponding to the sub-time t3 may be obtained as follows: r23=p1/N2.
In the sub-time t3, converting the first sampling rate with the conversion ratio of R23;
wherein, after the sub-time t3, the data amount of the first audio data input in the sub-time t3 may be counted as m3+p2, the data amount of the second audio data output is N3, and if (m3+p2)/N2 is assumed to be an integer, the conversion ratio corresponding to the sub-time t4 may be obtained as follows: r24= (m3+p2)/N2.
In the sub-time t4, the conversion process is performed on the first sampling rate with the conversion ratio being R24.
Based on the same inventive concept, the embodiment of the present invention provides a conversion device with an asynchronous sampling rate, the implementation principle of the conversion device is similar to that of the foregoing one conversion method, and the specific implementation of the conversion device may refer to the specific embodiment of the foregoing conversion method, and the repetition is omitted.
Specifically, an asynchronous sampling rate conversion device provided by an embodiment of the present invention, as shown in fig. 2, includes:
a first unit 201, configured to obtain first audio data with a first sampling rate, where the first audio data is input in a current sub-time of a plurality of sub-times that are segmented in advance;
a second unit 202, configured to perform conversion processing on the first sampling rate according to the determined conversion ratio corresponding to the current sub-time, obtain second audio data with a second sampling rate, and output the second audio data; wherein the clock when the first audio data is acquired is asynchronous with the clock when the second audio data is output.
Optionally, in an embodiment of the present invention, as shown in fig. 3, the conversion device may further include:
a first audio data buffer unit 203, configured to store the acquired first audio data;
a second audio data buffer unit 204, configured to store the obtained second audio data;
as shown in fig. 3, the second unit 202 may specifically include:
a sampling rate conversion circuit 2021, configured to perform conversion processing on the first sampling rate according to the determined conversion ratio corresponding to the current sub-time, so as to obtain second audio data with a second sampling rate;
a time control circuit 2022 for controlling the statistical time of the first data statistical circuit 2023 and the second data statistical circuit 2024 according to the sub-time divided in advance;
a first number counting circuit 2023 for counting the amount of data input in the first audio data buffer unit 203;
a second number statistics circuit 2024 for counting the amount of data input in the second audio data buffer unit 204;
the sampling rate control circuit 2025 is configured to divide the sub-time and determine the conversion ratio corresponding to the current sub-time according to the data amount input in the first audio data buffer unit 203 and the data amount input in the second audio data buffer unit 204.
Alternatively, in an embodiment of the present invention, the time control circuit 2022 may be implemented by, but not limited to, a timer, and both the first number statistical circuit 2023 and the second number statistical circuit 2024 may be implemented by, but not limited to, a counter.
Based on the same inventive concept, an embodiment of the present invention provides a playing system with asynchronous sampling rate, as shown in fig. 4, including: the above-mentioned asynchronous sample rate conversion device 401 according to the embodiment of the present invention.
Optionally, in an embodiment of the present invention, as shown in fig. 5, the playing system further comprises an input device 402 for providing the first audio data, and a playing device 403 for playing the second audio data.
Wherein the conversion means is arranged between the input device and the playback device.
The input device may be any device capable of providing the first audio data, and is not limited herein; similarly, the playback device may be any device capable of playing back the second audio data, and is not limited herein.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (9)

1. A method for converting an asynchronous sample rate, comprising:
acquiring first audio data with a first sampling rate, which is input in the current sub-time in a plurality of sub-times which are segmented in advance;
according to the determined conversion proportion corresponding to the current sub-time, converting the first sampling rate to obtain second audio data with a second sampling rate and outputting the second audio data; the clock when the first audio data is acquired is asynchronous with the clock when the second audio data is output;
when the current sub-time is the first sub-time, the conversion ratio corresponding to the first sub-time is as follows: determining according to the sampling rate of the first audio data in the ideal state and the sampling rate of the second audio data in the ideal state;
when the current sub-time is any one of the rest sub-times except the first sub-time, the conversion ratio corresponding to the current sub-time is as follows: and determining according to the data quantity of the first audio data input in the last sub-time and the data quantity of the second audio data output in the last sub-time.
2. The conversion method of claim 1, wherein the sub-time is determined according to an input period of the first audio data.
3. The conversion method of claim 2, wherein the sub-time is an integer multiple of the input period;
and under the same application scene, the divided sub-times are the same.
4. The conversion method according to claim 1, wherein the conversion ratio corresponding to the first sub-time is: a ratio of a sampling rate of the first audio data in an ideal state to a sampling rate of the second audio data in an ideal state;
when the current sub-time is any one of the rest sub-times except the first sub-time, the conversion ratio corresponding to the current sub-time is as follows: a ratio of the data amount of the first audio data input in the last sub-time to the data amount of the second audio data output in the last sub-time.
5. The conversion method of claim 1, further comprising:
when the conversion ratio corresponding to the current sub-time is determined according to the data amount of the first audio data input in the last sub-time and the data amount of the second audio data output in the last sub-time, determining a compensation value according to the data amount of the first audio data input in the last sub-time and the data amount of the second audio data output in the last sub-time;
and according to the determined compensation value, carrying out compensation processing on the counted data quantity of the first audio data input in the current sub-time.
6. The conversion method according to claim 5, wherein determining the compensation value based on the data amount of the first audio data input in the last sub-time and the data amount of the second audio data output in the last sub-time, specifically comprises:
judging whether the ratio of the data volume of the first audio data input in the last sub-time to the data volume of the second audio data output in the last sub-time is an integer or not;
if yes, determining that the compensation value is zero;
if not, splitting the data volume of the first audio data input in the last sub-time into a first data volume and a second data volume, and determining the compensation value as the second data volume; the first data amount is an integer multiple of the data amount of the second audio data output in the last sub-time, and the second data amount is a non-integer multiple of the data amount of the second audio data output in the last sub-time.
7. The conversion method according to claim 6, wherein when a ratio of the data amount of the first audio data input in the last sub-time to the data amount of the second audio data output in the last sub-time is a non-integer, the method for determining the conversion ratio corresponding to the current sub-time includes:
and determining the conversion ratio corresponding to the current sub-time according to the first data amount and the data amount of the second audio data output in the last sub-time.
8. The conversion method according to claim 5, wherein the compensating the counted data amount of the first audio data input in the current sub-time according to the determined compensation value specifically includes:
and determining the sum of the counted data quantity of the first audio data input in the current sub-time and the compensation value as the data quantity of the first audio data finally input in the current sub-time.
9. An asynchronous sample rate conversion apparatus, comprising:
a first unit for acquiring first audio data with a first sampling rate input in a current sub-time of a plurality of sub-times divided in advance;
the second unit is used for carrying out conversion processing on the first sampling rate according to the determined conversion proportion corresponding to the current sub-time to obtain second audio data with a second sampling rate and outputting the second audio data; the clock when the first audio data is acquired is asynchronous with the clock when the second audio data is output;
when the current sub-time is the first sub-time, the conversion ratio corresponding to the first sub-time is as follows: determining according to the sampling rate of the first audio data in the ideal state and the sampling rate of the second audio data in the ideal state;
when the current sub-time is any one of the rest sub-times except the first sub-time, the conversion ratio corresponding to the current sub-time is as follows: and determining according to the data quantity of the first audio data input in the last sub-time and the data quantity of the second audio data output in the last sub-time.
CN202010994637.2A 2020-09-21 2020-09-21 Asynchronous sampling conversion method and conversion device thereof Active CN114255788B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010994637.2A CN114255788B (en) 2020-09-21 2020-09-21 Asynchronous sampling conversion method and conversion device thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010994637.2A CN114255788B (en) 2020-09-21 2020-09-21 Asynchronous sampling conversion method and conversion device thereof

Publications (2)

Publication Number Publication Date
CN114255788A CN114255788A (en) 2022-03-29
CN114255788B true CN114255788B (en) 2024-04-09

Family

ID=80788959

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010994637.2A Active CN114255788B (en) 2020-09-21 2020-09-21 Asynchronous sampling conversion method and conversion device thereof

Country Status (1)

Country Link
CN (1) CN114255788B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10313251A (en) * 1997-05-12 1998-11-24 Sony Corp Device and method for audio signal conversion, device and method for prediction coefficeint generation, and prediction coefficeint storage medium
US5875354A (en) * 1996-03-01 1999-02-23 Apple Computer, Inc. System for synchronization by modifying the rate of conversion by difference of rate between first clock and audio clock during a second time period
JP2005210190A (en) * 2004-01-20 2005-08-04 Yamaha Corp Sampling frequency conversion apparatus
CN101006641A (en) * 2004-08-30 2007-07-25 松下电器产业株式会社 Sampling rate conversion calculating apparatus
US7414550B1 (en) * 2006-06-30 2008-08-19 Nvidia Corporation Methods and systems for sample rate conversion and sample clock synchronization
US7518053B1 (en) * 2005-09-01 2009-04-14 Texas Instruments Incorporated Beat matching for portable audio
CN107430503A (en) * 2015-04-30 2017-12-01 英特尔公司 The signal of audio transmission system is synchronous and waiting time jitter compensates
CN110708069A (en) * 2019-06-24 2020-01-17 珠海全志科技股份有限公司 Asynchronous sampling rate conversion device and conversion method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007067797A (en) * 2005-08-31 2007-03-15 Renesas Technology Corp Sampling rate converter and semiconductor integrated circuit
US9236064B2 (en) * 2012-02-15 2016-01-12 Microsoft Technology Licensing, Llc Sample rate converter with automatic anti-aliasing filter

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5875354A (en) * 1996-03-01 1999-02-23 Apple Computer, Inc. System for synchronization by modifying the rate of conversion by difference of rate between first clock and audio clock during a second time period
JPH10313251A (en) * 1997-05-12 1998-11-24 Sony Corp Device and method for audio signal conversion, device and method for prediction coefficeint generation, and prediction coefficeint storage medium
JP2005210190A (en) * 2004-01-20 2005-08-04 Yamaha Corp Sampling frequency conversion apparatus
CN101006641A (en) * 2004-08-30 2007-07-25 松下电器产业株式会社 Sampling rate conversion calculating apparatus
US7518053B1 (en) * 2005-09-01 2009-04-14 Texas Instruments Incorporated Beat matching for portable audio
US7414550B1 (en) * 2006-06-30 2008-08-19 Nvidia Corporation Methods and systems for sample rate conversion and sample clock synchronization
CN107430503A (en) * 2015-04-30 2017-12-01 英特尔公司 The signal of audio transmission system is synchronous and waiting time jitter compensates
CN110708069A (en) * 2019-06-24 2020-01-17 珠海全志科技股份有限公司 Asynchronous sampling rate conversion device and conversion method

Also Published As

Publication number Publication date
CN114255788A (en) 2022-03-29

Similar Documents

Publication Publication Date Title
CN108495164B (en) Audio and video synchronization processing method and device, computer device and storage medium
US10147440B2 (en) Method for playing data and apparatus and system thereof
US6531970B2 (en) Digital sample rate converters having matched group delay
KR102464293B1 (en) Systems and methods for controlling concurrent data streams
US11122306B2 (en) Synchronous playback system and synchronous playback method
CN108495239B (en) Method, device, equipment and storage medium for accurately and synchronously playing audio among multiple equipment
CN110597744B (en) Data synchronous transmission method, system and computer equipment
CN113874850A (en) Synchronization of audio across multiple devices
CN114255788B (en) Asynchronous sampling conversion method and conversion device thereof
CN1829129B (en) Method and apparatus for eliminating transmission delay difference in multipath synchronous data transmission
US9729598B2 (en) Method and a device for signalling transmission time and/or a system clock
US5581748A (en) Phase register for synchronization of multiple signal processors
EP1021045A1 (en) Method for processing and apparatus for encoding audio or video frame data
CN116033199A (en) Multi-device audio and video synchronization method and device, electronic device and storage medium
US7567589B2 (en) Rate generator in a video on demand system having multiple constant bit rate data
CN101534400B (en) Method for adjusting data transmission sample rate and device thereof
US8275083B2 (en) Integrated circuit for an asynchronous serial data transfer with a bit length counter
US9209783B2 (en) Efficient drift avoidance mechanism for synchronous and asynchronous digital sample rate converters
JP4706593B2 (en) Packet signal receiver
CN117768993A (en) Audio synchronization method, audio playing system and storage medium
CN111770413B (en) Multi-sound-source sound mixing method and device and storage medium
US7193928B2 (en) Signal output device and method for the same
CN117095706A (en) Accurate audio delay playing method and device and chip
US20050204079A1 (en) Data rate adjustment device and system thereof
JP2959505B2 (en) Data transmission circuit

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant