CN108702568A - A kind of method and apparatus of testing audio circuit time delay - Google Patents

A kind of method and apparatus of testing audio circuit time delay Download PDF

Info

Publication number
CN108702568A
CN108702568A CN201780009092.1A CN201780009092A CN108702568A CN 108702568 A CN108702568 A CN 108702568A CN 201780009092 A CN201780009092 A CN 201780009092A CN 108702568 A CN108702568 A CN 108702568A
Authority
CN
China
Prior art keywords
amplitude
sine wave
thread
terminal
time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201780009092.1A
Other languages
Chinese (zh)
Other versions
CN108702568B (en
Inventor
曹海恒
谭利文
孙伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Publication of CN108702568A publication Critical patent/CN108702568A/en
Application granted granted Critical
Publication of CN108702568B publication Critical patent/CN108702568B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R3/00Circuits for transducers, loudspeakers or microphones

Abstract

A kind of method and apparatus of testing audio circuit time delay, this method include:Terminal opens preset broadcasting thread, and the broadcasting thread is used to read preset audio file from the buffering area of the terminal, and plays the preset audio file through the loud speaker of the terminal;The terminal opens preset recording thread, and the recording thread is for recording to the preset audio file that the loud speaker plays by the microphone of the terminal;The terminal plays the first time information of the preset audio file according to the broadcasting thread and the recording thread records the second temporal information of the preset audio file, determine the audio loop time delay of the terminal, the audio loop time delay refers to microphone input of the sound from the terminal, until what is exported from the loud speaker of the terminal takes.Using the present processes and equipment, can testing audio circuit time delay.

Description

A kind of method and apparatus of testing audio circuit time delay
This application claims Patent Office of the People's Republic of China is submitted, application No. is the 201611264801.4, priority of the Chinese patent application of entitled " a kind of test method and equipment of mobile device audio loop time delay " on December 30th, 2016, entire contents are hereby incorporated by reference in the application.
Technical field
This application involves the method and apparatus of the field of test technology more particularly to a kind of testing audio circuit time delay.
Background technique
At present, the either intelligent terminal of Android or IOS operating system, its audio processing process, mainly it is made of recording thread and broadcasting thread two parts, as shown in Figure 1, it records the process of thread are as follows: first by sound from microphone input, then through analog-digital converter (Analog to Digital Converter, ADC audio data) is converted to, audio data is transmitted to system audio service unit through bus (Bus) and software and hardware driving again, audio data is most transmitted to through the first audio transmission unit the buffer area of user application afterwards.Play the process of thread are as follows: the second audio transmission unit reads audio data out of user application buffer area, and the audio data of reading is transmitted to system audio service unit, system audio service unit will drive through software and hardware audio data is transmitted to digital analog converter (Digital to Analog Converter with Bus again, DAC), audio data is converted to analogue data by DAC, plays the analogue data through loudspeaker.
Wherein, audio loop time delay refers to microphone input of the sound from intelligent terminal, until the time-consuming of loudspeaker output.And with the development of intelligent terminal, more and more intelligent terminals support the scenes such as real-time audio scene, such as k song, DJ and game;Due under real-time audio scene, it is desirable that intelligent terminal has lower audio loop time delay, therefore the problem of how to test the audio loop time delay of intelligent terminal, be current urgent need to resolve.
In the prior art, there are two types of common time delay measuring methods, respectively software log and hard ware measure;Wherein, software log is to beat timestamp in the initial position of key operation and end position, and it is time-consuming to build operation by reduced time stamp acquisition pass;And hardware testing is generally used for the time delay between test local terminal and distance terminal.It is by voice input intelligent terminal by the start position that above-mentioned analysis can be seen that the audio loop time delay of intelligent terminal, final position is that sound is exported intelligent terminal.Because entire acoustic processing process, is related to bottom software and hardware, can not on software logging timestamp, therefore can not be used to test the audio loop time delay inside intelligent terminal;And for hardware testing, it is substantially the audio time delay for testing two equipment under certain space distribution, therefore is also unable to test the audio loop time delay inside intelligent terminal.
Summary of the invention
The application provides a kind of method and apparatus of testing audio circuit time delay, to test the audio loop time delay of terminal inner.
First aspect, the application provides a kind of method of testing audio circuit time delay, it include: that terminal opens preset broadcasting thread, the broadcasting thread is used to read preset audio file from the buffer area of the terminal, and plays the preset audio file through the loudspeaker of the terminal;The terminal opens preset recording thread, and the recording thread is for recording to the preset audio file that the loudspeaker plays by the microphone of the terminal;The terminal plays the first time information of the preset audio file according to the broadcasting thread and the recording thread records the second temporal information of the preset audio file, determine the audio loop time delay of the terminal, the audio loop time delay refers to microphone input of the sound from the terminal To the time-consuming exported from the loudspeaker of the terminal.
As can be seen that by the way of the preset audio file of the application, it may be determined that the time delay of terminal inner audio loop.
With reference to first aspect, in the first possible implementation, the terminal plays the first time information of the preset audio file according to the broadcasting thread and the recording thread records the second temporal information of the preset audio file, determine the audio loop time delay of the terminal, comprising: the terminal determines that the broadcasting thread plays the first time information of target data in the preset audio file;The terminal determines that the recording thread records the second temporal information of target data in the preset audio file;The terminal determines the audio loop time delay of the terminal according to the difference of second temporal information and the first time information.
As can be seen that in this application, specifically using the target data of preset audio file as benchmark, calculating audio loop time delay, may make and calculate the more efficient of audio loop time delay.
In conjunction with the first possible implementation, in second of possible implementation, the preset audio file is sinusoidal wave pulse coded modulation PCM file, and the sine wave PCM file is obtained by the sine wave progress PCM processing of sine wave and the second amplitude to the first amplitude;The target data of the preset audio file is sampled value corresponding to first wave crest in the second amplitude sine wave.
In this application, using PCM file corresponding to the sine wave of the first amplitude and the sine wave of the second amplitude as target data, calculating recording thread can be facilitated to record the first time information of the target data and play thread and play the second temporal information of the target data, to improve the efficiency for calculating audio loop time delay.
In conjunction with second of possible implementation, in the third possible implementation, corresponding sampled value differs the first duration, and the play time of sampled value corresponding to sine wave of the play time of sampled value corresponding to the sine wave of first amplitude earlier than second amplitude to the sine wave of the sine wave of first amplitude and the second amplitude in play time respectively;
The terminal determines that the broadcasting thread plays the first time information of target data in the preset audio file, comprising: the terminal records the temporal information that the broadcasting thread starting plays the preset audio file;The terminal plays the first duration that sampled value corresponding to temporal information, the sine wave of first amplitude and the sine wave of the second amplitude of the preset audio file differs in play time according to the broadcasting thread starting, determines that the terminal starting plays the temporal information of sampled value corresponding to the sine wave of second amplitude;The terminal plays the temporal information of sampled value and the period of the second amplitude sine wave corresponding to the sine wave of second amplitude according to terminal starting, determines that the broadcasting thread plays the first time information of sampled value corresponding to first wave crest in the second amplitude sine wave.
In conjunction with second of possible implementation or the third possible implementation, in the 4th kind of possible implementation, the preset audio file includes multiframe audio data, and every frame audio data includes multiple PCM samples, and each PCM sample corresponds to a PCM sampled value;
The terminal determines that the recording thread records the second temporal information of target data in the preset audio file, comprising: the terminal determines the audio data frame that the PCM sample of first wave crest in the sine wave of second amplitude is belonged to;The terminal is from audio data frame and reaches in the corresponding relationship for recording thread time, the audio data frame corresponding time for reaching the recording thread that the PCM sample of first wave crest is belonged to is searched, the corresponding relationship of the audio data frame and arrival recording thread time is to record determined by the time of thread according to frame audio data every in the preset audio file and arrival;Terminal sample number of PCM sample according to corresponding to first wave crest of the sine wave of second amplitude, the length of audio data frame and the frequency that PCM sampling is carried out to the sine wave of second amplitude determine that the PCM sample of first wave crest in the sine wave of second amplitude reaches the shift time for recording thread time relative to the audio data frame belonged to;The terminal reaches the time for recording thread and the shift time according to belonged to audio data frame, determines that the recording thread records the second temporal information of sampled value corresponding to first wave crest in the sine wave of second amplitude.
In conjunction with the 4th kind of possible implementation, in the 5th kind of possible implementation, the terminal determines the audio data frame that the PCM sample of first wave crest in the sine wave of second amplitude is belonged to, it include: the left gradient and right gradient that the terminal calculates each PCM sample in the preset audio file, the left gradient refers to that the difference of the sampled value of a PCM sample and the sampled value of adjacent left PCM sample, the right gradient refer to the difference of the sampled value of a PCM sample and the sampled value of adjacent right PCM sample;The terminal from the PCM sample of the preset audio file, search left gradient and right gradient be all larger than zero PCM sample, establish wave crest PCM sample set;The terminal is from the wave crest PCM sample set, search the PCM sample of first wave crest in the sine wave of the second amplitude, wherein, sampled value corresponding to the PCM sample of first wave crest is greater than the sampled value of adjacent left wave crest PCM sample in the sine wave of second amplitude, equal to the sampled value of adjacent right wave crest PCM sample;The terminal determines the audio data frame that the PCM sample of first wave crest in the sine wave of second amplitude is belonged to according to the sample number of the PCM sample of first wave crest in the sine wave of second amplitude and the length of preset audio data frame.
In conjunction with the 4th kind of possible implementation or the 5th kind of possible implementation, in the 6th kind of possible implementation, the terminal determines that the PCM sample of first wave crest in the sine wave of second amplitude reaches the shift time of recording thread time relative to the audio data frame belonged to, meets following formula requirements: T=ij%FrameL*1/Samplerate;
Wherein, the PCM sample that the T represents first wave crest in the sine wave of second amplitude reaches the shift time of recording thread time relative to the audio data frame belonged to;The ijRepresent the sample number of the PCM sample of first wave crest in the sine wave of second amplitude;The FrameL represents the length of audio data frame, and the % represents complementation, and the Samplerate represents the frequency that the terminal carries out PCM sampling to the sine wave of second amplitude.
Second aspect, provides a kind of equipment of testing audio circuit time delay, and the equipment includes processor and memory;The processor, for reading the code in the memory, for executing: opening preset broadcasting thread, the broadcasting thread is used to read preset audio file from the buffer area of the equipment, and plays the preset audio file through the loudspeaker of the equipment;Preset recording thread is opened, the recording thread is for recording to the preset audio file that the loudspeaker plays by the microphone of the equipment;The first time information of the preset audio file is played according to the broadcasting thread and the recording thread records the second temporal information of the preset audio file, determine the audio loop time delay of the equipment, the audio loop time delay refers to microphone input of the sound from the equipment, until the time-consuming exported from the loudspeaker of the equipment.
In conjunction with second aspect, in the first possible implementation, the processor records the second temporal information of the preset audio file in the first time information and the recording thread for playing the preset audio file according to the broadcasting thread, delay when determining the audio loop of the equipment, is specifically used for: determining that the broadcasting thread plays the first time information of target data in the preset audio file;Determine that the recording thread records the second temporal information of target data in the preset audio file;According to the difference of second temporal information and the first time information, the audio loop time delay of the equipment is determined.
In conjunction with the first possible implementation, in second of possible implementation, the preset audio file is sinusoidal wave pulse coded modulation PCM file, and the sine wave PCM file is obtained by the sine wave progress PCM processing of sine wave and the second amplitude to the first amplitude;The target data of the preset audio file is sampled value corresponding to first wave crest in the second amplitude sine wave.
In conjunction with second of possible implementation, in the third possible implementation, corresponding sampled value differs the first duration, and the play time of sampled value corresponding to sine wave of the play time of sampled value corresponding to the sine wave of first amplitude earlier than second amplitude to the sine wave of the sine wave of first amplitude and the second amplitude in play time respectively;
The processor is specifically used for when determining that the broadcasting thread plays the first time information of target data in the preset audio file: recording the temporal information that the broadcasting thread starting plays the preset audio file;Temporal information, the sine wave of first amplitude and the sine wave of the second amplitude of the preset audio file are played according to the broadcasting thread starting The first duration that corresponding sampled value differs in play time determines that the equipment starting plays the temporal information of sampled value corresponding to the sine wave of second amplitude;The temporal information of sampled value and the period of the second amplitude sine wave corresponding to the sine wave of second amplitude are played according to equipment starting, determines that the broadcasting thread plays the first time information of sampled value corresponding to first wave crest in the second amplitude sine wave.
In conjunction with second or the third possible implementation, in the 4th kind of possible implementation, the preset audio file includes multiframe audio data, and every frame audio data includes multiple PCM samples, and each PCM sample corresponds to a PCM sampled value;
The processor is specifically used for when determining that the recording thread records the second temporal information of target data in the preset audio file: determining the audio data frame that the PCM sample of first wave crest in the sine wave of second amplitude is belonged to;From audio data frame and reach in the corresponding relationship for recording thread time, the audio data frame corresponding time for reaching the recording thread that the PCM sample of first wave crest is belonged to is searched, the corresponding relationship of the audio data frame and arrival recording thread time is to record determined by the time of thread according to frame audio data every in the preset audio file and arrival;According to the sample number of PCM sample corresponding to first wave crest of the sine wave of second amplitude, the length of audio data frame and the frequency for carrying out PCM sampling to the sine wave of second amplitude, determine that the PCM sample of first wave crest in the sine wave of second amplitude reaches the shift time for recording thread time relative to the audio data frame belonged to;The time for recording thread and the shift time are reached according to belonged to audio data frame, determines that the recording thread records the second temporal information of sampled value corresponding to first wave crest in the sine wave of second amplitude.
In conjunction with the 4th kind of possible implementation, in the 5th kind of possible implementation, when the processor audio data frame that the PCM sample of first wave crest is belonged in the sine wave for determining second amplitude, it is specifically used for: calculates the left gradient and right gradient of each PCM sample in the preset audio file, the left gradient refers to that the difference of the sampled value of a PCM sample and the sampled value of adjacent left PCM sample, the right gradient refer to the difference of the sampled value of a PCM sample and the sampled value of adjacent right PCM sample;From the PCM sample of the preset audio file, search left gradient and right gradient be all larger than zero PCM sample, establish wave crest PCM sample set;From the wave crest PCM sample set, search the PCM sample of first wave crest in the sine wave of the second amplitude, wherein, sampled value corresponding to the PCM sample of first wave crest is greater than the sampled value of adjacent left wave crest PCM sample in the sine wave of second amplitude, equal to the sampled value of adjacent right wave crest PCM sample;According to the sample number of the PCM sample of first wave crest in the sine wave of second amplitude and the length of preset audio data frame, the audio data frame that the PCM sample of first wave crest in the sine wave of second amplitude is belonged to is determined.
In conjunction with the 4th kind or the 5th kind of possible implementation, in the 6th kind of possible implementation, the PCM sample of the processor first wave crest in the sine wave for determining second amplitude reaches the shift time of recording thread time relative to the audio data frame belonged to, meets following formula requirements:
T=ij%FrameL*1/Samplerate;
Wherein, the PCM sample that the T represents first wave crest in the sine wave of second amplitude reaches the shift time of recording thread time relative to the audio data frame belonged to;The ijRepresent the sample number of the PCM sample of first wave crest in the sine wave of second amplitude;The FrameL represents the length of audio data frame, and the % represents complementation, and the Samplerate represents the frequency that the equipment carries out PCM sampling to the sine wave of second amplitude.
The third aspect, a kind of computer readable storage medium is provided, for being stored as executing software instruction used in any one function of realizing of the above-mentioned first aspect of the application, first aspect, it includes for executing program designed by any one method realized of the above-mentioned first aspect of the present invention, first aspect.
Therefore, in this application, terminal, which first turns on, plays thread and recording thread, preset audio file will be played by playing thread, and thread of recording will record to the preset audio file for playing thread broadcasting, and the first time information of terminal recording played preset audio file and the second temporal information for recording preset audio file;Finally, terminal is believed according to first time Breath and the second temporal information, that is, can determine the audio loop time delay of terminal inner.
Detailed description of the invention
Fig. 1 is the process flow provided by the embodiments of the present application to audio data;
Fig. 2 is the hardware structural diagram of terminal provided by the embodiments of the present application;
Fig. 3 is the flow diagram of the method for testing audio circuit provided by the embodiments of the present application time delay;
Fig. 4 is the flow diagram of testing audio circuit provided by the embodiments of the present application time delay;
Fig. 5 is the schematic diagram of sine wave corresponding to PCM file provided by the present application;
Fig. 6 is another schematic diagram of testing audio circuit provided by the present application time delay;
Fig. 7 is the structural schematic diagram of the equipment of testing audio circuit provided by the present application time delay;
Fig. 8 is the structural schematic diagram of the device of testing audio circuit provided by the present application time delay.
Specific embodiment
In order to make it easy to understand, it is exemplary give it is for reference with the explanation of the application related notion, it is as follows:
Terminal: terminal (such as mobile phone, portable computer and wearable device etc.) can be moveable, or immovable terminal (for example, fixed computer and TV etc.).The terminal includes at least microphone and loudspeaker and mainly records audio data (such as user voice) from microphone input for handling audio data, after treatment, exported by loudspeaker.Its audio processing process is mainly made of recording thread and broadcasting thread.
Recording thread: it can refer to Fig. 1, its process flow is, by analog audio data (such as user voice) from microphone input, by analog-digital converter (Analog to Digital Converter, ADC digital audio-frequency data) is converted to, digital audio-frequency data is transmitted to system audio service unit through bus B us and software and hardware driving, then digital audio-frequency data is transmitted to buffer area through the first audio transmission unit.
It plays thread: can refer to Fig. 1, its process flow is, second audio transmission unit reads digital audio-frequency data out of buffer area, and the digital audio-frequency data of reading is transmitted to system audio service unit, digital audio-frequency data is transmitted to digital analog converter (Digital to Analog Converter through software and hardware driving and Bus again by system audio service unit, DAC), and digital audio-frequency data is converted to analog audio data by DAC, is played out through loudspeaker.
It should be noted that, for the terminal of Android operation system, it is recording thread and is playing in thread, its driving can be ALSA, system audio service unit can be AudioFinger, first audio transmission unit can be Audio Record, and the second audio transmission unit can be Audio Track or Media palyer.And the communication between different processes for convenience, in schematic diagram shown in Fig. 1, it may also include a Binder unit among system audio service unit and the first audio transmission unit, also may also include a Binder unit among system audio service unit and the second audio transmission unit.
Audio loop time delay: referring to microphone input of the audio data from terminal, until the time delay exported from the loudspeaker of terminal;The time delay is mainly made of the Playout delay of the recording time delay of recording thread and broadcasting thread.
Sinusoidal wave pulse coded modulation (Pulse Code Modulation, PCM) file: PCM processing file obtained is carried out for the sine wave of sine wave and the second amplitude to the first amplitude, the PCM processing includes: that three processes are sampled, quantified and encoded to sine wave;The PCM file includes multiframe audio data, and every frame audio data includes multiple PCM samples (for example, a frame audio data may include 640 PCM samples), and each PCM sample corresponds to a sampled value of sine wave.
PCM sample: by a sampled point of the sine wave to the sine wave or the second amplitude of the first amplitude, by quantization and Acquired data after coding.
With reference to the accompanying drawing, the technical solution of the application is introduced:
The method and apparatus of the testing audio circuit time delay provided in the embodiment of the present application, it can be applied to test terminal sound intermediate frequency circuit time delay, the application scenarios of the application are introduced first: with the rapid development of internet, more and more terminals support real-time audio scene, for example, K song, DJ and game etc..Under these real-time audio scenes, user wishes the audio data for being input to terminal, can export from terminal as soon as possible.Based on this, the application provides a kind of method and apparatus of testing audio circuit time delay, to test the audio loop time delay of terminal.
In a kind of example of the application, Fig. 2 shows a kind of hardware configurations of terminal 200, as shown in Fig. 2, can include: processor 201, memory 202, display equipment 203, input equipment 204, voicefrequency circuit 205, microphone 206 and loudspeaker 207.
Wherein, memory 202, display equipment 203 and input equipment 204 are connected with processor 201.Memory 202, for storing executable program, the program of method including testing audio circuit provided by the present application time delay, memory 202 includes memory and external memory, and memory can be random access memory (RAM), read-only memory (ROM) and cache memory (CACHE) etc..External memory can be hard disk, CD, USB disk, floppy disk or magnetic tape station etc..Executable program is typically stored on external memory, and processor 201 executes program after executable program being loaded into memory from external memory again, for example, executing the program of the method for testing audio circuit provided by the present application time delay.
It is specifically introduced below with reference to each component parts of the Fig. 1 to terminal 200:
Processor 201 is the control centre of terminal 200, utilize the various pieces of various interfaces and connection terminal, by run or execute be stored in memory 202 program (or, referred to as " unit "), and call the data being stored in memory 202, the various functions and data processing of terminal 200 are executed, to carry out integral monitoring to terminal 200.
Optionally, processor 201 may include at least one processing unit, the integrated processing of the processing unit and wireless communication function;Alternatively, processor 201 may also comprise two processors of application processor and modem, the main processing operation system of application processor, user interface and application program etc..Modem is mainly used for wirelessly adjusting communication.
Memory 202 mainly includes storing program area and storage data area.Wherein, the application program of method etc. of testing audio circuit time delay involved in application program needed for storing program area can store the operating system (for example, Android operation system, IOS operating system etc.) of terminal, at least one function (such as application program, application program of image player function of sound-playing function etc.) and the embodiment of the present application.Storage data area, which can be stored, uses created data according to terminal 200, including the related setting information of the method for testing audio circuit time delay or use information etc. involved in the application.
Show equipment 203, for showing in the various menus of user's information inputted, the information and terminal 200 that are supplied to user, various information including the method for testing audio circuit time delay involved in the embodiment of the present application, such as parameter configuration and test result show information etc..
Input equipment 204, number, character information and various inputs instruction for receiving input, for example, the method for testing audio circuit provided by the present application time delay starts test instruction and stopping test instruction etc..Input equipment 204 can also include touch panel and/or other type input equipments.Wherein, touch panel is alternatively referred to as touch screen, can acquire touch operation (for example, user touch operation using finger, stylus etc. on it or nearby) of the user on it or near it.Other type input equipments can include but is not limited to one of physical keyboard, function key (such as volume control button and switch key etc.), mouse, trace ball and operating stick etc. or a variety of.
Voicefrequency circuit 205 amplifies the analog audio data of acquisition, is converted to digital audio-frequency data, carry out pcm encoder, the digital audio-frequency data after coding is sent to processor 201 for converting to through 206 carry out sound of microphone/electricity.Alternatively, The digital audio-frequency data that processor 201 is transmitted carries out PCM decoding, and decoded digital audio-frequency data is converted to analog audio data, then carries out power amplification, until loudspeaker 207 carries out electro acoustic conversion, pushes loudspeaker sounding.
It will be understood by those skilled in the art that the restriction of the internal structure of terminal 200 shown in Fig. 2 not structure paired terminal, may include perhaps combining certain components or different component layouts than illustrating more or fewer parts.For example, may also include the antenna of radio frequency (Rad io Frequency, RF) circuit and connection, Wireless Fidelity (Wireless Fidelity, WIFI) module and the antenna of connection etc. when terminal 200 is using wireless mode communication with the outside world.In addition, terminal 200 may also include sensor and the power supply etc. for its power supply, will not enumerate herein
As shown in figure 3, the application provides a kind of method of testing audio circuit time delay, terminal involved in this method can be specially above-mentioned terminal 200, and loudspeaker can be specially above-mentioned loudspeaker 207, and microphone can be specially above-mentioned microphone 206.By the introduction of above-mentioned audio loop time delay, audio loop time delay is made of the recording time delay of recording thread and the Playout delay of broadcasting thread, the cardinal principle of this method are as follows: preset audio file, the preset audio file, which is previously placed in terminal, (for example to be placed in the buffer area in above-mentioned Fig. 1, or other storage regions, then when executing test, preset audio file is loaded onto buffer area again), starting plays thread, play preset audio file, the first time information of recording played default file;Meanwhile starting recording thread, recording thread will record to the preset audio file for playing thread broadcasting, obtain the second temporal information of recording audio file.Then, according to first time information and the second temporal information, the time delay of audio loop is determined, for example, setting audio loop time delay to the difference of the second temporal information Yu first time information.
It is specific as follows:
Step S31: terminal opens preset broadcasting thread.
Specifically, as shown in Figure 4, play the treatment process of thread are as follows: the second audio transmission unit reads preset audio file out of buffer area, and the preset audio file of reading is transmitted to system audio service unit, preset audio file is transmitted to DAC through software and hardware driving and Bus again by system audio service unit, and preset audio file is converted to simulation files by DAC, is carried out electro acoustic conversion, is played out through loudspeaker.
Step S32: terminal opens preset recording thread.
Specifically, still can refer to Fig. 4, the treatment process for thread of recording are as follows: the sound for playing input loudspeaker in microphone, through sound/electricity conversion, it can get simulation files at this time, simulation files can be converted to digital document through ADC transformation, digital document at this time is preset audio file;Preset audio file is transmitted to the first audio transmission unit through driving and system audio service unit again, and preset audio file is written to buffer area the first audio transmission unit.
Step S33: thread plays the first time information of the preset audio file to terminal and recording thread records the second temporal information of the audio file according to playing, and determines the audio loop time delay of terminal.
In this application, it can determine that a target data, the target data can be used as the benchmark for calculating audio loop time delay in preset audio file.Start to play the first time information of the target data then, it is determined that playing thread, and record the second temporal information that thread records the target data, finally, the audio loop time delay by the difference of the second temporal information and first time information, as the terminal;For example, the second temporal information be 10 points 50 seconds 59 minutes 35 milliseconds, and first time information be 10 points 50 seconds 59 minutes 40 milliseconds, then, the audio loop time delay of terminal is 5 milliseconds.
It should be pointed out that above-mentioned first time information and the second temporal information are not understood to indicate or imply relative importance, can not be interpreted as indication or suggestion sequence just for the sake of distinguishing different temporal informations.
It should also be pointed out that; in the embodiment of the present application; step S31-step the S33 does not limit the tandem that terminal executes the application step; method provided by the present application can be executed according to the sequence of step S31, step S32 and step S33; the present processes can also be executed according to the sequence of step S32, step S31, step S33, within the scope of protection of this application.And in order to avoid leakage is recorded, step S32 can be first carried out and open recording thread, then execute step S31 execution and open broadcasting Thread.
Therefore, in this application, terminal, which first turns on, plays thread and recording thread, preset audio file will be played by playing thread, and thread of recording will record to the preset audio file for playing thread broadcasting, and the first time information of terminal recording played preset audio file and the second temporal information for recording preset audio file;Finally, terminal can determine the audio loop time delay of terminal inner according to first time information and the second temporal information.
In another possible embodiments of the application, the preset audio file can be sine wave PCM file;Wherein, the sine wave PCM file is to carry out PCM to the sine wave of the first amplitude and the sine wave of the second amplitude to handle file obtained, and the PCM processing includes that three processes are sampled, quantified and encoded to sine wave.
In the embodiment of the present application, as shown in figure 5, the amplitude of the sine wave of the second amplitude can be 2A for example, the amplitude of the sine wave of the first amplitude can be A;And first amplitude sine wave and the frequency of sine wave of the second amplitude can be identical, can also be different, for example, the frequency of the two can be 440HZ.
In this application, audio loop time delay can be calculated, process is specific as follows specifically using sampled value corresponding to first wave crest of the sine wave of the second amplitude in above-mentioned sine wave PCM file as target data:
First, terminal determines that the broadcasting thread plays the first time information of sampled value corresponding to first wave crest in the sine wave of second amplitude.
In the embodiment of the present application, more specifically, the sine wave of first amplitude sampled value corresponding with the sine wave of the second amplitude can differ the first duration Δ t, and the play time of sampled value corresponding to sine wave of the play time of sampled value corresponding to the sine wave of the first amplitude earlier than second amplitude in play time.For example, playing the sampled value of the sine wave of the first amplitude first, and after the sine wave 5S for playing the first amplitude, then play sampled value corresponding to the sine wave of the second amplitude.
In this application, still reference can be made to Fig. 5, calculating process is as follows: the starting of recording played thread plays the temporal information of preset audio file (such as in time T1, starting plays preset audio file), then (such as Δ t), calculating starting and playing the temporal information of collection value corresponding to the sine wave of the second amplitude (for example is T1+ Δ t) to the first duration differed in play time with the sine wave of the second amplitude according to the sine wave of time T1, the first amplitude;Then, according to the cycle T of T1+ Δ t and the sine wave of the second amplitude, determine that the broadcasting thread plays the first time information of sampled value corresponding to first wave crest in the sine wave of the second amplitude;As seen in Figure 5, since starting to play the second amplitude sine wave, pass through 1/4T to the first wave crest centre played to the sine wave of the second amplitude, the T is the period of the second amplitude sine wave, therefore, finally, it may be determined that playing thread and playing the first time information of sampled value corresponding to first wave crest of the second amplitude sine wave is T1+ Δ t+1/4T.
It in practical applications, can also be by T1+ Δ t directly as the first time information of sampled value corresponding to first wave crest for playing the second amplitude sine wave in this way, also within the scope of protection of this application in the lower situation of circuit time delay precise requirements.
Second, terminal determines that the recording thread records the second temporal information of sampled value corresponding to first wave crest in the sine wave of second amplitude, can refer to shown in Fig. 6.
Step S61: the audio data frame that the PCM sample of first wave crest in the sine wave of second amplitude is belonged to is determined;
Specifically, the preset audio file may include multiframe audio data, in this application, terminal will record the time that every frame audio data in preset audio file reaches recording thread, form the corresponding relationship MAP of frame index and time, such as MAP={ (the 1st frame audio data, Time1), (the 2nd frame audio data, Time2), (the 3rd frame audio data, Time3) ... }.Wherein, Timel, Time2.....TimeN are corresponding every frame audio data to reaching recording thread Time.
And every frame audio data may include multiple PCM samples (for example, usual frame audio data includes 640 PCM samples), each PCM sample corresponds to a PCM sampled value.For each PCM sample in every frame audio data, left gradient G radientL [n] and the right gradient G radientR [n] of each PCM sample can be asked.
Left gradient G radientL [n]=Sample [n]-Sample [n-1];
Right gradient G radientR [n]=Sample [n]-Sample [n+1];
Wherein, Sample [n] represents current PC M sample, and Sample [n-1] is represented in a frame audio data, left adjacent PCM sample in current PC M sample, Sample [n+1] is represented in a frame audio data, the right adjacent PCM sample of current PC M sample.
The PCM sample that left gradient and right gradient in each audio data are all larger than 0 is counted, wave crest PCM sample set is established;
Wherein, if the left gradient and right gradient of PCM sample are both greater than 0, illustrate the PCM sample be represent sine wave wave crest corresponding to collection value;
And wave crest PCM sample set includes wave crest collection index set SIWith wave crest value set SV;Wherein, wave crest collection indexes set SIThe middle PCM number for representing each wave crest sample, wave crest value set SVRepresent the size of the corresponding sampled value of wave crest;
SI={ i1,i2,…im};
SV={ v1,v2,…im};
From the wave crest PCM sample set, search the PCM sample of first wave crest in the sine wave of the second amplitude, wherein, as shown in Figure 5, sampled value corresponding to the PCM sample of first wave crest is greater than the sampled value of adjacent left wave crest PCM sample in the sine wave of second amplitude, equal to the sampled value of adjacent right wave crest PCM sample;
In this application, specific embodiment can are as follows: iteration wave crest value set SV, ask wave crest gradient G [j].
G [j]=V [j]-V [j-1];
Wherein, V [j] represents sampled value corresponding to current wave crest, and V [j-1] represents sampled value corresponding to the adjacent left wave crest of current wave crest;By finding out shown in Fig. 5, only first wave crest of the sine wave of the second amplitude, left adjacent wave crest are that the difference of A, 2A and A can just be greater than 0.
After determining peak value corresponding to the first of sine wave of the second amplitude wave crest, set S is indexed in wave crest collectionI={ i1,i2,…imIn set, the corresponding PCM sample number I of the wave crest is searchedj
Finally, according to the PCM sample number I of first wave crest in the sine wave of the second amplitudejAnd the length of each audio data frame, determine the audio data frame that the PCM sample of first wave crest in the sine wave of the second amplitude is belonged to;
For example, in this application, by the PCM sample number I of first wave crest of the second amplitude sine wavejMake ratio with the length FrameL of every frame audio data, it may be determined that IjThe audio data frame belonged to;Such as IjIt is 10014;And FrameL is 1000, then can determine Ij/ FrameL=10, it may be determined that IjIn the 11st audio data frame.FrameL can be specially the quantity that every frame includes PCM sample.
Step S62: from audio data frame and reaching in the corresponding relationship MAP for recording thread time, and the audio data frame that the PCM sample of lookup first wave crest is belonged to is corresponding to reach the time for recording thread;
For example, above-mentioned IjPositioned at the 11st audio data frame, it can be specifically in above-mentioned MAP={ (the 1st frame audio data, Time1), (the 2nd frame audio data, Time2), (the 3rd frame audio data, Time3) ... } in search the 11st frame audio data reach recording thread time Time11.
Step S63: according to the sample number I of PCM sample corresponding to first wave crest of the sine wave of second amplitudej, audio data frame length FrameL and the frequency of PCM sampling is carried out to the sine wave of second amplitude, determine that the PCM sample of first wave crest in the sine wave of second amplitude is reached relative to the audio data frame belonged to and record thread time Shift time;
Wherein, the terminal determines that the PCM sample of first wave crest in the sine wave of second amplitude reaches the shift time of recording thread time relative to the audio data frame belonged to, meets following formula requirements:
T=ij%FrameL*1/Samplerate;
Wherein, the PCM sample that the T represents first wave crest in the sine wave of second amplitude reaches the shift time of recording thread time relative to the audio data frame belonged to;The IjRepresent the sample number of the PCM sample of first wave crest in the sine wave of second amplitude;The FrameL represents the length of audio data frame, and the % represents complementation, and the Samplerate represents the frequency that the terminal carries out PCM sampling to the sine wave of second amplitude.
Specifically, the example above is still continued to use, IjIt is 10014, and FrameL is 1000, then IjIt can obtain being 14 with FrameL complementation, it is seen then that IjIt is the 14th PCM sample in the data frame belonged to, then, 14*1/Samplerate is IjShift time in the audio data frame belonged to, Samplerate represents the frequency for carrying out PCM sampling, and 1/Samplerate represents the period for carrying out PCM sampling, i.e., at interval of how long acquiring a PCM sample;And 14*1/Samplerate is the temporal information that the 14th PCM sample is acquired in current audio data frame.
Step S64: according to the time of belonged to audio data frame arrival recording thread and the shift time, determine that the recording thread records the second temporal information of sampled value corresponding to first wave crest in the sine wave of second amplitude.
In this application, the volume shift time that the belonged to audio data frame of first wave crest of the second amplitude sine wave specifically can be reached the time of recording thread and be calculated is made and reaches the second temporal information of recording thread as first wave crest in the second amplitude sine wave.
And finally, the time delay Tloop of entire audio loop meets following formula:
Tloop=TimeFrameIndex+Ij%FrameL*1/Samplerate- (T1+ Δ t+1/4T);
Wherein, TimeFrameIndex+Ij%FrameL*1/Samplerate represents recording thread and starts to record the second temporal information of first wave crest in the second amplitude sine wave, wherein, TimeFrameIndex represents the time that the audio data frame that first wave crest is belonged in the sine wave of the second amplitude reaches recording thread, and Ij%FrameL*1/Samplerate represents shift time of first wave crest of the second amplitude amplitude sine wave in the data belonged in frame;(T1+ Δ t+1/4T), which is represented, plays the first time that thread starts first wave crest in the second amplitude sine wave of broadcasting, T1 is the time for starting to play the first amplitude sine wave, and Δ t represents the time that the second amplitude sine wave differs in play time with the first amplitude sine wave, 1/4T is represented from starting to play the second amplitude sine wave to the time for being played to wave crest.
In another possible embodiments of the application, as shown in fig. 7, providing a kind of equipment 700 of testing audio circuit time delay, including processor 701 and memory 702;
Wherein, memory 702, the program instruction of the method for storing above-mentioned testing audio circuit time delay;Memory 702 can be nonvolatile memory, such as hard disk (hard disk drive,) or solid state hard disk (solid-state drive HDD, SSD) etc., it can also be volatile memory (volatile memory), such as random access memory (random-access memory, RAM).Memory can be used for carry or store have instruction or data structure form desired program code and can by any other medium of computer access, but not limited to this.
Processor 701 can be a central processing module (central processing unit, CPU), or be digital processing module etc.;Processor 701, for reading the code in the memory, in the method for executing above-mentioned testing audio circuit time delay, specifically: open preset broadcasting thread, the broadcasting thread is used to read preset audio file from the buffer area of the equipment, and plays the preset audio file through the loudspeaker of the equipment;Preset recording thread is opened, the recording thread is for recording the preset audio file that the loudspeaker plays by the microphone of the equipment Sound;The first time information of the preset audio file is played according to the broadcasting thread and the recording thread records the second temporal information of the preset audio file, determine the audio loop time delay of the equipment, the audio loop time delay refers to microphone input of the sound from the equipment, until the time-consuming exported from the loudspeaker of the equipment.
Optionally, processor 701 records the second temporal information of the preset audio file in the first time information and the recording thread for playing the preset audio file according to the broadcasting thread, delay when determining the audio loop of the equipment, is specifically used for: determining that the broadcasting thread plays the first time information of target data in the preset audio file;Determine that the recording thread records the second temporal information of target data in the preset audio file;According to the difference of second temporal information and the first time information, the audio loop time delay of the equipment is determined.
Optionally, the preset audio file is sinusoidal wave pulse coded modulation PCM file, and the sine wave PCM file is obtained by the sine wave progress PCM processing of sine wave and the second amplitude to the first amplitude;
The target data of the preset audio file is sampled value corresponding to first wave crest in the second amplitude sine wave.
Optionally, corresponding sampled value differs the first duration, and the play time of sampled value corresponding to sine wave of the play time of sampled value corresponding to the sine wave of first amplitude earlier than second amplitude to the sine wave of the sine wave of first amplitude and the second amplitude in play time respectively;Processor 701 is specifically used for when determining that the broadcasting thread plays the first time information of target data in the preset audio file: recording the temporal information that the broadcasting thread starting plays the preset audio file;The first duration that sampled value corresponding to temporal information, the sine wave of first amplitude and the sine wave of the second amplitude of the preset audio file differs in play time is played according to the broadcasting thread starting, determines that the equipment starting plays the temporal information of sampled value corresponding to the sine wave of second amplitude;The temporal information of sampled value and the period of the second amplitude sine wave corresponding to the sine wave of second amplitude are played according to equipment starting, determines that the broadcasting thread plays the first time information of sampled value corresponding to first wave crest in the second amplitude sine wave.
Optionally, the preset audio file includes multiframe audio data, and every frame audio data includes multiple PCM samples, and each PCM sample corresponds to a PCM sampled value;Processor 701 is specifically used for when determining that the recording thread records the second temporal information of target data in the preset audio file: determining the audio data frame that the PCM sample of first wave crest in the sine wave of second amplitude is belonged to;From audio data frame and reach in the corresponding relationship for recording thread time, the audio data frame corresponding time for reaching the recording thread that the PCM sample of first wave crest is belonged to is searched, the corresponding relationship of the audio data frame and arrival recording thread time is to record determined by the time of thread according to frame audio data every in the preset audio file and arrival;According to the sample number of PCM sample corresponding to first wave crest of the sine wave of second amplitude, the length of audio data frame and the frequency for carrying out PCM sampling to the sine wave of second amplitude, determine that the PCM sample of first wave crest in the sine wave of second amplitude reaches the shift time for recording thread time relative to the audio data frame belonged to;The time for recording thread and the shift time are reached according to belonged to audio data frame, determines that the recording thread records the second temporal information of sampled value corresponding to first wave crest in the sine wave of second amplitude.
Optionally, when the audio data frame that the PCM sample of first wave crest is belonged in the sine wave for determining second amplitude of processor 701, it is specifically used for: calculates the left gradient and right gradient of each PCM sample in the preset audio file, the left gradient refers to that the difference of the sampled value of a PCM sample and the sampled value of adjacent left PCM sample, the right gradient refer to the difference of the sampled value of a PCM sample and the sampled value of adjacent right PCM sample;From the PCM sample of the preset audio file, search left gradient and right gradient be all larger than zero PCM sample, establish wave crest PCM sample set;From the wave crest PCM sample set, search the PCM sample of first wave crest in the sine wave of the second amplitude, wherein, sampled value corresponding to the PCM sample of first wave crest is greater than the sampled value of adjacent left wave crest PCM sample in the sine wave of second amplitude, equal to the sampled value of adjacent right wave crest PCM sample;According to the sample number of the PCM sample of first wave crest in the sine wave of second amplitude and the length of preset audio data frame, the PCM sample of first wave crest in the sine wave of second amplitude is determined The audio data frame belonged to.
Optionally, the PCM sample of first wave crest in the sine wave for determining second amplitude of processor 701 reaches the shift time of recording thread time relative to the audio data frame belonged to, meets following formula requirements:
T=ij%FrameL*1/Samplerate;
Wherein, the PCM sample that the T represents first wave crest in the sine wave of second amplitude reaches the shift time of recording thread time relative to the audio data frame belonged to;The ijRepresent the sample number of the PCM sample of first wave crest in the sine wave of second amplitude;The FrameL represents the length of audio data frame, and the % represents complementation, and the Samplerate represents the frequency that the equipment carries out PCM sampling to the sine wave of second amplitude.
Although being not shown, equipment 700 may also include communication interface, for being communicated with external equipment.
The specific connection medium between above-mentioned processor 701 and memory 702 is not limited in the embodiment of the present application.The embodiment of the present application in Fig. 7 between processor 701 and memory 702 pass through bus connect, Fig. 7 is indicated using a hollow double arrowed line, it is not intended that only a bus or a type of bus, connection type between other components, it is only to be schematically illustrated, does not regard it as and be limited.Bus can be divided into address bus, data/address bus, control bus etc..It should be pointed out that equipment 700 can be terminal as shown in Figure 2, the method that can specifically execute testing audio circuit time delay as shown in Figure 3.
Specifically, the equipment as provided by the above embodiments of the present application is similar to the principle that embodiment of the method provided by the application previous embodiment solves the problems, such as, thus the specific implementation of equipment provided by the above embodiments of the present application and beneficial effect can implementation with method provided by the application previous embodiment and beneficial effect can be with cross-reference, overlaps will not be repeated.
In another possible embodiments of the application, as shown in figure 8, the application also provides a kind of device 800 of testing audio circuit time delay, comprising:
Opening unit 801, for opening preset broadcasting thread and recording thread, the broadcasting thread is used to read preset audio file from the buffer area of the terminal, and plays the preset audio file through the loudspeaker of the terminal;The recording thread is for recording to the preset audio file that the loudspeaker plays by the microphone of the terminal;
Determination unit 802, the first time information of the preset audio file is played according to the broadcasting thread and the recording thread records the second temporal information of the preset audio file for determining, determine the audio loop time delay of the terminal, the audio loop time delay refers to microphone input of the sound from the terminal, until the time-consuming exported from the loudspeaker of the terminal.
Optionally, determination unit 802 are specifically used for: determining that the broadcasting thread plays the first time information of target data in the preset audio file;Determine that the recording thread records the second temporal information of target data in the preset audio file;According to the difference of second temporal information and the first time information, the audio loop time delay of the terminal is determined.
Optionally, the preset audio file is sinusoidal wave pulse coded modulation PCM file, and the sine wave PCM file is obtained by the sine wave progress PCM processing of sine wave and the second amplitude to the first amplitude;
The target data of the preset audio file is sampled value corresponding to first wave crest in the second amplitude sine wave.
Optionally, corresponding sampled value differs the first duration, and the play time of sampled value corresponding to sine wave of the play time of sampled value corresponding to the sine wave of first amplitude earlier than second amplitude to the sine wave of the sine wave of first amplitude and the second amplitude in play time respectively;
Determination unit 802 is specifically used for when determining that the broadcasting thread plays the first time information of target data in the preset audio file: recording the temporal information that the broadcasting thread starting plays the preset audio file;The first duration that sampled value corresponding to temporal information, the sine wave of first amplitude and the sine wave of the second amplitude of the preset audio file differs in play time is played according to the broadcasting thread starting, determines that the terminal starting is playing second amplitude just The temporal information of sampled value corresponding to string wave;The temporal information of sampled value and the period of the second amplitude sine wave corresponding to the sine wave of second amplitude are played according to terminal starting, determines that the broadcasting thread plays the first time information of sampled value corresponding to first wave crest in the second amplitude sine wave.
Optionally, the preset audio file includes multiframe audio data, and every frame audio data includes multiple PCM samples, and each PCM sample corresponds to a PCM sampled value;
Determination unit 802 is specifically used for when determining that the recording thread records the second temporal information of target data in the preset audio file: determining the audio data frame that the PCM sample of first wave crest in the sine wave of second amplitude is belonged to;From audio data frame and reach in the corresponding relationship for recording thread time, the audio data frame corresponding time for reaching the recording thread that the PCM sample of first wave crest is belonged to is searched, the corresponding relationship of the audio data frame and arrival recording thread time is to record determined by the time of thread according to frame audio data every in the preset audio file and arrival;According to the sample number of PCM sample corresponding to first wave crest of the sine wave of second amplitude, the length of audio data frame and the frequency for carrying out PCM sampling to the sine wave of second amplitude, determine that the PCM sample of first wave crest in the sine wave of second amplitude reaches the shift time for recording thread time relative to the audio data frame belonged to;The time for recording thread and the shift time are reached according to belonged to audio data frame, determines that the recording thread records the second temporal information of sampled value corresponding to first wave crest in the sine wave of second amplitude.
Optionally, when the audio data frame that the PCM sample of first wave crest is belonged in the sine wave for determining second amplitude of determination unit 802, it is specifically used for: calculates the left gradient and right gradient of each PCM sample in the preset audio file, the left gradient refers to that the difference of the sampled value of a PCM sample and the sampled value of adjacent left PCM sample, the right gradient refer to the difference of the sampled value of a PCM sample and the sampled value of adjacent right PCM sample;From the PCM sample of the preset audio file, search left gradient and right gradient be all larger than zero PCM sample, establish wave crest PCM sample set;From the wave crest PCM sample set, search the PCM sample of first wave crest in the sine wave of the second amplitude, wherein, sampled value corresponding to the PCM sample of first wave crest is greater than the sampled value of adjacent left wave crest PCM sample in the sine wave of second amplitude, equal to the sampled value of adjacent right wave crest PCM sample;According to the sample number of the PCM sample of first wave crest in the sine wave of second amplitude and the length of preset audio data frame, the audio data frame that the PCM sample of first wave crest in the sine wave of second amplitude is belonged to is determined.
Optionally, the PCM sample of first wave crest in the sine wave for determining second amplitude of determination unit 802 reaches the shift time of recording thread time relative to the audio data frame belonged to, meets following formula requirements:
T=ij%FrameL*1/Samplerate;
Wherein, the PCM sample that the T represents first wave crest in the sine wave of second amplitude reaches the shift time of recording thread time relative to the audio data frame belonged to;The ijRepresent the sample number of the PCM sample of first wave crest in the sine wave of second amplitude;The FrameL represents the length of audio data frame, and the % represents complementation, and the Samplerate represents the frequency that the terminal carries out PCM sampling to the sine wave of second amplitude.
Specifically, the device as provided by the above embodiments of the present application is similar to the principle that embodiment of the method provided by the application previous embodiment solves the problems, such as, thus the specific implementation of device provided by the above embodiments of the present application and beneficial effect can implementation with method provided by the application previous embodiment and beneficial effect can be with cross-reference, overlaps will not be repeated.
It is schematical to the division of module in the embodiment of the present application, only a kind of logical function partition, there may be another division manner in actual implementation, in addition, each functional module in each embodiment of the application can integrate in a processor, it is also possible to physically exist alone, can also be integrated in two or more modules in a module.Above-mentioned integrated module both can take the form of hardware realization, can also be realized in the form of software function module.For example, Fig. 7 or Equipment shown in Fig. 2 can be a kind of specific implementation of Fig. 8.Wherein, a kind of implementation of opening unit 801 and determination unit 802 shown in Fig. 8 is that the computer store instruction in memory 702 is called to realize by processor 701 shown in Fig. 7.
In another possible embodiments of the application, a kind of computer readable storage medium, including instruction are also provided, when run on a computer, so that the method that computer executes testing audio circuit time delay.
It should be understood by those skilled in the art that, embodiments herein can provide as method, system or computer program product.Therefore, the form of complete hardware embodiment, complete software embodiment or embodiment combining software and hardware aspects can be used in the application.Moreover, the form for the computer program product implemented in the computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) that one or more wherein includes computer usable program code can be used in the application.
The application is that reference is described according to the flowchart and/or the block diagram of the method for the embodiment of the present application, equipment (system) and computer program product.It should be understood that the combination of process and/or box in each flow and/or block and flowchart and/or the block diagram that can be realized by computer program instructions in flowchart and/or the block diagram.These computer program instructions be can provide to the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to generate a machine, so that generating by the instruction that computer or the processor of other programmable data processing devices execute for realizing the device for the function of specifying in one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, to be able to guide in computer or other programmable data processing devices computer-readable memory operate in a specific manner, so that instruction stored in the computer readable memory generates the manufacture including command device, which realizes the function of specifying in one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that series of operation steps are executed on a computer or other programmable device to generate computer implemented processing, thus the step of instruction executed on a computer or other programmable device is provided for realizing the function of specifying in one or more flows of the flowchart and/or one or more blocks of the block diagram.
Obviously, those skilled in the art can carry out various modification and variations without departing from the spirit and scope of the embodiment of the present application to the embodiment of the present application.If then the application is also intended to include these modifications and variations in this way, these modifications and variations of the embodiment of the present application belong within the scope of the claim of this application and its equivalent technologies.

Claims (15)

  1. A kind of method of testing audio circuit time delay characterized by comprising
    Terminal opens preset broadcasting thread, and the broadcasting thread is used to read preset audio file from the buffer area of the terminal, and plays the preset audio file through the loudspeaker of the terminal;
    The terminal opens preset recording thread, and the recording thread is for recording to the preset audio file that the loudspeaker plays by the microphone of the terminal;
    The terminal plays the first time information of the preset audio file according to the broadcasting thread and the recording thread records the second temporal information of the preset audio file, determine the audio loop time delay of the terminal, the audio loop time delay refers to microphone input of the sound from the terminal, until the time-consuming exported from the loudspeaker of the terminal.
  2. According to the method for claim 1, it is characterized in that, the terminal plays the first time information of the preset audio file according to the broadcasting thread and the recording thread records the second temporal information of the preset audio file, determines the audio loop time delay of the terminal, comprising:
    The terminal determines that the broadcasting thread plays the first time information of target data in the preset audio file;
    The terminal determines that the recording thread records the second temporal information of target data in the preset audio file;
    The terminal determines the audio loop time delay of the terminal according to the difference of second temporal information and the first time information.
  3. According to the method described in claim 2, the sine wave PCM file is obtained by the sine wave progress PCM processing of sine wave and the second amplitude to the first amplitude it is characterized in that, the preset audio file is sinusoidal wave pulse coded modulation PCM file;
    The target data of the preset audio file is sampled value corresponding to first wave crest in the second amplitude sine wave.
  4. According to the method for claim 3, it is characterized in that, corresponding sampled value differs the first duration, and the play time of sampled value corresponding to sine wave of the play time of sampled value corresponding to the sine wave of first amplitude earlier than second amplitude to the sine wave of the sine wave of first amplitude and the second amplitude in play time respectively;
    The terminal determines that the broadcasting thread plays the first time information of target data in the preset audio file, comprising:
    The terminal records the temporal information that the broadcasting thread starting plays the preset audio file;
    The terminal plays the first duration that sampled value corresponding to temporal information, the sine wave of first amplitude and the sine wave of the second amplitude of the preset audio file differs in play time according to the broadcasting thread starting, determines that the terminal starting plays the temporal information of sampled value corresponding to the sine wave of second amplitude;
    The terminal plays the temporal information of sampled value and the period of the second amplitude sine wave corresponding to the sine wave of second amplitude according to terminal starting, determines that the broadcasting thread plays the first time information of sampled value corresponding to first wave crest in the second amplitude sine wave.
  5. The method according to claim 3 or 4, which is characterized in that the preset audio file includes multiframe audio data, and every frame audio data includes multiple PCM samples, and each PCM sample corresponds to a PCM sampled value;
    The terminal determines that the recording thread records the second temporal information of target data in the preset audio file, comprising:
    The terminal determines the audio data frame that the PCM sample of first wave crest in the sine wave of second amplitude is belonged to;
    The terminal is from audio data frame and reaches in the corresponding relationship for recording thread time, and the audio data frame that the PCM sample of lookup first wave crest is belonged to is corresponding to reach the time for recording thread, and the audio data frame is recorded with arrival The corresponding relationship of thread time is according to frame audio data every in the preset audio file and to reach determined by the time of recording thread;
    Terminal sample number of PCM sample according to corresponding to first wave crest of the sine wave of second amplitude, the length of audio data frame and the frequency that PCM sampling is carried out to the sine wave of second amplitude determine that the PCM sample of first wave crest in the sine wave of second amplitude reaches the shift time for recording thread time relative to the audio data frame belonged to;
    The terminal reaches the time for recording thread and the shift time according to belonged to audio data frame, determines that the recording thread records the second temporal information of sampled value corresponding to first wave crest in the sine wave of second amplitude.
  6. According to the method described in claim 5, it is characterized in that, the terminal determines the audio data frame that the PCM sample of first wave crest in the sine wave of second amplitude is belonged to, comprising:
    The terminal calculates the left gradient and right gradient of each PCM sample in the preset audio file, the left gradient refers to that the difference of the sampled value of a PCM sample and the sampled value of adjacent left PCM sample, the right gradient refer to the difference of the sampled value of a PCM sample and the sampled value of adjacent right PCM sample;
    The terminal from the PCM sample of the preset audio file, search left gradient and right gradient be all larger than zero PCM sample, establish wave crest PCM sample set;
    The terminal is from the wave crest PCM sample set, search the PCM sample of first wave crest in the sine wave of the second amplitude, wherein, sampled value corresponding to the PCM sample of first wave crest is greater than the sampled value of adjacent left wave crest PCM sample in the sine wave of second amplitude, equal to the sampled value of adjacent right wave crest PCM sample;
    The terminal determines the audio data frame that the PCM sample of first wave crest in the sine wave of second amplitude is belonged to according to the sample number of the PCM sample of first wave crest in the sine wave of second amplitude and the length of preset audio data frame.
  7. Method according to claim 5 or 6, it is characterized in that, the terminal determines that the PCM sample of first wave crest in the sine wave of second amplitude reaches the shift time of recording thread time relative to the audio data frame belonged to, meets following formula requirements:
    T=ij%FrameL*1/Samplerate;
    Wherein, the PCM sample that the T represents first wave crest in the sine wave of second amplitude reaches the shift time of recording thread time relative to the audio data frame belonged to;The ijRepresent the sample number of the PCM sample of first wave crest in the sine wave of second amplitude;The FrameL represents the length of audio data frame, and the % represents complementation, and the Samplerate represents the frequency that the terminal carries out PCM sampling to the sine wave of second amplitude.
  8. The equipment of a kind of testing audio circuit time delay, which is characterized in that the equipment includes processor and memory;
    The processor, for reading the code in the memory, for executing: opening preset broadcasting thread, the broadcasting thread is used to read preset audio file from the buffer area of the equipment, and plays the preset audio file through the loudspeaker of the equipment;Preset recording thread is opened, the recording thread is for recording to the preset audio file that the loudspeaker plays by the microphone of the equipment;The first time information of the preset audio file is played according to the broadcasting thread and the recording thread records the second temporal information of the preset audio file, determine the audio loop time delay of the equipment, the audio loop time delay refers to microphone input of the sound from the equipment, until the time-consuming exported from the loudspeaker of the equipment.
  9. Equipment according to claim 8, it is characterized in that, the processor records the second temporal information of the preset audio file in the first time information and the recording thread for playing the preset audio file according to the broadcasting thread, delay when determining the audio loop of the equipment, is specifically used for:
    Determine that the broadcasting thread plays the first time information of target data in the preset audio file;
    Determine that the recording thread records the second temporal information of target data in the preset audio file;
    According to the difference of second temporal information and the first time information, the audio loop time delay of the equipment is determined.
  10. Equipment according to claim 9, which is characterized in that the preset audio file is sinusoidal wave pulse coded modulation PCM file, and the sine wave PCM file is obtained by the sine wave progress PCM processing of sine wave and the second amplitude to the first amplitude;
    The target data of the preset audio file is sampled value corresponding to first wave crest in the second amplitude sine wave.
  11. Equipment according to claim 10, it is characterized in that, corresponding sampled value differs the first duration, and the play time of sampled value corresponding to sine wave of the play time of sampled value corresponding to the sine wave of first amplitude earlier than second amplitude to the sine wave of the sine wave of first amplitude and the second amplitude in play time respectively;
    The processor is specifically used for when determining that the broadcasting thread plays the first time information of target data in the preset audio file:
    Record the temporal information that the broadcasting thread starting plays the preset audio file;
    The first duration that sampled value corresponding to temporal information, the sine wave of first amplitude and the sine wave of the second amplitude of the preset audio file differs in play time is played according to the broadcasting thread starting, determines that the equipment starting plays the temporal information of sampled value corresponding to the sine wave of second amplitude;
    The temporal information of sampled value and the period of the second amplitude sine wave corresponding to the sine wave of second amplitude are played according to equipment starting, determines that the broadcasting thread plays the first time information of sampled value corresponding to first wave crest in the second amplitude sine wave.
  12. Equipment described in 0 or 11 according to claim 1, which is characterized in that the preset audio file includes multiframe audio data, and every frame audio data includes multiple PCM samples, and each PCM sample corresponds to a PCM sampled value;
    The processor is specifically used for when determining that the recording thread records the second temporal information of target data in the preset audio file:
    Determine the audio data frame that the PCM sample of first wave crest in the sine wave of second amplitude is belonged to;
    From audio data frame and reach in the corresponding relationship for recording thread time, the audio data frame corresponding time for reaching the recording thread that the PCM sample of first wave crest is belonged to is searched, the corresponding relationship of the audio data frame and arrival recording thread time is to record determined by the time of thread according to frame audio data every in the preset audio file and arrival;
    According to the sample number of PCM sample corresponding to first wave crest of the sine wave of second amplitude, the length of audio data frame and the frequency for carrying out PCM sampling to the sine wave of second amplitude, determine that the PCM sample of first wave crest in the sine wave of second amplitude reaches the shift time for recording thread time relative to the audio data frame belonged to;
    The time for recording thread and the shift time are reached according to belonged to audio data frame, determines that the recording thread records the second temporal information of sampled value corresponding to first wave crest in the sine wave of second amplitude.
  13. Equipment according to claim 12, which is characterized in that when the processor audio data frame that the PCM sample of first wave crest is belonged in the sine wave for determining second amplitude, be specifically used for:
    Calculate the left gradient and right gradient of each PCM sample in the preset audio file, the left gradient refers to that the difference of the sampled value of a PCM sample and the sampled value of adjacent left PCM sample, the right gradient refer to the difference of the sampled value of a PCM sample and the sampled value of adjacent right PCM sample;
    From the PCM sample of the preset audio file, search left gradient and right gradient be all larger than zero PCM sample, establish wave crest PCM sample set;
    From the wave crest PCM sample set, the PCM sample of first wave crest in the sine wave of the second amplitude is searched, wherein sampled value corresponding to the PCM sample of first wave crest is greater than adjacent left wave crest PCM sample in the sine wave of second amplitude This sampled value, equal to the sampled value of adjacent right wave crest PCM sample;
    According to the sample number of the PCM sample of first wave crest in the sine wave of second amplitude and the length of preset audio data frame, the audio data frame that the PCM sample of first wave crest in the sine wave of second amplitude is belonged to is determined.
  14. Equipment according to claim 12 or 13, it is characterized in that, the PCM sample of the processor first wave crest in the sine wave for determining second amplitude reaches the shift time of recording thread time relative to the audio data frame belonged to, meets following formula requirements:
    T=ij%FrameL*1/Samplerate;
    Wherein, the PCM sample that the T represents first wave crest in the sine wave of second amplitude reaches the shift time of recording thread time relative to the audio data frame belonged to;The ijRepresent the sample number of the PCM sample of first wave crest in the sine wave of second amplitude;The FrameL represents the length of audio data frame, and the % represents complementation, and the Samplerate represents the frequency that the equipment carries out PCM sampling to the sine wave of second amplitude.
  15. A kind of computer readable storage medium, which is characterized in that including instruction, when run on a computer, so that computer executes method as claimed in any one of claims 1 to 7.
CN201780009092.1A 2016-12-30 2017-04-27 Method and equipment for testing time delay of audio loop Active CN108702568B (en)

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
CN201611264801 2016-12-30
CN201611264801.4 2016-12-30
PCT/CN2017/082238 WO2018120545A1 (en) 2016-12-30 2017-04-27 Method and device for testing latency of audio loop

Publications (2)

Publication Number Publication Date
CN108702568A true CN108702568A (en) 2018-10-23
CN108702568B CN108702568B (en) 2020-04-21

Family

ID=62707668

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201780009092.1A Active CN108702568B (en) 2016-12-30 2017-04-27 Method and equipment for testing time delay of audio loop

Country Status (2)

Country Link
CN (1) CN108702568B (en)
WO (1) WO2018120545A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110931053A (en) * 2019-12-09 2020-03-27 广州酷狗计算机科技有限公司 Method, device, terminal and storage medium for detecting recording time delay and recording audio
CN113381899A (en) * 2020-02-25 2021-09-10 福建天泉教育科技有限公司 Method and system for testing first sound delay in screen projection technology
CN113688656A (en) * 2020-05-19 2021-11-23 福建天泉教育科技有限公司 Method and system for testing sound delay in screen projection software

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111381954A (en) * 2018-12-27 2020-07-07 深圳市优必选科技有限公司 Audio data recording method, system and terminal equipment
CN112073879B (en) * 2020-09-11 2022-04-29 成都极米科技股份有限公司 Audio synchronous playing method and device, video playing equipment and readable storage medium
CN113593570A (en) * 2021-07-28 2021-11-02 深圳创维-Rgb电子有限公司 Voice abnormity diagnosis method, device, equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6432600A (en) * 1987-07-28 1989-02-02 Hitachi Ltd Acoustic simulator
CN101448186A (en) * 2007-11-26 2009-06-03 鸿富锦精密工业(深圳)有限公司 System and method for automatic regulating sound effect of a loudspeaker
CN101606193A (en) * 2007-02-12 2009-12-16 三星电子株式会社 Audio coding and decoding apparatus and method
CN102568494A (en) * 2012-02-23 2012-07-11 贵阳朗玛信息技术股份有限公司 Optimized method, device and system for eliminating echo
CN104394286A (en) * 2014-08-27 2015-03-04 贵阳朗玛信息技术股份有限公司 Echo cancellation method and device
CN205566643U (en) * 2016-04-28 2016-09-07 湖南工业大学 Audio frequency winding automatic test system
CN106210371A (en) * 2016-08-31 2016-12-07 广州视源电子科技股份有限公司 A kind of determination method of echo delay time, device and intelligent meeting equipment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6970568B1 (en) * 1999-09-27 2005-11-29 Electronic Engineering And Manufacturing Inc. Apparatus and method for analyzing an electro-acoustic system
JP4285469B2 (en) * 2005-10-18 2009-06-24 ソニー株式会社 Measuring device, measuring method, audio signal processing device
CN102325059B (en) * 2011-09-09 2013-11-13 华南理工大学 Audio frequency end-to-end time delay measurement method of non-intrusive single end acquisition and apparatus thereof
CN104778950B (en) * 2014-01-15 2018-03-27 华平信息技术股份有限公司 A kind of microphone signal delay compensation control method based on echo cancellor

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6432600A (en) * 1987-07-28 1989-02-02 Hitachi Ltd Acoustic simulator
CN101606193A (en) * 2007-02-12 2009-12-16 三星电子株式会社 Audio coding and decoding apparatus and method
CN101448186A (en) * 2007-11-26 2009-06-03 鸿富锦精密工业(深圳)有限公司 System and method for automatic regulating sound effect of a loudspeaker
CN102568494A (en) * 2012-02-23 2012-07-11 贵阳朗玛信息技术股份有限公司 Optimized method, device and system for eliminating echo
CN104394286A (en) * 2014-08-27 2015-03-04 贵阳朗玛信息技术股份有限公司 Echo cancellation method and device
CN205566643U (en) * 2016-04-28 2016-09-07 湖南工业大学 Audio frequency winding automatic test system
CN106210371A (en) * 2016-08-31 2016-12-07 广州视源电子科技股份有限公司 A kind of determination method of echo delay time, device and intelligent meeting equipment

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110931053A (en) * 2019-12-09 2020-03-27 广州酷狗计算机科技有限公司 Method, device, terminal and storage medium for detecting recording time delay and recording audio
CN113381899A (en) * 2020-02-25 2021-09-10 福建天泉教育科技有限公司 Method and system for testing first sound delay in screen projection technology
CN113381899B (en) * 2020-02-25 2023-09-22 福建天泉教育科技有限公司 Method and system for testing first acoustic delay in screen throwing technology
CN113688656A (en) * 2020-05-19 2021-11-23 福建天泉教育科技有限公司 Method and system for testing sound delay in screen projection software

Also Published As

Publication number Publication date
WO2018120545A1 (en) 2018-07-05
CN108702568B (en) 2020-04-21

Similar Documents

Publication Publication Date Title
CN108702568A (en) A kind of method and apparatus of testing audio circuit time delay
CN105872253B (en) Live broadcast sound processing method and mobile terminal
CN108462895A (en) Sound effect treatment method, device and machine readable media
KR102084979B1 (en) Audio file rerecording method, device and storage media
CN102348150A (en) Audio signal processing apparatus, audio signal processing method, and program
CN103366784A (en) Multimedia playing method and device with function of voice controlling and humming searching
CN110390925A (en) Voice and accompaniment synchronous method, terminal, bluetooth equipment and storage medium
WO2023125169A1 (en) Audio processing method and apparatus, device, and storage medium
CN105632542B (en) Audio frequency playing method and device
WO2020024962A1 (en) Method and apparatus for processing data
CN109510636A (en) Receive test method, device, medium and the equipment of FM signal function
CN110083328A (en) A kind of audio frequency playing method, device, electronic equipment and storage medium
US20240054157A1 (en) Song recommendation method and apparatus, electronic device, and storage medium
WO2020024949A1 (en) Method and apparatus for determining timestamp
WO2006062313A1 (en) Apparatus and method for synchronizing audio with video
CN102655013A (en) Receiving device, transmitting device, receiving method, transmitting method, and communication system
CN109243472A (en) A kind of audio-frequency processing method and audio processing system
CN113726600B (en) Transmission delay determining method, device, terminal and storage medium
US20150249731A1 (en) Method, Mobile Terminal And System For Processing Sound Signal
CN103354579A (en) Method and system for DTMF (dual tone multifrequency) decoding based on recording synchronization
WO2015012892A2 (en) Persistent instrument configured to remind a user that a practice session is scheduled
CN108028055A (en) Information processor, information processing system and program
CN102867514A (en) Sound mixing method and sound mixing apparatus
CN109698976A (en) Fast forwarding and fast rewinding playback method, device and player based on audio feature extraction
KR102431737B1 (en) Method of searching highlight in multimedia data and apparatus therof

Legal Events

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