Method for synchronously accessing audio data and audio playback system using the same
10008244 ยท 2018-06-26
Assignee
Inventors
Cpc classification
H04R2227/005
ELECTRICITY
H04B1/205
ELECTRICITY
G11B23/049
PHYSICS
H04B1/207
ELECTRICITY
G11B27/10
PHYSICS
G11B27/002
PHYSICS
International classification
Abstract
A method for synchronously accessing audio data and an audio playback system using the same are provided. The method comprises: providing a first device and a second device; providing an audio common memory in the second device; transmitting an audio data from the first device to the second device when the second device performs an audio playback; writing the audio common memory by the first device and reading the audio common memory by the second device when the first device transmits the audio data to the second device; and performing an interpolation operation by the second device when a difference between a read address value of the second device and a write address value of the first device is different from a predetermined difference.
Claims
1. A method for synchronously accessing an audio data, comprising: providing a first device and a second device; providing an audio memory in the second device; transmitting the audio data from the first device to the second device when the second device performs an audio playback; writing the audio memory by the first device and reading the audio memory by the second device when the first device transmits the audio data to the second device; and performing an interpolation operation by the second device when a difference between a read address value of the second device and a write address value of the first device is different from a predetermined difference; wherein when the difference between the read address value of the second device and the write address value of the first device is different from the predetermined difference, the second device performs the interpolation operation comprising: judging whether the difference between the read address value of the second device and the write address value of the first device is greater than the predetermined difference; performing a point deleting operation when the difference between the read address value of the second device and the write address value of the first device is greater than the predetermined difference; and performing a point interpolating operation when the difference between the read address value of the second device and the write address value of the first device is smaller than the predetermined difference; wherein the audio data comprises multiple sampling point data, and the point interpolating operation comprises the steps of: determining a specific sampling point data to perform the point interpolating operation in the sampling point data; and performing a digital filter computation according to neighboring M sampling point data of the specific sampling point data, and generating (M+1) new sampling point data, where M is a natural number.
2. The method according to claim 1, wherein the sampling point data are represented as Data[i], and the new sampling point data are represented as NewDate[i], where NewDate[i]=C.sub.i,1Data[i1]+C.sub.i,2Data[i], and NewDate[0]=Date[0], where i denotes a time index, i is a positive integer ranging from 1 to M, C.sub.i,1 and C.sub.i,2 denote weighting coefficients, and C.sub.i,1 and C.sub.i,2 are real numbers.
3. The method according to claim 1, wherein the point interpolating operation comprises the steps of: determining the number of point(s) of the sampling point data to be interpolated in the point interpolating operation according to the difference between the read address value of the second device and the write address value of the first device; performing a single point interpolating operation to interpolate one sampling point data when the number of point(s) of the sampling point data to be interpolated is equal to 1; and performing a time-diversified point interpolating operation when the number of point(s) of the sampling point data to be interpolated is greater than 1; wherein the time-diversified point interpolating operation comprises: a step (a) of setting an initial value of a point interpolating variable; a step (b) of judging whether the point interpolating variable is equal to the number of point(s) of the sampling point data to be interpolated; a step (c) of performing the single point interpolating operation when a judged result of the step (b) is negative, and ending the time-diversified point interpolating operation when the judged result of the step (b) is affirmative; a step (d) of starting a timer to count; and a step (e) of setting the point interpolating variable to increase by 1 and resetting the counter and then returning to the step (b) when the timer counts to a predetermined time.
4. The method according to claim 1, wherein the audio data comprises multiple sampling point data, and the point deleting operation comprises: determining a specific sampling point data to perform the point deleting operation in the sampling point data; and performing a digital filter computation according to neighboring (M+1) sampling point data of the specific sampling point data, and generating M new sampling point data, where M is a natural number.
5. The method according to claim 4, wherein the sampling point data are represented as Data[i], and the new sampling point data are represented as NewDate[i], where NewDate[i]=W.sub.i,1Data[i]+W.sub.i,2Data[i+1], and NewDate[0]=Date[0], where i denotes a time index, i is a positive integer ranging from 1 to M, W.sub.i,1 and W.sub.i,2 denote weighting coefficients, and W.sub.i,1 and W.sub.i,2 are real numbers.
6. The method according to claim 1, wherein the point deleting operation comprises the steps of: determining the number of point(s) of the sampling point data to be deleted in the point deleting operation according to the difference between the read address value of the second device and the write address value of the first device; performing a single point deleting operation when the number of point(s) of the sampling point data to be deleted is equal to 1 to delete one sampling point data; and performing a time-diversified point deleting operation when the number of point(s) of the sampling point data to be deleted is greater than 1; wherein the time-diversified point deleting operation comprises: a step (a) of setting an initial value of a point deleting variable; a step (b) of judging whether the point deleting variable is equal to the number of point(s) of the sampling point data to be deleted; a step (c) of performing the single point deleting operation when a judged result of the step (b) is negative, and ending the time-diversified point deleting operation when the judged result of the step (b) is affirmative; a step (d) of starting a timer to count; and a step (e) of setting the point deleting variable to increase by 1 and resetting the counter, and then returning to the step (b) when the timer counts to a predetermined time.
7. The method according to claim 1, wherein a read address of the second device corresponds to a specific indicator, and the step of the interpolation operation further comprises: performing a normalizing process according to the read address of the second device to move the specific indicator.
8. The method according to claim 1, wherein the audio memory has a length, the length is represented as L, and the predetermined difference is L/2.
9. The method according to claim 1, wherein the predetermined difference has a specific range, wherein when the difference between the read address value of the second device and the write address value of the first device is different from the predetermined difference, the second device performs the interpolation operation comprising the steps of: judging whether the difference between the read address value of the second device and the write address value of the first device falls within the specific range; and performing the interpolation operation by the second device when the difference between the read address value of the second device and the write address value of the first device does not fall within the specific range.
10. The method according to claim 1, wherein the first device is connected to the second device through a transmission interface, and the first device writes the audio data into the audio memory through the transmission interface, wherein the transmission interface is a universal serial bus (USB).
11. An audio playback system, comprising: a first device; a second device electrically connected to the first device through an interface, wherein the second device comprises: an audio output device; an audio memory, wherein when the second device performs an audio playback, the first device transmits an audio data through the interface to the audio memory of the second device; and a control circuit coupled to the audio memory and the audio output device; wherein when the first device transmits the audio data to the second device, the first device writes the audio memory, the control circuit of the second device reads the audio memory and performs a playback through the audio output device; wherein when a difference between a read address value of the second device and a write address value of the first device is different from a predetermined difference, the control circuit of the second device performs an interpolation operation; wherein the control circuit judges whether the difference between the read address value of the second device and the write address value of the first device is greater than the predetermined difference, a point deleting operation is performed when the difference between the read address value of the second device and the write address value of the first device is greater than the predetermined difference, and a point interpolating operation is performed when the difference between the read address value of the second device and the write address value of the first device is smaller than the predetermined difference; wherein the audio data comprises multiple sampling point data, the control circuit determines a specific sampling point data from the sampling point data to perform the point interpolating operation, the control circuit performs a digital filter computation according to neighboring M sampling point data of the specific sampling point data and generates (M+1) new sampling point data, where M is a natural number.
12. The audio playback system according to claim 11, wherein the sampling point data are represented as Data[i], and the new sampling point data obtained after the point interpolating operation are represented as NewDate[i], where NewDate[i]=C.sub.i,1Data[i1]+C.sub.i,2Data[i], and NewDate[0]=Date[0], where i denotes a time index, i is a positive integer ranging from 1 to M, C.sub.i,1 and C.sub.i,2 denote weighting coefficients and C.sub.i,1 and C.sub.i,2 are real numbers.
13. The audio playback system according to claim 11, wherein the control circuit further comprises a counter, the control circuit determines the number of point(s) of the sampling point data to be interpolated in the point interpolating operation according to the difference between the read address value of the second device and the write address value of the first device, a single point interpolating operation is performed to interpolate one sampling point data when the number of point(s) of the sampling point data to be interpolated is equal to 1, and a time-diversified point interpolating operation is performed when the number of point(s) of the sampling point data to be interpolated is greater than 1, wherein in the time-diversified point interpolating operation, the control circuit firstly performs the single point interpolating operation, and then when counting of the counter expires each time, the control circuit performs the single point interpolating operation until a count of performing the single point interpolating operation is equal to the number of point(s) of the sampling point data to be interpolated.
14. The audio playback system according to claim 11, wherein the audio data comprises multiple sampling point data, the control circuit determines a specific sampling point data from the sampling point data to perform the point deleting operation, wherein the control circuit performs a digital filter computation according to neighboring (M+1) sampling point data of the specific sampling point data and generates M new sampling point data, where M is a natural number.
15. The audio playback system according to claim 14, wherein the sampling point data are represented as Data[i], and the new sampling point data obtained after the point deleting operation are represented as NewDate[i], where NewDate[i]=W.sub.i,1Data[i]+W.sub.i,2Data[i+1], and NewDate[0]=Date[0], where i denotes a time index, i is a positive integer ranging from 1 to M, W.sub.i,1 and W.sub.i,2 denote weighting coefficients, and W.sub.i,1 and W.sub.i,2 are real numbers.
16. The audio playback system according to claim 11, wherein the control circuit further comprises a counter, the control circuit determines the number of point(s) of the sampling point data to be deleted in the point deleting operation according to the difference between the read address value of the second device and the write address value of the first device, a single point deleting operation is performed when the number of point(s) of the sampling point data to be deleted is equal to 1 to delete one sampling point data, and a time-diversified point deleting operation is performed when the number of point(s) of the sampling point data to be deleted is greater than 1, wherein in the time-diversified point deleting operation, the control circuit firstly performs the single point deleting operation, and then when counting of the counter expires each time, the control circuit performs the single point deleting operation until a count of performing the single point deleting operation is equal to the number of point(s) of the sampling point data to be deleted.
17. The audio playback system according to claim 11, wherein a read address of the second device corresponds to a specific indicator, and the control circuit performs a normalizing process according to the read address of the second device to move the specific indicator when the control circuit performs the interpolation operation.
18. The audio playback system according to claim 11, wherein the audio memory has a length, the length is represented as L, and the predetermined difference is L/2.
19. The audio playback system according to claim 11, wherein the predetermined difference has a specific range, wherein the control circuit judges whether the difference between the read address value of the second device and the write address value of the first device falls within the specific range, and the control circuit performs the interpolation operation when the difference between the read address value of the second device and the write address value of the first device does not fall within the specific range.
20. The audio playback system according to claim 11, wherein the first device is connected to the second device through a transmission interface, the second device writes the audio data into the audio memory through the transmission interface, and the transmission interface is a universal serial bus (USB).
Description
BRIEF DESCRIPTION OF THE DRAWINGS
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
DETAILED DESCRIPTION OF THE INVENTION
(11) At present, the smart phone becomes popularized, and many electronic devices need to jump off the old use, thereby inducing new technology coordinating with the smart phone. Taking a vehicle sounder as an example, not only the playback of the memory card or the audio data on the optical disk is needed, but also the connection with the smart phone is required to directly playback the audio data transmitted from the smart phone.
(12) In general, when the host (e.g. the smart phone) transmitting the audio data and the host (e.g., the automobile head unit) playing back the audio data have different oscillator frequencies, the sampling frequency mismatch occurs between the receiving and transmitting end, so that the sound off or delay occurs when the automobile head unit is playing back the audio data. In the condition where the computation amount and the memory are limited, the present invention proposes a method for synchronously accessing the audio data and an audio playback system using the same to solve the problem of the sampling frequency mismatch.
(13)
(14)
(15) In the condition where the sampling frequency mismatch is present, if the speed of the second device 120 of reading out the audio memory 122 is greater than the speed of the first device 110 of writing the audio memory 122, then after playing back a period of time, the read address Pr exceeds the write address Pw so that the second device 120 reads the audio data, which is not updated, to cause the discontinuous playback of the second device 120. In addition, in the condition where the sampling frequency mismatch is present, if the speed of the first device 110 of writing the audio memory 122 is greater than the speed of the second device 120 of reading out the audio memory 122, then after playing back a period of time, the read address Pr lags behind the write address Pw to much, so that the first device 110 covers the audio data of the audio memory 122, which has not yet been read by the second device 120, to cause the discontinuous playback of the second device 120.
(16) In this embodiment, the control circuit 123 detects whether the difference between the read address Pr and the write address Pw is different from a predetermined difference Dth. When the difference between the read address Pr and the write address Pw is different from the predetermined difference Dth, the control circuit 123 performs an interpolation operation to compensate for the insufficient or excess sampling points. The above-mentioned interpolation operation is a point interpolating operation or a point deleting operation, for example. For example, if the read speed of the second device 120 lags behind the write speed of the first device 110, then the control circuit 123 performs the point deleting operation. If the read speed of the second device 120 exceeds the write speed of the first device 110, then the control circuit 123 performs the point interpolating operation. In order to disable the ears of the user from hearing the audio data whose sampling is changed by the control circuit 123 according to a preferred embodiment of the present invention, the control circuit 123 does not simply add the sampling points or delete the sampling points when performing the interpolation operation, but performs a smoothening process or digital signal process having correlations, such as the digital filter calculation, on the audio data neighboring the address of the sampling point where the point interpolating or point deleting is to be performed.
(17) In addition, after the control circuit 123 executes the point interpolating operation, the read address Pr is normalized so that the difference D between the read address Pr and the write address Pw more approaches the predetermined difference Dth. In other words, when the control circuit 123 performs the point interpolating operation, the indicator of the read address Pr moves backwards. On the contrary, when the control circuit 123 performs the point deleting operation, the indicator of the read address Pr moves frontwards.
(18) This embodiment detects the difference between the read address and the write address to perform the point interpolating or point deleting operation of the sampling data. Thus, the present invention can adaptively adjust the read and write speeds of the two host devices, as well as compensate for the process errors of the quartz oscillators of the two hosts.
(19) The above-mentioned detects the difference between the read address Pr and the write address Pw by way of, for example, calculating the address to address distance. In order to make those skilled in the art be able to implement the present invention through this embodiment, the method of calculating the address to address distance will be described in the following.
(20) In this embodiment, the above-mentioned predetermined difference Dth is, for example, a constant value, which may be determined according to the hardware parameter or application of the system the present invention and the value of the predetermined difference Dth is not restricted. For example, the predetermined difference Dth is designed to be, for example, a half of the length L of the audio memory 122, that is, Dth=L/2. The advantages of designing Dth=L/2 resides in that the method of calculating the above-mentioned difference D can be simplified, the difference D between the read address Pr and the write address Pw is |PrPw|, | | wherein denotes the absolute value.
(21) In the above-mentioned embodiment, the predetermined difference Dth is a constant value as an example. However, those skilled in the art can infer that the predetermined difference Dth may also be falls within a specific range. When the difference D between the read address Pr and the write address Pw falls within the specific range, the control circuit 123 does not perform the point interpolating or point deleting operation. On the contrary, if the difference D between the read address Pr and the write address Pw exceeds the specific range, then the point interpolating or point deleting operation starts.
(22) In order to make those skilled in the art be able to implement the present invention through this embodiment, the interpolation operation method of this embodiment will be described in the following. For the sake of the following illustration this embodiment, it is firstly assumed that the control circuit 123 detects that the difference D between the read address Pr and the write address Pw is smaller than the above-mentioned predetermined difference Dth, and the difference between the difference D and the predetermined value Dth exceeds the distance of one sampling data. This condition denotes that the read speed exceeds the write speed, and the control circuit 123 judges that the point interpolating operation needs to be performed at this time to interpolate one sampling point data. In order to prevent the user from hearing the audio with the pop noise or sound off, the point interpolating operation of this embodiment adopts the smoothening process technology, and changes the sampling point data neighboring the point interpolating data address.
(23)
(24) After the point interpolating operation is performed, the control circuit 123 normalizes the read address Pr, and moves the read address Pr in the audio memory 122, so that the difference D between the read address Pr and the write address Pw returns to the allowable range. In the above-mentioned example, the read speed exceeds the write speed, the difference D between the read address Pr and the write address Pw is greater than the predetermined difference Dth by the distance of one sampling data. Thus, after the point interpolating operation is performed, the control circuit 123 moves the read address Pr backwards by one address.
(25) Next, in order to describe the interpolation operation of this embodiment, it is assumed that when the control circuit 123 detects that the difference D between the read address Pr and the write address Pw is greater than the above-mentioned predetermined difference Dth, and the difference between the difference D and the predetermined value Dth exceeds the distance of one sampling data. This case denotes that read speed cannot catch up with the write speed, and that the control circuit 123 judges that the point deleting operation needs to be performed at this time to delete one sampling point data.
(26) After performing the point deleting operation, the control circuit 123 normalizes the read address Pr, and moves the read address Pr in the audio memory 122, so that the difference D between the read address Pr and the write address Pw returns to the allowable range. In the above-mentioned example, the read speed is smaller than the write speed, and the difference D between the read address Pr and the write address Pw is greater than the predetermined difference Dth by the distance of one sampling data. Thus, after performing the point deleting operation, the control circuit 123 moves the read address Pr frontwards by one address.
(27) The read address Pr and the write address Pw of the above-mentioned audio memory 122 may be, for example, the position of the real memory, may also be the virtual address upon software operation, and the present invention does not restrict the address recording pattern. In addition, the above-mentioned read address Pr and write address Pw are, for example, two indicators for recording the read address Pr and the write address Pw, respectively. After the above-mentioned interpolation operation, the control circuit 123 moves the indicator corresponding to the read address Pr to adjust the difference D between the read address Pr and the write address Pw.
(28) According to the above-mentioned descriptions regarding to
(29) In the above-mentioned interpolation operation, multiple parameters C.sub.i,1, C.sub.i,2, W.sub.i,1 and W.sub.i,2 are used, wherein the parameters are, for example, the weighting coefficients upon calculation of the new data NewDate[t]. The values of the multiple weighting coefficients are designed in advance by the circuit designer, for example, stored in the system, and can be directly used upon calculation of the new data NewDate[t]. Alternatively, after this system is turned on, the above-mentioned weighting coefficients are adaptively generated according to the property of the audio data or the system parameter. Thus, the present invention does not restrict the time for generating the weighting coefficients. In addition, the values of the weighting coefficients C.sub.i,1, C.sub.i,2, W.sub.i,1 and W.sub.i,2 may be generated through the algorithm in the prior art equalizer, digital filter or the like. So, the present invention does not restrict the calculating method of the weighting coefficient.
(30) In the above-mentioned embodiment, the new data NewDate[t] after the point interpolating operation and the point deleting operation relates to the previous sampling time data or the following sampling time data, for example. However, those skilled in the art should know that the point interpolating operation and the point deleting operation do not restrict data points to be operated, and the new data NewDate[t] may relate to the previous and following data concurrently, for example, or may relate to the data of the previous N sampling times or the following N sampling data, wherein N is a positive integer.
(31) In the above-mentioned embodiment, all the new data NewDate[t] in the point interpolating operation and the point deleting operation are generated using a linear equation. However, those skilled in the art should know that the present invention does not restrict the mathematical expression of the point interpolating operation and the point deleting operation. Any technology correlated with the digital signal process may be applied to the present invention.
(32) In the examples of the above-mentioned point interpolating operation and point deleting operation, the distance of one sampling point is described. However, those skilled in the art should know that, when the control circuit 123 detects that the difference D between the read address Pr and the write address Pw is too large, the present invention may also perform the point interpolating operation or point deleting operation for multiple points at a time. That is, multiple sampling point data are added in a point interpolating operation, and multiple sampling point data are deleted in a point deleting operation.
(33) In addition, if multiple points of data are interpolated or deleted at the same tine, the audio signal being played back may have the problem, such as sound off, audio delay or the like, to make the user hear the unpleasant audio. Thus, in a preferred embodiment of the present invention, the control circuit 123 further comprises a counter for making the above-mentioned point interpolating or point deleting operations be uniformly distributed over different times.
(34) For example, when the control circuit 123 detects that the difference D between the read address Pr and the write address Pw is smaller the above-mentioned predetermined difference Dth, and the control circuit 123 judges that three sampling point data need to be interpolated through the point interpolating operation, the control circuit 123 firstly performs the point interpolating operation to interpolate one sampling point data. The method of the point interpolating operation is the method mentioned in
(35) According to the above-mentioned description, it is obtained that the control circuit 123 performs a time-diversified point interpolating operation. When the counting expires, the point interpolating operation is again started, and each point interpolating operation only interpolates one sampling point data. Thus, this embodiment uniformly distributes the times of interpolating the sampling point data in a time-diversified manner, so that the human ears cannot hear that the audio data are changed.
(36) On the contrary, when the control circuit 123 detects that the difference D between the read address Pr and the write address Pw is greater than the above-mentioned predetermined difference Dth, and the control circuit 123 judges that three sampling point data need to be deleted through the point deleting operation, the control circuit 123 firstly performs the point deleting operation to delete one sampling point data. The method of the point deleting operation is the method mentioned in
(37) According to the above-mentioned descriptions, it is obtained that the control circuit 123 performs a time-diversified point deleting operation. When the counting expires, the point deleting operation again starts, and each point deleting operation only deletes one sampling point data. Thus, this embodiment uniformly distributes the times of deleting the sampling point data in a time-diversified manner, so that the human ears cannot hear that the audio data are changed.
(38) The above-mentioned control circuit 123 uses the counter to uniformly perform the point interpolating operation and the point deleting operation, wherein a time interval between the operations is a predetermined time, which may be determines by the frequency offset of the oscillator detected by the control circuit 123, or may be determined according to other system parameters. In addition, the counter within the control circuit 123 may be used to count to a predetermined time, may also be used to count the number of times of reading the data from the audio memory 122, or may be another clock in the system. Thus, the present invention does not restrict the application of the counter.
(39) According to the description of the above-mentioned audio playback system, this embodiment can be generalized as a method for synchronously accessing audio data.
(40) In step S601, a method for synchronously accessing audio data starts.
(41) In step S602, it is judged whether the difference D between the read address Pr and the write address Pw is different from the predetermined difference Dth. If the judged result is affirmative (Yes), then step S602 is executed. If the judged result is negative (No), then the method returns to the step S602. It is obtained, from the above-mentioned embodiment, that the control circuit 123 detects the difference D between the read address Pr and the write address Pw according to the calculating method shown in
(42) In step S603, it is judged whether the difference D between the read address Pr and the write address Pw is greater than the predetermined difference Dth. If the judged result is affirmative (Yes), then step S604 is executed. If the judged result is negative (No), then step S605 is executed. It is obtained, from the above-mentioned embodiment, that the condition when the difference D is greater than Dth denotes that the read speed cannot catch up with the write speed, and the control circuit 123 performs the point deleting operation. On the contrary, the condition when the difference D is smaller than Dth denotes that the read speed exceeds the write speed, and the control circuit 123 performs the point interpolating operation.
(43) In step S604, the point deleting operation is performed according to the method shown in
(44) In step S605, the point interpolating operation is performed according to the method shown in
(45) After the control circuit 123 executes the point deleting operation of the step S604 or the point interpolating operation of the step S605, the method returns to the step S602 to continue detecting whether the read speed and write speed of the audio data are synchronized with each other.
(46) In another embodiment of the present invention, in order to prevent the control circuit 123 from continuously performing the point interpolating or point deleting, the counting mechanism is added so that the control circuit 123 uniformly distributes the timings of the point interpolating or point deleting operations. The detailed implementation steps of the step S604 is shown in
(47) In step S701, it is judged whether the number of to-be-deleted point(s) Sb is greater than one. As described in the above-mentioned embodiment, the control circuit 123 determines how many sampling point data are to be deleted in this point deleting operation according to the difference between the above-mentioned difference D and the predetermined difference Dth. For the sake of illustration of this embodiment, the total number of to-be-deleted sampling point data is represented as Sb. If Sb is equal to 1, then step S702 is executed. If Sb is greater than 1, then step S703 is executed.
(48) In step S702, the point deleting operation is performed according to a single point deleting operation shown in
(49) In step S703, an initial value of a point deleting variable B is set. In this embodiment, the initial value of the point deleting variable B is 0.
(50) In step S704, it is judged whether the point deleting variable B is equal to the total number Sb of the above-mentioned point deleting data. If the judged result is negative (No), then step S705 is continued to perform the point deleting operation. If the judged result is affirmative (Yes), then it represents that all points have been deleted, and the process returns to the step S602.
(51) In step S705, the point deleting operation is performed. The control circuit 123 performs the point deleting operation to delete one sampling point data, and the read address Pr is normalized.
(52) In step S706, the counter starts counting.
(53) In step S707, it is judged whether the counter counts to the predetermined time TP. If the judged result is affirmative (Yes), then the step S708 is executed. If the judged result is negative (No), then the method returns to the step S707.
(54) In step S708, the point deleting variable B=B+1 is set, and the timer is reset. In other words, the point deleting variable B is increased by 1. The method returns to step S704 to continue judging.
(55) Similarly, the detailed implementation steps of the above-mentioned point interpolating step S605 is shown in
(56) In step S801, it is judged whether the number of to-be-interpolated point(s) Sa is greater than one. As described in the above-mentioned embodiment, the control circuit 123 determines how many sampling point data are to be interpolated in this point interpolating operation according to the difference between the above-mentioned difference D and the predetermined difference Dth. For the sake of illustration of this embodiment, the total number of to-be-interpolated sampling point data is represented as Sa. If Sa is equal to 1, then step S802 is executed. If Sa is greater than 1, then step S803 is executed.
(57) In step S802, the point interpolating operation is performed according go the single point interpolating operation shown in
(58) In step S803, an initial value of a point interpolating variable A is set. In this embodiment, the initial value of the point interpolating variable A is 0.
(59) In step S804, it is judged whether the point interpolating variable A is equal to the total number Sa of the above-mentioned point interpolating data. If the judged result is negative (No), then step S805 is continued to perform the point interpolating operation. If the judged result is affirmative (Yes), then it represents that all the points have been interpolated, and the process returns to the step S602.
(60) In step S805, the point interpolating operation is performed. The control circuit 123 performs the point interpolating operation to interpolate one sampling point data, and the read address Pr is normalized.
(61) In step S806, the counter starts counting.
(62) In step S807, it is judged whether the counter counts to the predetermined time TP. If the judged result is affirmative (Yes), then step S808 is executed. If the judged result is negative (No), then the method returns to step S807.
(63) In step S808, the point interpolating variable A=A+1 is set, and the timer is reset. In other words, the point interpolating variable A is increased by 1. The method returns to step S804 to continue judging.
(64) In summary, it is obtained that the present invention has the following advantages according to the descriptions of the embodiments of the present invention.
(65) 1. This embodiment detects the difference between the read address and the write address to perform the point interpolating or point deleting operation of the sampling data. Thus, the present invention can adaptively adjust the read and write speeds of the two host devices, and compensate for the process errors of the quartz oscillators of the two hosts, so that the audio data can be played back immediately and smoothly.
(66) 2. When the embodiment of the present invention performs the point interpolating operation and point deleting operation, the data neighboring the addresses, where the point deleting and point interpolating are to be performed, are also incorporated and calculated, so that the audio data after the point interpolating or point deleting operation can keep the smoothness of the audio signal, and the user always hear the smooth audio without any pop noise or delayed playback problem.
(67) 3. The point interpolating operation and point deleting operation of the embodiment of the present invention only use the adder and the multiplier, and needs not to perform up-sampling and down-sampling on the signal in a manner similar to the prior art. Thus, the present invention can immediately compensate for the frequency offset of the oscillator without adding the computation amount.
(68) 4. In addition, the embodiment of the present invention further utilizes the time-diversified concept. The point interpolating or point deleting operation cannot be performed until a period of time interval has elapsed. In addition, only one sampling point data is deleted in each point deleting operation. Thus, the hearing sense of the user cannot distinguish between the differences of the audio data, so that the human ears cannot hear that the audio data are changed.
(69) While the present invention has been described by way of examples and in terms of preferred embodiments, it is to be understood that the present invention is not limited thereto. To the contrary, it is intended to cover various modifications. Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications.