TWI722574B - Audio and data synchronization device and method thereof - Google Patents

Audio and data synchronization device and method thereof Download PDF

Info

Publication number
TWI722574B
TWI722574B TW108133694A TW108133694A TWI722574B TW I722574 B TWI722574 B TW I722574B TW 108133694 A TW108133694 A TW 108133694A TW 108133694 A TW108133694 A TW 108133694A TW I722574 B TWI722574 B TW I722574B
Authority
TW
Taiwan
Prior art keywords
audio
data
clock signal
out buffer
amount
Prior art date
Application number
TW108133694A
Other languages
Chinese (zh)
Other versions
TW202113808A (en
Inventor
邱達進
涂結盛
Original Assignee
新唐科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 新唐科技股份有限公司 filed Critical 新唐科技股份有限公司
Priority to TW108133694A priority Critical patent/TWI722574B/en
Priority to CN201911098617.0A priority patent/CN112533046A/en
Application granted granted Critical
Publication of TWI722574B publication Critical patent/TWI722574B/en
Publication of TW202113808A publication Critical patent/TW202113808A/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/4302Content synchronisation processes, e.g. decoder synchronisation
    • H04N21/4307Synchronising the rendering of multiple content streams or additional data on devices, e.g. synchronisation of audio on a mobile phone with the video output on the TV screen
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/44004Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving video buffer management, e.g. video decoder buffer or video display buffer
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display

Abstract

本發明揭露一種音訊資料同步裝置,其包含通用序列匯流排(USB)主機、處理器以及音訊編解碼器。處理器包含一通用序列匯流排模組用以接收來自USB主機音訊封包;先進先出(FIFO)緩衝器儲存音訊封包;時脈產生器產生時脈訊號;控制單元儲存最大資料量臨界值和最小資料量臨界值,並判斷FIFO緩衝器所儲存的資料量是否大於最大資料量臨界值或是小於該最小資料量臨界值,藉以提高或降低時脈訊號之頻率;以及一資料傳輸介面。音訊編解碼器透過資料傳輸介面接收音訊封包以及時脈訊號,並根據時脈訊號處理音訊封包,以輸出音訊。 The present invention discloses an audio data synchronization device, which includes a universal serial bus (USB) host, a processor, and an audio codec. The processor includes a universal serial bus module to receive audio packets from the USB host; the first-in first-out (FIFO) buffer stores the audio packets; the clock generator generates the clock signal; the control unit stores the maximum data volume threshold and the minimum Data volume threshold, and determine whether the data volume stored in the FIFO buffer is greater than the maximum data volume threshold or less than the minimum data volume threshold, so as to increase or decrease the frequency of the clock signal; and a data transmission interface. The audio codec receives audio packets and clock signals through the data transmission interface, and processes the audio packets according to the clock signals to output audio.

Description

音訊資料同步裝置及其方法 Audio data synchronization device and method

本發明係關於一種音訊資料處理技術,特別是有關於一種音訊資料同步裝置和方法。 The present invention relates to an audio data processing technology, in particular to an audio data synchronization device and method.

在許多的音頻的應用,使用通用序列匯流排(USB)進行音頻播放已漸成主流。一般而言,音訊處理對時脈同步要求在2500ppm的誤差範圍內,所以每2500ppm就可能會產生一時間誤差,累積的時間誤差就會讓聲音產生破音的現象。 In many audio applications, the use of universal serial bus (USB) for audio playback has gradually become the mainstream. Generally speaking, audio processing requires clock synchronization within the error range of 2500ppm, so every 2500ppm may produce a time error, and the accumulated time error will cause the sound to break the sound.

由於通用序列匯流排協議是非同步(asynchronous)設計,用於產生音訊封包的通用序列匯流排主機以及用於編解碼音訊封包撥放的音訊編解碼器的時脈源不一致,所以儲存音訊封包的緩衝器容易會有緩衝器溢出(overflow)或欠載(underrun)的問題產生,而產生破音的現象。 Since the universal serial bus protocol is an asynchronous design, the clock sources of the universal serial bus host used to generate audio packets and the audio codec used to encode and decode audio packets are inconsistent, so the buffer for storing audio packets The device is prone to buffer overflow or underrun problems, resulting in sound breaking.

本發明之一目的在於提出一種音訊資料同步裝置和方法,其利用處理器之時脈產生器產生一時脈訊號同時提供給計數器及資料傳輸介面,並利用計數器監測儲存音訊封包之先進先出緩衝器的資料儲存量的變化,來調整時脈訊號的頻率,以防止先進先出緩衝器溢出或欠載所造成的破音。 One purpose of the present invention is to provide an audio data synchronization device and method, which uses the clock generator of the processor to generate a clock signal and provides it to the counter and the data transmission interface at the same time, and uses the counter to monitor the first-in-first-out buffer for storing audio packets To adjust the frequency of the clock signal by changing the amount of data stored to prevent the sound breakage caused by the overflow or underload of the first-in-first-out buffer.

為達成上述目的,本發明提供一種音訊資料同步裝置,其裝置包含一通用序列匯流排主機、一處理器以及一音訊編解碼器。通用序列匯流排主機係用以傳送一音訊封包。處理器包含一通用序列匯流排(USB)模組、先進先出(FIFO)緩衝器、一時脈產生器、一控制單元以及一資料傳輸介面。通用序列匯流排模組用以接收音訊封包。先進先出緩衝器用以儲存音訊封包。時脈產生器產生一時脈訊號。控制單元係儲存一最大資料量臨界值和一最小資料量臨界值,並判斷先進先出緩衝器所儲存的資料量是否大於最大資料量臨界值或是小於最小資料量臨界值。當控制單元判斷先進先出緩衝器所儲存的資料量大於最大資料量臨界值時,控制單元控制時脈產生器提高時脈訊號之頻率,當控制單元判斷先進先出緩衝器所儲存的資料量小於最小資料量臨界值時,控制單元控制時脈產生器降低時脈訊號之頻率。資料傳輸介面係從先進先出緩衝器輸出音訊封包,以及輸出時脈訊號。音訊編解碼器係透過資料傳輸介面接收音訊封包以及時脈訊號,並根據時脈訊號處理音訊封包,以輸出音訊。 To achieve the above objective, the present invention provides an audio data synchronization device, which includes a universal serial bus host, a processor, and an audio codec. The universal serial bus host is used to transmit an audio packet. The processor includes a universal serial bus (USB) module, a first-in-first-out (FIFO) buffer, a clock generator, a control unit, and a data transmission interface. The universal serial bus module is used to receive audio packets. The first-in first-out buffer is used to store audio packets. The clock generator generates a clock signal. The control unit stores a maximum data volume threshold and a minimum data volume threshold, and determines whether the data volume stored in the first-in first-out buffer is greater than the maximum data volume threshold or less than the minimum data volume threshold. When the control unit determines that the amount of data stored in the first-in-first-out buffer is greater than the maximum data amount threshold, the control unit controls the clock generator to increase the frequency of the clock signal. When the control unit determines the amount of data stored in the first-in-first-out buffer When it is less than the threshold of the minimum data amount, the control unit controls the clock generator to reduce the frequency of the clock signal. The data transmission interface outputs audio packets from the first-in first-out buffer and outputs the clock signal. The audio codec receives audio packets and clock signals through the data transmission interface, and processes the audio packets according to the clock signals to output audio.

根據本發明之一實施例,上述資料傳輸介面係為一積體電路間音訊(Inter-IC Sound,I2S)介面,用以傳遞音訊封包給音訊編解碼器。 According to an embodiment of the present invention, the aforementioned data transmission interface is an Inter-IC Sound (I 2 S) interface for transmitting audio packets to the audio codec.

根據本發明之一實施例,處理器包含一計數器,且當計數器計數達到一預設值時,計數器產生一觸發訊號給控制單元,以觸發控制單元判斷先進先出緩衝器所儲存的資料量之狀態,藉此使控制單元重複地判斷先進先出緩衝器所儲存的資料量之狀態。 According to an embodiment of the present invention, the processor includes a counter, and when the counter count reaches a preset value, the counter generates a trigger signal to the control unit to trigger the control unit to determine the amount of data stored in the first-in-first-out buffer The status, thereby allowing the control unit to repeatedly determine the status of the amount of data stored in the first-in-first-out buffer.

根據本發明之一實施例,計數器係基於時脈訊號進行計數。 According to an embodiment of the present invention, the counter counts based on the clock signal.

根據本發明之一實施例,通用序列匯流排主機之操作時脈係獨立於該時脈訊號。 According to an embodiment of the present invention, the operating clock of the universal serial bus host is independent of the clock signal.

為達成上述目的,本發明提供一種音訊資料同步方法,其包含下列步驟:從一通用序列匯流排主機接收一音訊封包;將音訊封包儲存於 一先進先出緩衝器;設定先進先出緩衝器之一最大資料量臨界值和一最小資料量臨界值;產生一時脈訊號;透過一資料傳輸介面,從先進先出緩衝器輸出音訊封包以及輸出時脈訊號至一音訊編解碼器;使用音訊編解碼器根據時脈訊號處理音訊封包,以輸出音訊;判斷先進先出緩衝器所儲存的資料量是否大於最大資料量臨界值或是小於最小資料量臨界值;當判斷先進先出緩衝器所儲存的資料量大於最大資料量臨界值時,提高時脈訊號之頻率;以及當判斷先進先出緩衝器所儲存的資料量小於最小資料量臨界值時,降低時脈訊號之頻率。 To achieve the above objective, the present invention provides an audio data synchronization method, which includes the following steps: receiving an audio packet from a universal serial bus host; storing the audio packet in A first-in-first-out buffer; set a maximum data volume threshold and a minimum data volume threshold of the first-in-first-out buffer; generate a clock signal; output audio packets and output from the first-in-first-out buffer through a data transmission interface Clock signal to an audio codec; use the audio codec to process audio packets according to the clock signal to output audio; determine whether the amount of data stored in the first-in first-out buffer is greater than the threshold of the maximum amount of data or less than the minimum amount of data When it is judged that the amount of data stored in the first-in first-out buffer is greater than the threshold of the maximum amount of data, increase the frequency of the clock signal; and when it is judged that the amount of data stored in the first-in-first-out buffer is less than the threshold of the minimum amount of data When, reduce the frequency of the clock signal.

根據本發明之一實施例,資料傳輸介面係為一I2S介面,用以傳遞該音訊封包給音訊編解碼器。 According to an embodiment of the present invention, the data transmission interface is an I 2 S interface for transmitting the audio packet to the audio codec.

根據本發明之一實施例,本發明之音訊資料同步方法包含使用一計數器,當該計數器計數達到一預設值時,該計數器產生一觸發訊號,以觸發判斷該先進先出緩衝器所儲存的資料量之狀態,藉此重複地判斷該先進先出緩衝器所儲存的資料量之狀態。 According to an embodiment of the present invention, the audio data synchronization method of the present invention includes using a counter. When the counter count reaches a preset value, the counter generates a trigger signal to trigger the judgment of the first-in-first-out buffer. The status of the data volume is used to repeatedly determine the status of the data volume stored in the first-in-first-out buffer.

根據本發明之一實施例,計數器係基於時脈訊號進行計數。 According to an embodiment of the present invention, the counter counts based on the clock signal.

根據本發明之一實施例,通用序列匯流排主機之操作時脈係獨立於該時脈訊號。 According to an embodiment of the present invention, the operating clock of the universal serial bus host is independent of the clock signal.

如上所述,本發明之目的在提供一種音訊資料同步裝置和方法,由處理器持續的計數先進先出緩衝器裡面的資料量大小,然後再根據資料量再回授控制時脈訊號的頻率,使得通用序列匯流排主機傳送資料的速度與音訊編解碼器的速度能有效地同步,以避免因兩者不同步而造成緩衝器資料溢出或欠載,產生破音現象。 As mentioned above, the object of the present invention is to provide an audio data synchronization device and method. The processor continuously counts the amount of data in the first-in-first-out buffer, and then feeds back and controls the frequency of the clock signal according to the amount of data. The data transmission speed of the universal serial bus host can be effectively synchronized with the speed of the audio codec, so as to avoid overflow or underload of the buffer data due to the asynchrony between the two, and the phenomenon of sound breakage.

100:處理器 100: processor

101:通用序列匯流排主機 101: Universal serial bus host

1011:音訊封包 1011: Audio packet

111:通用序列匯流排模組 111: Universal Serial Bus Module

112:先進先出緩衝器 112: FIFO buffer

1121:資料量 1121: data volume

113:資料傳輸介面 113: Data Transmission Interface

114:控制單元 114: control unit

115:計數器 115: counter

116:時脈產生器 116: Clock Generator

1171:時脈訊號 1171: Clock signal

120:觸發訊號 120: trigger signal

130:音訊編解碼器 130: Audio codec

200:架構圖 200: Architecture diagram

201:通用序列匯流排主機振盪器 201: Universal Serial Bus Host Oscillator

301:最大資料量臨界值 301: Maximum data volume threshold

302:I2S介面 302: I 2 S interface

401:最小資料量臨界值 401: Minimum data volume threshold

501、502、503、504、505、506、601、602、603、604、605、606、607:步驟 501, 502, 503, 504, 505, 506, 601, 602, 603, 604, 605, 606, 607: steps

第1圖係繪示本發明之音訊資料同步裝置之方塊圖。 Figure 1 is a block diagram of the audio data synchronization device of the present invention.

第2圖係繪示本發明之音訊資料同步裝置之方塊圖。 Figure 2 is a block diagram of the audio data synchronization device of the present invention.

第3圖係繪示本發明之避免先進先出緩衝器資料量溢出之操作示意圖。 Figure 3 is a schematic diagram illustrating the operation of the present invention to avoid overflow of data in the first-in-first-out buffer.

第4圖係繪示本發明之避免先進先出緩衝器資料量欠載之操作示意圖。 Figure 4 is a schematic diagram illustrating the operation of the present invention to avoid under-loading of data in the first-in-first-out buffer.

第5圖係繪本發明之音訊資料同步方法之流程圖。 Figure 5 is a flowchart of the audio data synchronization method of the present invention.

第6圖係繪本發明之音訊資料同步方法之實施例之流程圖。 Figure 6 is a flowchart of an embodiment of the audio data synchronization method of the present invention.

以下,參考伴隨的圖式,詳細說明依據本發明的實施例,俾使本領域者易於瞭解。所述之創作可以採用多種變化的實施方式,當不能只限定於這些實施例。本發明省略已熟知部分(well-known part)的描述,並且相同的參考號於本發明中代表相同的元件。 Hereinafter, with reference to the accompanying drawings, the embodiments according to the present invention will be described in detail to make it easy for those skilled in the art to understand. The above-mentioned creation can be implemented in a variety of variations, but should not be limited to these embodiments. The description of the well-known part is omitted in the present invention, and the same reference numbers represent the same elements in the present invention.

請參閱第1圖至第4圖,其繪示本發明之音訊資料同步裝置之方塊圖以及操作示意圖。如第1圖所示,音訊資料同步裝置包含一通用序列匯流排(USB)主機101、一處理器100以及一音訊編解碼器(Audio codec)130。處理器100係連接於通用序列匯流排主機101以及音訊編解碼器130之間,做為通用序列匯流排主機與音訊編解碼器之間的橋樑,處理器100可接收通用序列匯流排主機101的音訊封包再傳送給音訊編解碼器130作為聲音源。 Please refer to FIG. 1 to FIG. 4, which show the block diagram and operation schematic diagram of the audio data synchronization device of the present invention. As shown in FIG. 1, the audio data synchronization device includes a universal serial bus (USB) host 101, a processor 100, and an audio codec 130. The processor 100 is connected between the universal serial bus host 101 and the audio codec 130, as a bridge between the universal serial bus host and the audio codec, the processor 100 can receive the universal serial bus host 101 The audio packet is then sent to the audio codec 130 as a sound source.

處理器100包含一通用序列匯流排(USB)模組111、一先進先出(FIFO)緩衝器112、一時脈產生器116、一控制單元114、一計數器115、以及一資料傳輸介面113。在一實施例中,通用序列匯流排主機可設置於一電腦中,而音 訊編解碼器130可以是連接於電腦之通用序列匯流排埠的麥克風或是喇叭;資料傳輸介面113可為一積體電路間音訊(Inter-IC Sound,I2S)介面。 The processor 100 includes a universal serial bus (USB) module 111, a first-in-first-out (FIFO) buffer 112, a clock generator 116, a control unit 114, a counter 115, and a data transmission interface 113. In one embodiment, the universal serial bus host can be set in a computer, and the audio codec 130 can be a microphone or speaker connected to the universal serial bus port of the computer; the data transmission interface 113 can be an integrated Inter-IC Sound (I 2 S) interface.

通用序列匯流排主機101係用以傳送一音訊封包1011,而儲存於處理器100之先進先出緩衝器112中。通用序列匯流排模組111係用以接收音訊封包1011,先進先出緩衝器112係用以儲存音訊封包1011,而時脈產生器116係用以產生一時脈訊號1171。資料傳輸介面113係用以從先進先出緩衝器112輸出音訊封包1011,以及輸出時脈訊號1171給音訊編解碼器130。音訊編解碼器130可透過處理器100之資料傳輸介面113接收音訊封包1011以及時脈訊號1171,並根據時脈訊號1171處理音訊封包1011,以輸出音訊。 The universal serial bus host 101 is used to transmit an audio packet 1011 and stored in the first-in first-out buffer 112 of the processor 100. The universal serial bus module 111 is used to receive the audio packet 1011, the first-in first-out buffer 112 is used to store the audio packet 1011, and the clock generator 116 is used to generate a clock signal 1171. The data transmission interface 113 is used to output the audio packet 1011 from the first-in first-out buffer 112 and output the clock signal 1171 to the audio codec 130. The audio codec 130 can receive the audio packet 1011 and the clock signal 1171 through the data transmission interface 113 of the processor 100, and process the audio packet 1011 according to the clock signal 1171 to output audio.

由於通用序列匯流排協議是非同步(asynchronous)設計,通用序列匯流排主機和音訊編解碼器會使用各自獨立的時脈訊號,如第2圖所示,通用序列匯流排主機101使用通用序列匯流排主機振盪器201作為時脈源,而音訊編解碼器130是使用處理器100提供的時脈訊號1171作為其時脈源,因此音訊編解碼器130進行解碼處理速度(例如播放音訊或是錄音)與音訊封包之產生速度(電腦的處理速度)不同步,則封包處理時間一久,就容易造成緩衝器資料溢出或欠載,進而產生破音的問題。 Since the universal serial bus protocol is an asynchronous design, the universal serial bus host and audio codec will use their own independent clock signals. As shown in Figure 2, the universal serial bus host 101 uses the universal serial bus The host oscillator 201 is used as the clock source, and the audio codec 130 uses the clock signal 1171 provided by the processor 100 as its clock source, so the audio codec 130 performs decoding processing speed (for example, playing audio or recording) If it is not synchronized with the generation speed of the audio packet (computer processing speed), the packet processing time will easily cause the buffer data overflow or underload, which will cause the problem of audio cracking.

為了解決此問題,控制單元114係儲存且設定一最大資料量臨界值301(作為上限)以及一最小資料量臨界值401(作為下限),並判斷先進先出緩衝器112所儲存的資料量1121是否大於最大資料量臨界值301或是小於最小資料量臨界值401。 To solve this problem, the control unit 114 stores and sets a maximum data volume threshold 301 (as an upper limit) and a minimum data volume threshold 401 (as a lower limit), and determines the data volume 1121 stored in the first-in first-out buffer 112 Whether it is greater than the maximum data volume threshold 301 or less than the minimum data volume threshold 401.

如第3圖所示,當控制單元114判斷先進先出緩衝器112所儲存的資料量1121大於最大資料量臨界值301時,表示目前音訊編解碼器130處理音訊 封包的速度慢於音訊封包產生的速度,所以先進先出緩衝器112儲存的資料越來越多,已經到達最大資料量臨界值301,一但先進先出緩衝器112儲存的資料持續增加而超過先進先出緩衝器112的儲存能力,就會造成緩衝器資料溢出,產生破音。 As shown in Figure 3, when the control unit 114 determines that the data volume 1121 stored in the first-in first-out buffer 112 is greater than the maximum data volume threshold 301, it means that the audio codec 130 is currently processing audio The packet speed is slower than the audio packet generation speed. Therefore, the data stored in the first-in first-out buffer 112 is increasing and has reached the maximum data volume threshold 301. Once the data stored in the first-in first-out buffer 112 continues to increase and exceed The storage capacity of the first-in-first-out buffer 112 will cause the buffer data to overflow, resulting in broken sound.

為了避免破音,控制單元114控制時脈產生器116提高時脈訊號1171之頻率,由於音訊編解碼器130係透過I2S介面302取得時脈訊號以作為時脈源,因此提高時脈訊號1171之頻率可提高音訊編解碼器130的處理速度,以處理更多的音訊封包。因此,先進先出緩衝器112的資料量1121將逐漸下降而低於最大資料量臨界值301。 In order to avoid breaking the sound, the control unit 114 controls the clock generator 116 to increase the frequency of the clock signal 1171. Since the audio codec 130 obtains the clock signal through the I 2 S interface 302 as the clock source, the clock signal is increased. The frequency of 1171 can increase the processing speed of the audio codec 130 to process more audio packets. Therefore, the data volume 1121 of the first-in first-out buffer 112 will gradually decrease and be lower than the maximum data volume threshold 301.

當控制單元114判斷先進先出緩衝器112所儲存的資料量1121小於最小資料量臨界值401時,表示目前音訊編解碼器130處理音訊封包的速度快於音訊封包產生的速度,所以先進先出緩衝器112儲存的資料越來越少,已經到達最小資料量臨界值401;一但先進先出緩衝器112儲存的資料持續減少而最後沒有音訊封包可供音訊編解碼器130處理,就會造成緩衝器資料欠載,產生破音。 When the control unit 114 determines that the data volume 1121 stored in the first-in-first-out buffer 112 is less than the minimum data volume threshold 401, it means that the current audio codec 130 is processing audio packets faster than the audio packet generation speed, so first-in-first-out The data stored in the buffer 112 is getting less and less, and has reached the minimum data volume threshold 401; once the data stored in the first-in-first-out buffer 112 continues to decrease and there is no audio packet for the audio codec 130 to process, it will cause The buffer data is under-loaded, resulting in broken sound.

為了避免破音,控制單元114控制時脈產生器116降低時脈訊號1171之頻率,藉此降低音訊編解碼器130的處理速度,以處理較少的音訊封包。因此,先進先出緩衝器112的資料量將逐漸增加而高於最小資料量臨界值401。 In order to avoid sound breaking, the control unit 114 controls the clock generator 116 to reduce the frequency of the clock signal 1171, thereby reducing the processing speed of the audio codec 130 to process fewer audio packets. Therefore, the data volume of the first-in first-out buffer 112 will gradually increase and be higher than the minimum data volume threshold 401.

如果先進先出緩衝器112所儲存的資料量1121在最大資料量臨界值301與最小資料量臨界值401之間,則時脈速度不做任何改變。透過上述控制方式,處理器100可持續調整音訊編解碼器130的處理速度,以避免播音問題發生。 If the data volume 1121 stored in the first-in first-out buffer 112 is between the maximum data volume threshold 301 and the minimum data volume threshold 401, the clock speed will not be changed. Through the above control method, the processor 100 can continuously adjust the processing speed of the audio codec 130 to avoid broadcasting problems.

再如第1圖所示,處理器100可使用計數器115來持續觸發控制單元114進行上述判斷。如果控制單元114每一毫秒就去確認先進先出緩衝器112的資料量,則先進先出緩衝器112的資料量的變化不夠明顯;因此,可設定計數器115以較長的時間(例如,一秒鐘)進行計數,使先進先出緩衝器112的資料量的變化足夠明顯以判斷是否需調整時脈訊號1171的頻率,藉此提高正確率。 As shown in FIG. 1 again, the processor 100 can use the counter 115 to continuously trigger the control unit 114 to make the above determination. If the control unit 114 confirms the data amount of the first-in first-out buffer 112 every millisecond, the change of the data amount of the first-in first-out buffer 112 is not obvious enough; therefore, the counter 115 can be set to take a longer time (for example, a Sec) to count to make the change of the data amount of the first-in-first-out buffer 112 obvious enough to determine whether the frequency of the clock signal 1171 needs to be adjusted, thereby improving the accuracy.

在一實施例中,計數器115計數到預設值時會輸出一觸發訊號(或是中斷訊號)120,例如一觸發訊號(tick)。當控制單元114接收到觸發訊號120後,讀取先進先出緩衝器112的資料量1121,並進行上述判斷。計數器115輸出觸發訊號120後便重置(reset)其計數值,重新開始計數。計數器115可根據時脈訊號1171進行計數。 In one embodiment, the counter 115 outputs a trigger signal (or interrupt signal) 120, such as a tick, when the counter 115 counts to a preset value. When the control unit 114 receives the trigger signal 120, it reads the data volume 1121 of the first-in first-out buffer 112, and performs the above-mentioned judgment. The counter 115 resets its count value after outputting the trigger signal 120 and restarts counting. The counter 115 can count according to the clock signal 1171.

在一實施例中,時脈產生器116可包含一振盪器以及一時脈訊號產生單元,振盪器產生一振盪訊號,時脈訊號產生單元再根據振盪訊號產生適合後續電路使用的時脈訊號。振盪器可用RC振盪器或是晶體振盪器來實現。為了調整或微調時脈訊號的頻率,控制單元114可改變施加至振盪器的電壓或電流,藉此改變振盪訊號的頻率,進而改變時脈訊號的頻率。但是上述僅為舉例,而非為限制本發明,任何可調整時脈訊號之頻率的技術皆可應用於本發明。 In one embodiment, the clock generator 116 may include an oscillator and a clock signal generating unit. The oscillator generates an oscillating signal, and the clock signal generating unit generates a clock signal suitable for subsequent circuits according to the oscillating signal. The oscillator can be implemented with an RC oscillator or a crystal oscillator. In order to adjust or fine-tune the frequency of the clock signal, the control unit 114 can change the voltage or current applied to the oscillator, thereby changing the frequency of the oscillating signal, thereby changing the frequency of the clock signal. However, the foregoing is only an example, and is not intended to limit the present invention. Any technology that can adjust the frequency of the clock signal can be applied to the present invention.

請參閱第5圖,其為本發明之音訊資料同步方法之流程圖。如第5圖所示,本發明之音訊資料同步方法包含下列步驟501至506。在步驟501,從一通用序列匯流排主機接收一音訊封包。在步驟502,將音訊封包儲存於一先進先出緩衝器。在步驟503,設定先進先出緩衝器之一最大資料量臨界值301和一最小資料量臨界值401。在步驟504,產生一時脈訊號,並透過一資料傳輸介面,從先進先出緩衝器輸出音訊封包以及輸出時脈訊號至一音訊編解碼器。 Please refer to Figure 5, which is a flowchart of the audio data synchronization method of the present invention. As shown in FIG. 5, the audio data synchronization method of the present invention includes the following steps 501 to 506. In step 501, an audio packet is received from a universal serial bus host. In step 502, the audio packets are stored in a first-in first-out buffer. In step 503, a maximum data volume threshold 301 and a minimum data volume threshold 401 of the first-in first-out buffer are set. In step 504, a clock signal is generated, and an audio packet is output from the first-in first-out buffer and the clock signal is output to an audio codec through a data transmission interface.

在步驟505,判斷先進先出緩衝器所儲存的資料量是否大於最大資料量臨界值301或是小於最小資料量臨界值401,當判斷先進先出緩衝器所儲存的資料量大於最大資料量臨界值301時,控制時脈產生器116提高時脈訊號之頻率,當判斷先進先出緩衝器所儲存的資料量小於最小資料量臨界值401時,控制時脈產生器116降低該時脈訊號之頻率。 In step 505, it is determined whether the amount of data stored in the first-in first-out buffer is greater than the maximum data amount threshold 301 or less than the minimum data amount threshold 401. When it is determined that the data amount stored in the first-in-first-out buffer is greater than the maximum data amount threshold When the value is 301, the clock generator 116 is controlled to increase the frequency of the clock signal. When it is determined that the amount of data stored in the first-in-first-out buffer is less than the minimum data amount threshold 401, the clock generator 116 is controlled to decrease the frequency of the clock signal. frequency.

在步驟506,使用音訊編解碼器根據時脈訊號處理音訊封包,以輸出音訊。藉此,本發明之音訊資料同步方法可將一時脈訊號透過資料傳輸介面提供給音訊編解碼器,並持續監測儲存音訊封包之先進先出緩衝器的資料儲存量的變化,當資料儲存量超過上限值,則降低時脈訊號之頻率,當資料儲存量低於下限值,則提高時脈訊號之頻率,據以調整時脈訊號的頻率,有效地使音訊編解碼器之處理音訊封包之速度與通用序列匯流排主機提供音訊封包之速度同步,以防止先進先出緩衝器溢出或欠載所造成的破音。 In step 506, the audio codec is used to process the audio packet according to the clock signal to output audio. Thereby, the audio data synchronization method of the present invention can provide a clock signal to the audio codec through the data transmission interface, and continuously monitor the change of the data storage capacity of the first-in-first-out buffer storing the audio packets, when the data storage capacity exceeds The upper limit will reduce the frequency of the clock signal. When the data storage is lower than the lower limit, the frequency of the clock signal will be increased, and the frequency of the clock signal will be adjusted accordingly to effectively enable the audio codec to process audio packets. The speed is synchronized with the speed of the audio packets provided by the universal serial bus host to prevent the sound breakage caused by the overflow or underload of the first-in-first-out buffer.

請參閱第6圖,其為本發明之音訊資料同步方法之實施例之流程圖。如第6圖所示,此實施例包含下列步驟601至607,並可應用於第1圖所示之音訊資料同步裝置。。 Please refer to FIG. 6, which is a flowchart of an embodiment of the audio data synchronization method of the present invention. As shown in Figure 6, this embodiment includes the following steps 601 to 607, and can be applied to the audio data synchronization device shown in Figure 1. .

在步驟601,在控制單元114,等待計數器115產生的中斷訊號。在步驟602,讀取先進先出緩衝器112所儲存之資料大小。在步驟603,判斷資料先進先出緩衝器112所儲存的資料量是否小於最小資料量臨界值401,如果是,就進入步驟604,降低時脈訊號1171之頻率,如果否,就進入下一步驟。在步驟505,判斷資料先進先出緩衝器112所儲存的資料量是否大於最大資料量臨界值301,如果是,就進入步驟606,提高時脈訊號1171之頻率,如果否,就進入下一步驟;在步驟607,不改變時脈訊號1171之頻率。 In step 601, the control unit 114 waits for an interrupt signal generated by the counter 115. In step 602, the data size stored in the first-in first-out buffer 112 is read. In step 603, it is judged whether the amount of data stored in the data first-in first-out buffer 112 is less than the minimum data amount threshold 401, if yes, go to step 604, reduce the frequency of the clock signal 1171, if not, go to the next step . In step 505, it is determined whether the amount of data stored in the data first-in first-out buffer 112 is greater than the maximum data amount threshold 301, if yes, go to step 606 to increase the frequency of the clock signal 1171, if not, go to the next step ; In step 607, the frequency of the clock signal 1171 is not changed.

綜上所述,本發明提出一種動態時脈調整的技術以同步音訊封包產生之速度以及音訊封包編解碼之速度,以每秒鐘探測一次先進先出緩衝器裡的資料量是否小於最小資料量臨界值或是大於最大資料量臨界值,調整經由I2S介面傳送至音訊編解碼器的時脈訊號之頻率,藉此及時地動態調整音訊編解碼器的編解碼速度。 In summary, the present invention proposes a dynamic clock adjustment technology to synchronize the speed of audio packet generation and the speed of audio packet encoding and decoding to detect whether the amount of data in the first-in-first-out buffer is less than the minimum amount of data every second If the threshold value is greater than the threshold value of the maximum data volume, the frequency of the clock signal sent to the audio codec via the I 2 S interface is adjusted to dynamically adjust the codec speed of the audio codec in time.

惟,以上所揭露之圖示及說明,僅為本發明之較佳實施例而已,非為用以限定本發明之實施,大凡熟悉該項技藝之人士其所依本發明之精神,所作之變化或修飾,皆應涵蓋在以下本案之申請專利範圍內。 However, the illustrations and descriptions disclosed above are only the preferred embodiments of the present invention, and are not intended to limit the implementation of the present invention. Anyone familiar with the art will make changes based on the spirit of the present invention. Or modification shall be included in the scope of the following patent application in this case.

100:處理器 100: processor

101:通用序列匯流排主機 101: Universal serial bus host

1011:音訊封包 1011: Audio packet

111:通用序列匯流排模組 111: Universal Serial Bus Module

112:先進先出緩衝器 112: FIFO buffer

1121:資料量 1121: data volume

113:資料傳輸介面 113: Data Transmission Interface

114:控制單元 114: control unit

115:計數器 115: counter

116:時脈產生器 116: Clock Generator

1171:時脈訊號 1171: Clock signal

120:觸發訊號 120: trigger signal

130:音訊編解碼器 130: Audio codec

Claims (8)

一種音訊資料同步裝置,包含:一通用序列匯流排主機,用以傳送一音訊封包;一處理器,包含:一通用序列匯流排(USB)模組,用以接收該音訊封包;一先進先出(FIFO)緩衝器,用以儲存該音訊封包;一時脈產生器,係產生一時脈訊號;一控制單元,係儲存一最大資料量臨界值和一最小資料量臨界值,並判斷該先進先出緩衝器所儲存的資料量是否大於該最大資料量臨界值或是小於該最小資料量臨界值,當該控制單元判斷該先進先出緩衝器所儲存的該資料量大於該最大資料量臨界值時,該控制單元控制該時脈產生器提高該時脈訊號之頻率,當該控制單元判斷該先進先出緩衝器所儲存的該資料量小於該最小資料量臨界值時,該控制單元控制該時脈產生器降低該時脈訊號之頻率;一計數器,當該計數器計數達到一預設值時,該計數器產生一觸發訊號給該控制單元,以觸發該控制單元判斷該先進先出緩衝器所儲存的該資料量之狀態,藉此使該控制單元重複地判斷該先進先出緩衝器所儲存的該資料量之狀態;以及一資料傳輸介面,係從該先進先出緩衝器輸出該音訊封包,以及輸出該時脈訊號;以及一音訊編解碼器,係透過該資料傳輸介面接收該音訊封包以及該時脈訊號,並根據該時脈訊號處理該音訊封包,以輸出音訊。 An audio data synchronization device, comprising: a universal serial bus host for transmitting an audio packet; a processor, comprising: a universal serial bus (USB) module for receiving the audio packet; a first-in first-out (FIFO) buffer to store the audio packet; a clock generator to generate a clock signal; a control unit to store a maximum data volume threshold and a minimum data volume threshold, and determine the first-in-first-out Whether the data volume stored in the buffer is greater than the maximum data volume threshold or less than the minimum data volume threshold, when the control unit determines that the data volume stored in the first-in-first-out buffer is greater than the maximum data volume threshold The control unit controls the clock generator to increase the frequency of the clock signal. When the control unit determines that the amount of data stored in the first-in-first-out buffer is less than the minimum data amount threshold, the control unit controls the time The pulse generator reduces the frequency of the clock signal; a counter, when the counter count reaches a preset value, the counter generates a trigger signal to the control unit to trigger the control unit to determine the storage of the first-in first-out buffer The state of the amount of data, thereby allowing the control unit to repeatedly determine the state of the amount of data stored in the first-in-first-out buffer; and a data transmission interface that outputs the audio packet from the first-in-first-out buffer, And output the clock signal; and an audio codec that receives the audio packet and the clock signal through the data transmission interface, and processes the audio packet according to the clock signal to output audio. 如請求項1所述之音訊資料同步裝置,其中該資料傳輸介面 係為一積體電路間音訊(Inter-IC Sound,I2S)介面,用以傳遞該音訊封包給該音訊編解碼器。 The audio data synchronization device according to claim 1, wherein the data transmission interface is an Inter-IC Sound (I 2 S) interface for transmitting the audio packet to the audio codec. 如請求項1所述之音訊資料同步裝置,其中該計數器係基於該時脈訊號進行計數。 The audio data synchronization device according to claim 1, wherein the counter counts based on the clock signal. 如請求項1所述之音訊資料同步裝置,其中該通用序列匯流排主機之操作時脈係獨立於該時脈訊號。 The audio data synchronization device according to claim 1, wherein the operating clock of the universal serial bus host is independent of the clock signal. 一種音訊資料同步方法,包含:從一通用序列匯流排主機接收一音訊封包;將該音訊封包儲存於一先進先出緩衝器;設定該先進先出緩衝器之一最大資料量臨界值和一最小資料量臨界值;產生一時脈訊號;透過一資料傳輸介面,從該先進先出緩衝器輸出該音訊封包以及輸出該時脈訊號至一音訊編解碼器;使用該音訊編解碼器根據該時脈訊號處理該音訊封包,以輸出音訊;使用一計數器進行計數,當該計數器計數達到一預設值時,該計數器產生一觸發訊號,以觸發判斷該先進先出緩衝器所儲存的該資料量之狀態,藉此重複地判斷該先進先出緩衝器所儲存的該資料量之狀態當判斷該先進先出緩衝器所儲存的該資料量大於該最大資料量臨界值時,提高該時脈訊號之頻率;以及當判斷該先進先出緩衝器所儲存的該資料量小於該最小資料量臨界值時,降低該時脈訊號之頻率。 An audio data synchronization method includes: receiving an audio packet from a universal serial bus host; storing the audio packet in a first-in-first-out buffer; setting a maximum data volume threshold and a minimum value of the first-in-first-out buffer Data volume threshold; generate a clock signal; through a data transmission interface, output the audio packet from the first-in-first-out buffer and output the clock signal to an audio codec; use the audio codec according to the clock Signal processing the audio packet to output audio; using a counter to count, when the counter reaches a preset value, the counter generates a trigger signal to trigger the judgment of the amount of data stored in the first-in-first-out buffer State, thereby repeatedly determining the state of the amount of data stored in the first-in-first-out buffer. When it is determined that the amount of data stored in the first-in-first-out buffer is greater than the maximum data amount threshold, the clock signal is increased Frequency; and when it is determined that the amount of data stored in the first-in-first-out buffer is less than the threshold value of the minimum amount of data, reduce the frequency of the clock signal. 如請求項5所述之音訊資料同步方法,其中該資料傳輸介面係為一I2S介面,用以傳遞該音訊封包給該音訊編解碼器。 The audio data synchronization method according to claim 5, wherein the data transmission interface is an I 2 S interface for transmitting the audio packet to the audio codec. 如請求項5所述之音訊資料同步方法,其中該計數器係基於該時脈訊號進行計數。 The audio data synchronization method according to claim 5, wherein the counter counts based on the clock signal. 如請求項5所述之音訊資料同步方法,其中該通用序列匯流排主機之操作時脈係獨立於該時脈訊號。 The audio data synchronization method according to claim 5, wherein the operating clock of the universal serial bus host is independent of the clock signal.
TW108133694A 2019-09-18 2019-09-18 Audio and data synchronization device and method thereof TWI722574B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
TW108133694A TWI722574B (en) 2019-09-18 2019-09-18 Audio and data synchronization device and method thereof
CN201911098617.0A CN112533046A (en) 2019-09-18 2019-11-12 Audio data synchronization device and method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW108133694A TWI722574B (en) 2019-09-18 2019-09-18 Audio and data synchronization device and method thereof

Publications (2)

Publication Number Publication Date
TWI722574B true TWI722574B (en) 2021-03-21
TW202113808A TW202113808A (en) 2021-04-01

Family

ID=74974636

Family Applications (1)

Application Number Title Priority Date Filing Date
TW108133694A TWI722574B (en) 2019-09-18 2019-09-18 Audio and data synchronization device and method thereof

Country Status (2)

Country Link
CN (1) CN112533046A (en)
TW (1) TWI722574B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008031299A1 (en) * 2006-09-07 2008-03-20 Xiamen Rico Technology Co., Ltd A memory power line network camera
CN101430640A (en) * 2007-11-05 2009-05-13 康佳集团股份有限公司 Communication terminal with USB audio card, and method for implementing USB audio card in communication terminal
CN101797432A (en) * 2010-03-16 2010-08-11 中山大学 Java SoC (System-on-Chip) hand-held game platform
TW201319927A (en) * 2011-11-02 2013-05-16 Quanta Comp Inc Audio processing system and adjusting method for an audio signal buffer
TW201337738A (en) * 2011-11-30 2013-09-16 Intel Corp Instruction and logic to provide vector horizontal majority voting functionality

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104125164B (en) * 2013-04-26 2017-11-24 联发科技股份有限公司 Active output buffer controller and its method
TW201704923A (en) * 2015-07-31 2017-02-01 盛微先進科技股份有限公司 Apparatus and method of USB audio frequency locking
TW201705010A (en) * 2015-07-31 2017-02-01 盛微先進科技股份有限公司 Apparatus and method of USB audio transmission adjustment
TW201807591A (en) * 2016-08-29 2018-03-01 松翰科技股份有限公司 Device and method for adjusting USB clock frequency

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008031299A1 (en) * 2006-09-07 2008-03-20 Xiamen Rico Technology Co., Ltd A memory power line network camera
CN101430640A (en) * 2007-11-05 2009-05-13 康佳集团股份有限公司 Communication terminal with USB audio card, and method for implementing USB audio card in communication terminal
CN101797432A (en) * 2010-03-16 2010-08-11 中山大学 Java SoC (System-on-Chip) hand-held game platform
TW201319927A (en) * 2011-11-02 2013-05-16 Quanta Comp Inc Audio processing system and adjusting method for an audio signal buffer
TW201337738A (en) * 2011-11-30 2013-09-16 Intel Corp Instruction and logic to provide vector horizontal majority voting functionality

Also Published As

Publication number Publication date
TW202113808A (en) 2021-04-01
CN112533046A (en) 2021-03-19

Similar Documents

Publication Publication Date Title
US10147440B2 (en) Method for playing data and apparatus and system thereof
CN110622099B (en) Recovery of reference clock on device
TW201841530A (en) System and method of sending data via additional secondary data lines on a bus
US20130108083A1 (en) Audio processing system and adjusting method for audio signal buffer
TWI722574B (en) Audio and data synchronization device and method thereof
US20070083685A1 (en) Data management for a USB device
CN112637102B (en) Audio interface circuit, control method thereof and audio equipment
CN110958540B (en) USB audio conversion method and device
TWI734326B (en) Audio synchronization processing circuit and method thereof
TWI789240B (en) Audio processing apparatus and audio processing method for dynamically adjusting audio clock
JP4507672B2 (en) Audio playback apparatus and clock frequency control method
CN112527237B (en) Audio interface circuit, control method thereof and audio equipment
CN113455011B (en) System and method for data management in media devices
US10651860B2 (en) Asynchronous positional feedback for asynchronous and isochronous communication
US20240013818A1 (en) Semiconductor device
JP4328223B2 (en) Data transmitting apparatus and data receiving apparatus
TW201329670A (en) Clock rate controller and method thereof and electrical device thereof
JP2023114636A (en) Electronic device and control method
JP4491345B2 (en) Phase lock of phase lock loop
TW202143056A (en) Memory system and memory access interface device thereof
TW202011744A (en) Circuit within display apparatus and control method of decoding circuit
TW202328935A (en) Circuitry
JP2002342092A (en) Data processor and data processing control method
JP2003304224A (en) Data transmitter
TW201317738A (en) Clock frequency adjusting circuit and clock frequency adjusting method thereof