CN114255788A - Conversion method and conversion device for asynchronous sampling - Google Patents

Conversion method and conversion device for asynchronous sampling Download PDF

Info

Publication number
CN114255788A
CN114255788A CN202010994637.2A CN202010994637A CN114255788A CN 114255788 A CN114255788 A CN 114255788A CN 202010994637 A CN202010994637 A CN 202010994637A CN 114255788 A CN114255788 A CN 114255788A
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.)
Granted
Application number
CN202010994637.2A
Other languages
Chinese (zh)
Other versions
CN114255788B (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

Images

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 divided in advance and a conversion proportion corresponding to each sub-time is determined, thereby realizing the conversion of the sampling rates; meanwhile, the conversion method can also be suitable for an asynchronous clock scene, so that the sampling rate conversion under the asynchronous clock scene is realized, and the effective transmission and playing of audio data are realized.

Description

Conversion method and conversion device for asynchronous sampling
Technical Field
The present invention relates to the field of audio processing technologies, and in particular, to a conversion method and a conversion apparatus for asynchronous sampling.
Background
Since audio data needs to be spread and shared among different devices and different regions, it is necessary to solve the problem caused by the fact that input audio data and output audio data have different sampling rates. For example, a piece of music is stored at a sampling rate of 48kb/s, but when the music is played, the music is played at a sampling rate of 44.1kb/s, and if the sampling rate is not converted, the audio data to be played may be lost, which may cause the playing distortion, and reduce the playing effect.
And, if two devices are interacting audio data, the clocks of both devices are from respective clock systems, and the clock accuracy of the clock systems depends on the accuracy of the crystal oscillators used by each, so the clocks of any two devices are substantially asynchronous, i.e. non-synchronous.
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 input in the current sub-time in a plurality of pre-divided sub-times;
according to the determined conversion proportion corresponding to the current sub-time, performing conversion processing on the first sampling rate to obtain second audio data with a second sampling rate and outputting the second audio data; wherein a clock when the first audio data is acquired is asynchronous with a 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, all the divided sub-time are the same.
Optionally, in this 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 an 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 this embodiment of the present invention, a 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 proportion corresponding to the current sub-time is as follows: 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.
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 volume of the first audio data input in the last sub-time and the data volume of the second audio data output in the last sub-time, determining a compensation value according to the data volume of the first audio data input in the last sub-time and the data volume of the second audio data output in the last sub-time;
and according to the determined compensation value, performing compensation processing on the counted data volume of the first audio data input in the current sub-time.
Optionally, in this embodiment of the present invention, 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 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;
if yes, determining the compensation value to be 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; wherein 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 this embodiment of the present invention, 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 volume and the data volume of the second audio data output in the last sub-time.
Optionally, in the embodiment of the present invention, according to the determined compensation value, performing compensation processing on the counted data amount of the first audio data input in the current sub-time includes:
and determining the sum of the counted data volume of the first audio data input in the current sub-time and the compensation value as the data volume of the first audio data finally input in the current sub-time.
In a second aspect, an embodiment of the present invention provides an asynchronous sampling rate conversion apparatus, including:
the device comprises a first unit, a second unit and a third unit, wherein the first unit is used for acquiring first audio data with a first sampling rate input in the current sub-time in a plurality of pre-divided sub-times;
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 and output second audio data with a second sampling rate; wherein a clock when the first audio data is acquired is asynchronous with a 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 provided by the embodiment of the invention, when a plurality of sub-times are divided 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 rates is realized; meanwhile, the conversion method can also be suitable for an asynchronous clock scene, so that the sampling rate conversion under the asynchronous clock scene is realized, and the effective transmission and playing of audio data are realized.
Drawings
Fig. 1 is a flowchart of an asynchronous sampling rate conversion method provided in an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an asynchronous sampling rate conversion apparatus provided in an embodiment of the present invention;
fig. 3 is a schematic structural diagram of another asynchronous sampling rate conversion apparatus provided in the embodiment of the present invention;
fig. 4 is a schematic structural diagram of an asynchronous sampling rate playing system provided in an embodiment of the present invention;
fig. 5 is a schematic structural diagram of another asynchronous sampling rate playing system provided in the embodiment of the present invention.
Detailed Description
The following describes in detail specific embodiments of a method and an apparatus for converting asynchronous samples according to an embodiment of the present invention with reference to the accompanying drawings. It should be noted that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
An embodiment of the present invention provides a method for converting an asynchronous sampling rate, as shown in fig. 1, including:
s101, first audio data with a first sampling rate input in the current sub-time of a plurality of pre-divided sub-times are obtained;
s102, converting the first sampling rate according to the determined conversion ratio corresponding to the current sub-time to obtain second audio data with a second sampling rate and outputting the second audio data; wherein a clock when the first audio data is acquired is asynchronous with a clock when the second audio data is output.
To explain this point, the first audio data and the second audio data are different 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 divided in advance and the conversion ratio corresponding to each sub-time is determined, conversion processing can be performed on the first sampling rate of the first audio data acquired in each sub-time to obtain second audio data with a second sampling rate, so that conversion of the sampling rates is realized; meanwhile, the conversion method can also be suitable for an asynchronous clock scene, so that the sampling rate conversion under the asynchronous clock scene is realized, and the effective transmission and playing of audio data are realized.
Alternatively, 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 scenario differs when transmitting audio data.
In application scenario 1:
the audio data is configured to be input at a constant speed in advance, so that the audio data is also at a constant speed when being acquired, and the term "constant speed" can be understood as follows: inputting audio data with a particularly small input period (the input period can be ignored at this time, and the audio data is input at any time); in addition, in an application scenario, the input period is basically constant, and basically no fluctuation occurs, so in the application scenario, when the sub-time is divided, the setting can be performed at will according to actual needs.
In application scenario 2:
the audio data is input in advance with 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, 100k of audio data is transmitted when the first input period is reached, and then the method is in a waiting stage, where the audio data is not transmitted again until the second input period is reached, and so on. 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 does not fluctuate substantially, so in the application scenario 2, the input period is always maintained. Therefore, when the sub-time is divided, the determination may be made according to the input period.
Therefore, the conversion method can be suitable for the sudden transmission mode of the application scene 2 and 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 audio data is ensured.
Specifically, in the embodiment of the present invention, in the same application scenario, the divided sub-times are the same.
Since the input period is basically constant and the sub-time is determined according to the input period in the same application scenario, the divided sub-times are the same, so as 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, 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.
Therefore, when the first sub-time is in the first sub-time, the conversion proportion corresponding to the first sub-time is determined according to the sampling rate in the ideal state, and deviation may occur along with the extension of the transmission time of the audio data.
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 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 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.
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 following statistics can be performed:
the start and stop of the first counter and the second counter are controlled by the timer, namely the counted time length is controlled by the timer;
under the control of the timer, the data amount of the first audio data input in the last sub-time is counted through the first counter, and the data amount of the second audio data output in the last sub-time is counted through the second counter.
Explaining one point, specifically, when determining the conversion ratio corresponding to the sub-time, the principle is as follows:
in an ideal state, a first sampling rate of the input first audio data may be represented by Fin, and a second sampling rate of the output second audio data may be represented by Fout. For example, the first sampling rate of the first audio data is 96kb/s, and the second sampling rate of the second audio data is 48 kb/s. If ideally, the clock for inputting the first audio data and the clock for outputting the second audio data are completely synchronized, the ideal conversion ratio may be: r1 f Fin/Fout.
Among these, 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 along with the increase of time.
However, in practice, due to the problem of clock accuracy, the actual sampling rate and the ideal sampling rate (which can be regarded as a preset sampling rate) are deviated, so the actual conversion ratio is: since the accuracy of the audio data can be ensured after the asynchronous sampling rate is converted by the actual conversion ratio R2, R2 (Fin/Fout) + R0, the size of R0 (which can be understood as an adjustment variable) needs to be controlled and adjusted to ensure the accuracy of the audio data.
And, if the input first audio data is filled into the input data buffer at the speed of the first sampling rate Fin in the ideal state, the data amount (denoted by M) of the input first audio data in a certain sub-time can be detected and counted by using the first counter. Similarly, the output second audio data is taken from the output data buffer at the speed of the second sampling rate Fout in the ideal state, so that the data amount (denoted by N) of the output second audio data in a certain sub-time can be detected and counted by using the second counter.
Because of the asynchronous relationship between the input clock and the output clock, M/N ≠ R1, but M/N ═ R2; by formula derivation, the following formula 1 can be obtained:
M/N=R2=(Fin/Fout)+R0;
since M and N are both known quantities obtained through statistics, and Fin and Fout are sampling rates of ideal states and also known quantities, formula 2 can be obtained by transforming formula 1:
R0=M/N-(Fin/Fout);
by the formula 2, R0 can be obtained.
Therefore, by deriving and calculating the above equations 1 and 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 previous sub-time and the conversion ratio R1 in an 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 that effective transmission of the audio data is ensured.
Although in principle, the conversion ratio R2 corresponding to the current sub-time is obtained after adjustment and control are performed by the adjustment variable R0 corresponding to the previous 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 previous sub-time and the data amount N of the second audio data output in the previous sub-time, and in the statistical process, the adjustment variable R0 is taken into account, so the principle according to the conversion ratio R2 is consistent with the actual determination process.
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 volume of the first audio data input in the last sub-time and the data volume of the second audio data output in the last sub-time, determining a compensation value according to the data volume of the first audio data input in the last sub-time and the data volume of the second audio data output in the last sub-time;
and according to the determined compensation value, performing 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 determining the conversion proportion 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 the compensation value to be zero;
if not, splitting the data volume of the first audio data input in the previous 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 volume is an integral multiple of the data volume of the second audio data output in the last sub-time, and the second data volume is a non-integral multiple of the data volume 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 previous sub-time to the data amount of the second audio data output in the previous sub-time is an integer, the determined compensation value is zero, so that this case can be regarded as: the data volume 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 previous sub-time to the data amount of the second audio data output in the previous sub-time is a non-integer, the determined compensation value is the second data amount, and the second data amount is not zero, so that the case can be regarded as follows: and performing compensation processing on the counted data amount 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 can be compensated, and the accuracy of the determined conversion ratio can be improved.
Specifically, in the embodiment of the present invention, when a ratio of a data amount of first audio data input in a last sub-time to a data amount of 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 volume and the data volume of the second audio data output in the last sub-time.
That is, the ratio of the first data amount to the data amount of the second audio data output in the previous 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, the data amount of the second audio data output in the last sub-time is 4, and the ratio of 13 to 4 is a non-integer, then:
splitting 13 into 12 and 1, wherein 12 is a first data volume, and 1 is a second data volume;
and determining the ratio of 12 to 4 as the conversion ratio (namely 3) corresponding to the current sub-time.
Therefore, the determined conversion proportion is an integer, more accurate conversion can be realized when the conversion of the asynchronous sampling rate is carried out, and errors caused by adopting the non-integer conversion proportion to carry out conversion are avoided, so that the conversion accuracy is improved, and the effective transmission of audio data is ensured.
Specifically, in the implementation of the present invention, 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 volume of the first audio data input in the current sub-time and the compensation value as the data volume of the first audio data finally input in the current sub-time.
For example, continuing to adopt the above example, 1 may be used as the second data amount corresponding to the previous sub-time, so when counting the data amount of the first audio data input in the current sub-time, the first counter starts counting from 1 instead of 0; such as:
when the first counter counts first audio data, the value of the first counter is changed from 1 to 2;
when the first counter counts out second first audio data, the value of the first counter is changed from 2 to 3;
until the counting process of the first counter in the current sub-time is completed.
Therefore, the error (namely, the second data volume) calculated in the last sub-time can be used as compensation to compensate the current sub-time, so that the problem of data loss caused by errors in the statistical data volume is avoided.
The following describes a conversion method provided by an embodiment of the present invention with specific examples.
It is assumed that the running time from the device on to the device off is divided into four sub-times (respectively denoted as t1, t2, t3 and t4), and the four sub-times are taken as an example here, but in practical cases, the divided sub-times are not limited to four.
Suppose 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 f Fin/Fout.
In the sub-time t1, the first sampling rate is converted at a conversion ratio R1;
after the sub-time t1, it can be counted that the data size of the first audio data input in the sub-time t1 is M1, the data size of the second audio data output is N1, and if M1/N1 is an integer, the conversion ratio corresponding to the sub-time t2 is: r22 is M1/N1.
In the sub-time t2, the first sampling rate is converted at a conversion ratio R22;
after the sub-time t2, it can be counted that the data volume of the first audio data input in the sub-time t2 is M2, the data volume of the second audio data output is N2, if it is assumed that M2/N2 is a non-integer, M2 can be split into a first data volume P1 and a second data volume P2, and P1/N2 is an integer, so that the conversion ratio corresponding to the sub-time t3 can be obtained as follows: r23 ═ P1/N2.
In the sub-time t3, the first sampling rate is converted at a conversion ratio R23;
after the sub-time t3, it can be counted that the data volume of the first audio data input within the sub-time t3 is M3+ P2, and the data volume of the second audio data output is N3, and if (M3+ P2)/N2 is an integer, the conversion ratio corresponding to the sub-time t4 is: r24 ═ M3+ P2)/N2.
During sub-time t4, the first sampling rate is converted at a conversion ratio of R24.
Based on the same inventive concept, embodiments of the present invention provide a conversion apparatus for asynchronous sampling rate, an implementation principle of the conversion apparatus is similar to that of the foregoing conversion method, and specific implementation manners of the conversion apparatus may refer to specific embodiments of the foregoing conversion method, and repeated details are omitted.
Specifically, an asynchronous sampling rate conversion apparatus provided in 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 input in a current sub-time of a plurality of pre-divided sub-times;
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 and output second audio data with a second sampling rate; wherein a clock when the first audio data is acquired is asynchronous with a clock when the second audio data is output.
Optionally, in an embodiment of the present invention, as shown in fig. 3, the conversion apparatus may further include:
a first audio data caching 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:
the sampling rate conversion circuit 2021 is configured to perform conversion processing on the first sampling rate according to the conversion ratio corresponding to the determined current sub-time to obtain second audio data with a second sampling rate;
a time control circuit 2022 for controlling the counting time of the first data counting circuit 2023 and the second data counting circuit 2024 according to the sub-time divided in advance;
a first number counting circuit 2023 for counting the data amount inputted in the first audio data buffer unit 203;
a second number counting circuit 2024 for counting the data amount inputted in the second audio data buffer unit 204;
the sampling rate control circuit 2025 is configured to divide the sub-time, and determine a 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 the embodiment of the present invention, the time control circuit 2022 may be implemented by, but not limited to, a timer, and both the first quantity counting circuit 2023 and the second quantity counting 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 an asynchronous sampling rate playing system, as shown in fig. 4, including: the asynchronous sampling rate conversion apparatus 401 provided in the embodiment of the present invention.
Optionally, in the embodiment of the present invention, as shown in fig. 5, the playing system further includes an input device 402 for providing the first audio data, and a playing device 403 for playing the second audio data.
Wherein the conversion device is arranged between the input device and the playing device.
The input device may be any device capable of providing first audio data, and is not limited herein; similarly, the playing device may be any device capable of playing the second audio data, and is not limited herein.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (10)

1. A method for asynchronous sample rate conversion, comprising:
acquiring first audio data with a first sampling rate input in the current sub-time in a plurality of pre-divided sub-times;
according to the determined conversion proportion corresponding to the current sub-time, performing conversion processing on the first sampling rate to obtain second audio data with a second sampling rate and outputting the second audio data; wherein a clock when the first audio data is acquired is asynchronous with a clock when the second audio data is output.
2. The conversion method according to claim 1, wherein the sub-time is determined based on 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, all the divided sub-time are the same.
4. The conversion method according to claim 1, wherein when the current sub-time is a 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 an 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.
5. The conversion method according to claim 4, 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 proportion corresponding to the current sub-time is as follows: 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.
6. The conversion method of claim 1, further comprising:
when the conversion proportion corresponding to the current sub-time is determined according to the data volume of the first audio data input in the last sub-time and the data volume of the second audio data output in the last sub-time, determining a compensation value according to the data volume of the first audio data input in the last sub-time and the data volume of the second audio data output in the last sub-time;
and according to the determined compensation value, performing compensation processing on the counted data volume of the first audio data input in the current sub-time.
7. The conversion method according to claim 6, wherein determining the compensation value according to the data amount of the first audio data input in the previous sub-period and the data amount of the second audio data output in the previous sub-period 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;
if yes, determining the compensation value to be 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; wherein 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.
8. The conversion method according to claim 7, wherein when a ratio of the data amount of the first audio data input in the previous sub-period to the data amount of the second audio data output in the previous sub-period is a non-integer, the method for determining the conversion ratio corresponding to the current sub-period comprises:
and determining the conversion ratio corresponding to the current sub-time according to the first data volume and the data volume of the second audio data output in the last sub-time.
9. The conversion method according to claim 6, wherein the compensation processing is performed on the counted data amount of the first audio data input in the current sub-time according to the determined compensation value, specifically including:
and determining the sum of the counted data volume of the first audio data input in the current sub-time and the compensation value as the data volume of the first audio data finally input in the current sub-time.
10. An asynchronous sample rate conversion apparatus, comprising:
the device comprises a first unit, a second unit and a third unit, wherein the first unit is used for acquiring first audio data with a first sampling rate input in the current sub-time in a plurality of pre-divided sub-times;
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 and output second audio data with a second sampling rate; wherein a clock when the first audio data is acquired is asynchronous with a clock when the second audio data is output.
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 true CN114255788A (en) 2022-03-29
CN114255788B 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 (10)

* 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
US20070046508A1 (en) * 2005-08-31 2007-03-01 Naohiro Nishikawa Sampling rate converter and a semiconductor integrated circuit
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
US20130211827A1 (en) * 2012-02-15 2013-08-15 Microsoft Corporation Sample rate converter with automatic anti-aliasing filter
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

Patent Citations (10)

* 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
US20070046508A1 (en) * 2005-08-31 2007-03-01 Naohiro Nishikawa Sampling rate converter and a semiconductor integrated circuit
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
US20130211827A1 (en) * 2012-02-15 2013-08-15 Microsoft Corporation Sample rate converter with automatic anti-aliasing filter
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
CN114255788B (en) 2024-04-09

Similar Documents

Publication Publication Date Title
US5875354A (en) System for synchronization by modifying the rate of conversion by difference of rate between first clock and audio clock during a second time period
CN110597744B (en) Data synchronous transmission method, system and computer equipment
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
CN110636600B (en) Audio synchronous playing method for wireless equipment
US7369637B1 (en) Adaptive sampling rate converter
US10897667B2 (en) Correcting for latency of an audio chain
US9729598B2 (en) Method and a device for signalling transmission time and/or a system clock
CN114255788A (en) Conversion method and conversion device for asynchronous sampling
JPH09247135A (en) Clock recovery device and clock recovery method
CN1829129B (en) Method and apparatus for eliminating transmission delay difference in multipath synchronous data transmission
US5581748A (en) Phase register for synchronization of multiple signal processors
EP1021045A1 (en) Method for processing and apparatus for encoding audio or video frame data
CN112703705A (en) Communication device, communication system, communication method, and communication program
US9209783B2 (en) Efficient drift avoidance mechanism for synchronous and asynchronous digital sample rate converters
US11900953B2 (en) Audio processing device and audio processing method
US8275083B2 (en) Integrated circuit for an asynchronous serial data transfer with a bit length counter
CN101534400B (en) Method for adjusting data transmission sample rate and device thereof
JP4263712B2 (en) Traffic shaping apparatus and traffic shaping method
CN112306919A (en) Data alignment method, device, equipment and medium based on FPGA
US7142567B1 (en) Rate generator in a video on demand system having multiple constant bit rate data
CN117095706A (en) Accurate audio delay playing method and device and chip
CN117768993A (en) Audio synchronization method, audio playing system and storage medium
US6549051B1 (en) Synchronous delay generator
CN113485523B (en) Clock compensation method and device

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