A USB sound card packet loss detection method

By building a test loop and real-time detection of the number of audio data samples, the accuracy of USB sound card data loss detection is solved, and efficient and automatic data packet loss detection is achieved. It is suitable for areas such as voice recognition that require high audio data integrity.

CN114168398BActive Publication Date: 2025-04-22HANGZHOU NATCHIP SCI & TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111497447.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-09
Publication Date
2025-04-22
Estimated Expiration
2041-12-09

AI Technical Summary

Technical Problem

The prior art is difficult to accurately detect whether there is data loss during the transmission of audio data by USB sound cards, especially in the field of voice recognition, the completeness of audio data is very high.

Method used

By building a test loop, using the reference sound card and the output storage device, the test audio data with amplitude difference is sent, and the number of samples of received audio data is detected in real time. By comparing the actual number of samples and the theoretical number of samples, it is determined whether there is packet loss in the USB sound card.

Benefits of technology

It realizes accurate detection of USB sound card data packet loss, can detect loss of single sample points, improve detection accuracy and efficiency, reduce manpower investment, and support long-term stable testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114168398B_ABST
    Figure CN114168398B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for detecting packet loss of a USB sound card. It is difficult to detect a small amount of data loss in existing methods. The method of the present invention is that a test host sends a digital signal of audio data to a reference sound card through a USB interface; the reference sound card transmits the digital signal back to the test host through a USB interface; the reference sound card converts the digital signal into an analog signal and outputs it to the tested USB sound card; the tested USB sound card converts the analog signal of the received audio data into a digital signal and sends it to the test host through the USB interface. First, the volume of the test audio data is adjusted, and then the test host cyclically sends the test audio data with a specific mark to the reference sound card, and determines whether the USB sound card has lost data by counting the number of audio sample points between the audio mark points and the number of sample points of the original audio mark points. The method of the present invention can accurately check whether data is lost on the entire audio path of the USB sound card, thereby improving the overall test efficiency and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of artificial intelligence, and in particular relates to a USB sound card packet loss detection method. Background Art

[0002] USB sound cards are portable and compact, and the signal path is through the USB interface, which keeps USB sound cards away from complex electromagnetic interference environments and has better sound quality. It is also because of its universal USB interface that it has been expanded to more and more fields. Now it can also be connected to mobile devices such as mobile phones and tablets, and the device has also been introduced into artificial intelligence voice recognition products. Due to the popularization of USB sound cards, some have entered the high-end field, and the stability requirements for USB sound card data are getting higher and higher, especially in the field of voice recognition, the requirements for the integrity of audio data are very high. If the USB sound card loses data during the transmission of audio data, it will cause huge errors in the subsequent voice recognition results. Therefore, a method for USB data integrity and packet loss detection is required.

[0003] The audio acquisition process of a USB sound card is usually that the microphone converts the sound signal into an analog electrical signal, which is then converted into a digital signal through an ADC (Analog-to-Digital Converter, which is a device that converts continuously changing analog signals into discrete digital signals). Finally, the digital signal is converted into USB data through a DSP (Digital Signal Process, which can quickly and real-timely implement various digital signal processing algorithms) and USB and transmitted to the host connected to the USB sound card device. Traditional USB sound card data packet loss test methods include:

[0004] Method 1: Play an audio clip directly through the USB sound card, listen to the result, and judge whether the data is lost by feeling. This method not only requires a lot of manpower, but also has inaccurate results. It is difficult to detect a small amount of data loss, and it is not realistic to use human ears to listen to the long-term stability test.

[0005] Method 2: Play a piece of audio, use a USB sound card to collect and record it, then open it through software to check whether the spectrum is abnormal. This method also requires manpower investment, and it is difficult to detect if a small amount or one cycle of data is lost.

[0006] The invention patent with the patent number of 201811625624.7 discloses a method for detecting sound card communication data. The method writes test data to the host according to a predetermined protocol on the sound card side; on the host side, the test data written by the sound card side is obtained, and the obtained test data is parsed according to the predetermined protocol, and the accuracy of the sound card communication data is judged according to the parsing result. This method can detect subtle data loss problems, but this method can only detect whether the data in the UAC protocol segment is lost, and cannot detect whether the complete sound card product has data loss. Summary of the invention

[0007] The purpose of the present invention is to provide a USB sound card packet loss detection method in view of the deficiencies in the prior art.

[0008] The method of the present invention is specifically as follows:

[0009] Step (1) Build a test circuit:

[0010] The test loop includes a tested USB sound card, an audio data input module, and a test host; the audio data input module includes a reference sound card and an output storage device; the test host is a computer with audio data input, output, and analysis functions;

[0011] The audio data output terminal of the reference sound card in the audio data input module is connected to the microphone input interface of the USB sound card under test, and the audio data input module directly inputs the simulated audio data to the analog-to-digital converter of the USB sound card under test;

[0012] The reference sound card is connected to the test host, and the digital signal of the audio data stored in the test host is sent to the reference sound card through the USB interface;

[0013] The reference sound card is connected to the output storage device, and the reference sound card outputs the digital signal of the audio data to the output storage device and stores it in the output storage device; at the same time, the reference sound card converts the digital signal of the audio data into an analog signal and outputs it to the USB sound card under test;

[0014] The output storage device is connected to the test host and transmits the digital signal of the stored audio data back to the test host via the USB interface;

[0015] The USB sound card under test is connected to the test host, and the analog-to-digital converter ADC of the USB sound card under test converts the analog signal of the received audio data into a digital signal, and sends it to the test host through the USB interface;

[0016] Step (2) the test host sends the test audio data to the reference sound card, and the test host simultaneously receives and saves the test audio data returned by the output storage device and the test audio data sent by the tested USB sound card;

[0017] The test audio data is composed of two segments of audio data with different amplitudes; the audio data with high amplitude has only one peak, which is used as a marking point; the audio data with low amplitude has multiple cycles; the number of samples of the complete test audio data is used as the theoretical number of samples;

[0018] Compare the amplitudes of the test audio data returned by the output storage device and the test audio data sent by the tested USB sound card to see if they are consistent with the amplitude of the test audio data sent by the test host. If not, adjust the volume of the test audio data output by the test host until the three are consistent.

[0019] Step (3) the test host maintains the volume and cyclically sends the test audio data to the reference sound card;

[0020] The reference sound card sends the loop test audio data in the form of an analog signal to the USB sound card under test, the analog-to-digital converter ADC of the USB sound card under test converts the analog signal into a digital signal, the USB sound card under test sends the processed digital audio signal to the test host through the USB interface, and the test host saves the digital audio signal;

[0021] The reference sound card sends the loop test audio data in the form of a digital signal to the output storage device, the output storage device transmits the received digital audio signal back to the test host, and the test host stores the digital audio signal;

[0022] Step (4) The test host performs cyclic detection while cyclically sending the test audio data, that is, the test host performs sample point quantity detection on the two received digital audio signals. The specific method is:

[0023] Detect the marking points of the two received test audio data respectively, and count the actual number of sample points between the two adjacent marking points; compare the actual number of sample points with the theoretical number of sample points, and determine whether the tested USB sound card has packet loss through the comparison result;

[0024] First, the actual number of samples of the digital audio signal sent by the output storage device is compared with the theoretical number of samples. If they are consistent, it means that the reference sound card is outputting normally. The actual number of samples of the digital audio signal sent by the tested USB sound card is compared with the theoretical number of samples. Otherwise, it means that there is packet loss in the reference sound card itself. No packet loss detection is performed on the tested USB sound card. The reference sound card is replaced and re-detected. Then, the actual number of samples of the digital audio signal sent by the tested USB sound card is compared with the theoretical number of samples. If they are consistent, there is no packet loss in the tested USB sound card. Otherwise, it means that there is packet loss. The test host records the number and time of lost samples.

[0025] Compared with the prior art, the present invention has the following technical effects:

[0026] The method of the present invention can accurately detect even the loss of one sample point, and such accuracy is far beyond the reach of traditional detection methods, human eyes observing the spectrum diagram and human ears listening.

[0027] The method of the present invention detects the audio data stream in real time in a sliding window manner, can perform stable testing for a long time, and record problems in actual measurement, providing great convenience for problem review and inspection.

[0028] The data test and the storage of the test records of the present invention do not require human participation, which greatly improves the work efficiency and reduces the investment in personnel and economy compared with the traditional method.

[0029] The test audio of the method of the present invention is directly connected to the ADC of the USB sound card device under test, which means that the test environment does not require a closed silent environment, and multiple test environments can be built in batches in the same space environment, reducing the investment in silent laboratories and reducing environmental impacts. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 It is a schematic diagram of a test circuit used in the method of the present invention. DETAILED DESCRIPTION

[0031] The technical solution of the present invention is further described below in conjunction with embodiments.

[0032] USB sound cards usually have three interfaces, a microphone input interface, a speaker output interface, and a USB data interface. When connected to an application device, it can be used as an external device of the application device to provide an audio control interface for the application device. The application device can be a computer or a mobile device that can realize USB communication function. The SB sound card packet loss detection method, the detection process is as follows:

[0033] Step (1) Build a test circuit. Figure 1 As shown, the test circuit is composed of the tested USB sound card 1, the audio data input module 2 and the test host 3; the audio data input module 2 includes a reference sound card 21 and an output storage device 22, and the reference sound card 21 adopts a high-precision sound card, that is, a sound card with stable output. The test host 3 is a computer with audio data input, output and analysis functions, and the connection method is as follows:

[0034] The audio data output end of the reference sound card 21 in the audio data input module is connected to the microphone input interface of the USB sound card 1 under test. For the USB sound card under test with its own microphone, first disconnect the microphone from the USB sound card under test and replace the microphone with the reference sound card; the audio data input module directly inputs the simulated audio data into the analog-to-digital converter ADC of the USB sound card under test.

[0035] The reference sound card 21 is connected to the test host 3 , and the digital signal of the audio data stored in the test host 3 is sent to the reference sound card 21 through the USB interface.

[0036] The reference sound card 21 is connected to the output storage device 22, and the reference sound card 21 outputs the digital signal of the audio data to the output storage device 22 and stores it in the output storage device; at the same time, the reference sound card 21 converts the digital signal of the audio data into an analog signal and outputs it to the USB sound card under test.

[0037] The output storage device 22 is connected to the test host 3 and transmits the stored digital signal of the audio data back to the test host 3 via the USB interface.

[0038] The tested USB sound card 1 is connected to the testing host 3, and the analog-to-digital converter ADC of the tested USB sound card converts the analog signal of the received audio data into a digital signal, and sends it to the testing host through the USB interface.

[0039] Step (2) The test host sends the test audio data to the reference sound card. The test host simultaneously receives and saves the test audio data sent back by the output storage device and the test audio data sent by the tested USB sound card.

[0040] The test audio data sent by the test host is composed of two audio data segments with different amplitudes, and the amplitude difference is more than twice. The audio data with high amplitude has only one peak, which is used as a marking point; the audio data with low amplitude has multiple complete cycles; the number of samples of the complete audio data sent is determined as the theoretical number of samples.

[0041] Compare the amplitudes of the test audio data returned by the output storage device and the test audio data sent by the USB sound card under test to see if they are consistent with the amplitude of the test audio data sent by the test host. If not, adjust the volume of the test audio data output by the test host until they are consistent.

[0042] Step (3) The test host maintains the volume and sends the test audio data to the reference sound card in a loop. The reference sound card sends the loop test audio data in the form of an analog signal to the USB sound card under test, and the analog-to-digital converter ADC of the USB sound card under test converts the analog signal into a digital signal. The USB sound card under test sends the processed digital audio signal to the test host through the USB interface, and the test host saves the digital audio signal; the reference sound card sends the loop test audio data in the form of a digital signal to the output storage device, and the output storage device transmits the received digital audio signal back to the test host, and the test host saves the digital audio signal.

[0043] Step (4) The test host performs cyclic detection while cyclically sending the test audio data, that is, the test host performs sample point quantity detection on the two received digital audio signals. The specific method is:

[0044] The currently received test audio data is detected by sliding window method, and the marking points of the two received test audio data are respectively detected, and the actual number of sample points between the two adjacent marking points is counted; the actual number of sample points is compared with the theoretical number of sample points, and whether the tested USB sound card loses packets is determined by the comparison result;

[0045] Comparison strategy: First, compare the actual number of samples of the digital audio signal sent by the output storage device with the theoretical number of samples. If they are consistent, it means that the reference sound card is outputting normally. Then compare the actual number of samples of the digital audio signal sent by the tested USB sound card with the theoretical number of samples. If they are inconsistent, it means that there is packet loss in the reference sound card itself, and no packet loss detection is performed on the tested USB sound card. Replace the reference sound card and retest. Then compare the actual number of samples of the digital audio signal sent by the tested USB sound card with the theoretical number of samples. If they are consistent, there is no packet loss in the tested USB sound card, otherwise it means that there is packet loss, and the test host records the number and time of lost samples.

[0046] The sliding window continues to move forward until the test time is reached and the test is completed. The sliding window is a detection function. The input is a fixed audio data of input data volume. The input data volume is the size of the window. The size of the sliding window is larger than the theoretical number of samples. Two adjacent marking points are detected through the sliding window, and the number of samples between the two marking points is counted.

[0047] The detection function has a return value, that is, it returns the data between the last mark point and the end sample point of the audio data corresponding to the last mark point, to ensure that this section of data can be detected by the next window and no data is missed without being detected.

Claims

1. A USB sound card packet loss detection method, characterized in that: The method is as follows: Step (1) Build a test circuit: The test loop includes a USB sound card to be tested, an audio data input module, and a test host; the audio data input module includes a reference sound card and an output storage device; the test host is a computer with audio data input, output, and analysis functions; The audio data output terminal of the reference sound card in the audio data input module is connected to the microphone input interface of the USB sound card under test, and the audio data input module directly inputs the simulated audio data to the analog-to-digital converter of the USB sound card under test; The reference sound card is connected to the test host, and the digital signal of the audio data stored in the test host is sent to the reference sound card through the USB interface; The reference sound card is connected to the output storage device, and the reference sound card outputs the digital signal of the audio data to the output storage device and stores it in the output storage device; At the same time, the reference sound card converts the digital signal of the audio data into an analog signal and outputs it to the USB sound card under test; The output storage device is connected to the test host and transmits the digital signal of the stored audio data back to the test host via the USB interface; The USB sound card under test is connected to the test host, and the analog-to-digital converter ADC of the USB sound card under test converts the analog signal of the received audio data into a digital signal, and sends it to the test host through the USB interface; Step (2) the test host sends the test audio data to the reference sound card, and the test host simultaneously receives and saves the test audio data returned by the output storage device and the test audio data sent by the tested USB sound card; The test audio data is composed of two segments of audio data with different amplitudes; the audio data with high amplitude has only one peak, which is used as a marking point; the audio data with low amplitude has multiple cycles; the number of samples of the complete test audio data is used as the theoretical number of samples; Compare the amplitudes of the test audio data returned by the output storage device and the test audio data sent by the tested USB sound card to see if they are consistent with the amplitude of the test audio data sent by the test host. If not, adjust the volume of the test audio data output by the test host until the three are consistent. Step (3) the test host maintains the volume and cyclically sends the test audio data to the reference sound card; The reference sound card sends the loop test audio data in the form of an analog signal to the USB sound card under test, the analog-to-digital converter ADC of the USB sound card under test converts the analog signal into a digital signal, the USB sound card under test sends the processed digital audio signal to the test host through the USB interface, and the test host saves the digital audio signal; The reference sound card sends the loop test audio data in the form of a digital signal to the output storage device, the output storage device transmits the received digital audio signal back to the test host, and the test host stores the digital audio signal; Step (4) The test host performs cyclic detection while cyclically sending the test audio data, that is, the test host performs sample point quantity detection on the two received digital audio signals. The specific method is: Detect the marking points of the two received test audio data respectively, and count the actual number of sample points between the two adjacent marking points; compare the actual number of sample points with the theoretical number of sample points, and determine whether the tested USB sound card has packet loss through the comparison result; First, the actual number of samples of the digital audio signal sent by the output storage device is compared with the theoretical number of samples. If they are consistent, it means that the reference sound card is outputting normally. The actual number of samples of the digital audio signal sent by the tested USB sound card is compared with the theoretical number of samples. Otherwise, it means that there is packet loss in the reference sound card itself. No packet loss detection is performed on the tested USB sound card. The reference sound card is replaced and re-detected. Then, the actual number of samples of the digital audio signal sent by the tested USB sound card is compared with the theoretical number of samples. If they are consistent, there is no packet loss in the tested USB sound card. Otherwise, it means that there is packet loss. The test host records the number and time of lost samples.

2. A USB sound card packet loss detection method as claimed in claim 1, characterized in that: When building a test loop, for a USB sound card with a built-in microphone, first disconnect the microphone from the USB sound card and replace the microphone with a reference sound card.

3. A USB sound card packet loss detection method as claimed in claim 1, characterized in that: The amplitude of the high-amplitude audio data constituting the test audio data is more than twice the amplitude of the low-amplitude audio data.

4. A USB sound card packet loss detection method as claimed in claim 1, characterized in that: Step (4) detects the marking points of the two received test audio data respectively through a sliding window method for the currently received test audio data.

5. A USB sound card packet loss detection method as claimed in claim 4, characterized in that: The sliding window is a detection function, and its input is a segment of audio data with a fixed input data volume. The input data volume is the size of the window. The size of the sliding window is larger than the theoretical number of sample points. Two adjacent marking points are detected through the sliding window, and the number of sample points between the two marking points is counted.

Citation Information

Patent Citations

  • Methods, systems, and devices for detecting sound card communication data

    CN109474394B

  • Device and method for testing audio sound-recording

    CN101202087A

  • Detection method and system of sound card communication data and device for detecting received sound card communication data

    CN109474394A