CN110196707B - Method, device, system and program product for collecting reference signals - Google Patents

Method, device, system and program product for collecting reference signals Download PDF

Info

Publication number
CN110196707B
CN110196707B CN201910330490.4A CN201910330490A CN110196707B CN 110196707 B CN110196707 B CN 110196707B CN 201910330490 A CN201910330490 A CN 201910330490A CN 110196707 B CN110196707 B CN 110196707B
Authority
CN
China
Prior art keywords
reference signal
sound card
acquiring
audio data
counting
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.)
Active
Application number
CN201910330490.4A
Other languages
Chinese (zh)
Other versions
CN110196707A (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.)
Allwinner Technology Co Ltd
Original Assignee
Allwinner Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Allwinner Technology Co Ltd filed Critical Allwinner Technology Co Ltd
Priority to CN201910330490.4A priority Critical patent/CN110196707B/en
Publication of CN110196707A publication Critical patent/CN110196707A/en
Application granted granted Critical
Publication of CN110196707B publication Critical patent/CN110196707B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/16Sound input; Sound output
    • G06F3/162Interface to dedicated audio devices, e.g. audio drivers, interface to CODECs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a method for acquiring a reference signal, which is used in a Linux platform and comprises the following steps: s1, a virtual sound card in an ALSA frame of a Linux kernel is used for picking back and forth a played signal to be used as a reference signal; s2, collecting voice signals through an actual hardware sound card; s3, the first audio data of the reference signal and the second audio data acquired by the voice signal are synchronized through counting. The invention also discloses a device, a system and a program product for collecting the reference signals. The method, the device, the system and the program product for acquiring the reference signals in the technical scheme realize the acquisition of the reference signals from software, save the hardware cost and are convenient for maintenance and transplantation.

Description

Method, device, system and program product for collecting reference signals
Technical Field
The present invention relates to the field of linux kernels, and in particular, to a method, an apparatus, a system, and a program product for acquiring a reference signal.
Background
Linux is a freely used and freely spread Unix-like operating system, and is a multi-user, multi-tasking, multi-thread and multi-CPU-supporting operating system based on POSIX and Unix. It can run major UNIX tools, applications and network protocols. It supports 32-bit and 64-bit hardware. Linux inherits the design idea of Unix with a network as a core, and is a multi-user network operation system with stable performance.
In products including a voice interaction function, an echo cancellation system is almost indispensable for canceling a sound portion played by a speaker itself included in a collected voice signal. Besides the common voice signal, the reference signal of the self playing sound is needed to be input to the echo cancellation algorithm, and the acquisition of the reference signal on the Linux platform in the market at present mainly comprises the following two modes:
The first way is: acquiring reference signals by using an additional hardware module;
the second way is: the audio data to be played back by itself is saved in a single application as a reference signal for extraction.
The first way increases hardware cost; the second method is to extract the reference signal from the software only in a single application program, which can not be directly used in the scene of a plurality of application programs, and the application developer needs to make additional modification to the application code, thus being inconvenient for maintenance and migration.
Disclosure of Invention
In order to solve the above problems, the present invention provides a method, apparatus, system and program product for acquiring reference signals, which saves hardware cost and facilitates maintenance and migration.
The invention discloses a method for collecting reference signals, which is used in a Linux platform and comprises the following steps:
S1, a virtual sound card in an ALSA frame of a Linux kernel is used for picking back and forth a played signal to be used as a reference signal;
S2, collecting voice signals through an actual hardware sound card;
s3, the first audio data of the reference signal and the second audio data acquired by the voice signal are synchronized through counting.
Further, step S0 is further provided before step S1, and a plurality of application programs are played simultaneously, so that the audio data is automatically sent to the virtual sound card at the system layer while being played through the standard plug-in of ALSA.
Further, in step S3, counting is performed by a nanosecond timer.
Further, in step S3, counting is implemented by the data register of the actual hardware sound card.
The invention discloses a device for collecting reference signals, which is used in a Linux platform and comprises the following components:
the reference signal acquisition unit is used for acquiring played signals back and forth by using a virtual sound card in the Linux kernel ALSA frame as a reference signal;
The voice signal acquisition unit is used for acquiring voice signals through an actual hardware sound card;
And the synchronization unit is used for realizing synchronization of the first audio data of the reference signal and the second audio data acquired by the voice signal through counting.
Furthermore, the reference signal acquisition unit is also provided with a sound mixing unit before, which is used for simultaneously playing a plurality of application programs, and the audio data is automatically sent to the virtual sound card when being played at the system layer through the standard plug-in of ALSA.
Further, in the synchronization unit, counting is realized through a nanosecond timer.
Further, in the synchronization unit, counting is implemented through a data register of the actual hardware sound card.
The invention discloses a system for collecting reference signals, which comprises a Linux kernel, wherein the Linux kernel is provided with the device.
The invention discloses a program product for collecting reference signals, which is used in a Linux kernel and is provided with computer program codes for the steps in the method.
The method, the device, the system and the program product for acquiring the reference signal have the following beneficial technical effects:
The use of additional hardware modules to collect reference signals, as distinguished from the prior art, increases hardware costs; the method, the device, the system and the program product for acquiring the reference signals realize the acquisition of the reference signals from the software, thereby saving the hardware cost; the reference signals are acquired from the system level, and an upper application program does not need to pay attention to the actual mode of acquiring the reference signals and the behaviors of other application programs, so that the maintenance and the transplanting of an application developer are facilitated.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are only some embodiments of the invention, and that other drawings can be obtained according to these drawings without inventive faculty for a person skilled in the art.
FIG. 1 is a flow chart of a method for acquiring reference signals according to an embodiment of the present invention;
FIG. 2 is a block diagram of an overall system for acquiring reference signals according to an embodiment of the present invention;
FIG. 3 is a block diagram of an apparatus for acquiring reference signals according to an embodiment of the present invention;
Fig. 4 is a block diagram of a system for acquiring reference signals according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, in an embodiment, a method for acquiring a reference signal is used in a Linux platform, and includes:
S1, a virtual sound card (Loopback: local loop back interface, also called loop back address) in an ALSA frame of a Linux kernel is used for picking back and forth a played signal to be used as a reference signal;
S2, collecting voice signals through an actual hardware sound card;
s3, the first audio data of the reference signal and the second audio data acquired by the voice signal are synchronized through counting.
In the technical scheme, a data carrying mode Loopback is changed, so that the method depends on a high-precision timer or a data register of an actual hardware sound card (used for voice signal acquisition) to count, and the synchronization between a voice signal and a reference signal is ensured;
Through the standard plug-in of ALSA, the audio data is automatically sent to Loopback sound cards (as reference signals) while being played at the system layer, and an interface is provided for a recording program to acquire the reference signals; on the other hand, by means of ALSAplug-in mechanism, it is ensured that the voice signal and the reference signal can still be aligned even if there is data loss in the recording process.
Referring to fig. 2, (1) allows multiple applications to play simultaneously, and mixing is implemented at the system level through ALSAplug-in. From the perspective of the individual playback applications, they can only see the single audio device provided by plug-in, and as long as the data is sent in, the rest of the mixing and playback operations will be automatically implemented by the system, transparent to them.
The data fed to the Loopback virtual sound card from (2) can be read out entirely from (3), and a standard ALSA device interface is provided at (3), allowing the upper layer application to read the data directly from it.
The Loopback of ALSA (analog to digital) is used for carrying data depending on the timing of a system timer, and the system timer in an embedded platform generally has the accuracy of only 10ms and is difficult to meet the requirement of a general echo cancellation algorithm on the synchronism of a voice signal and a reference signal; the technical scheme adds two timing methods for this purpose: the use of a high precision timer (theoretical precision can be ns, actual precision is due to the hardware platform), or (4) the counting of data registers dependent on the hardware ADC, as shown at (4), to better guarantee the synchronization of the speech signal with the reference signal.
(5) The Loopback sound card device (for collecting the reference signal) and the hardware sound card device (for collecting the voice signal) are combined into a single audio device interface by using ALSAplug-in, so that the upper layer application can collect the voice signal and the reference signal simultaneously from the single audio device without paying attention to redundant implementation details. In addition, if data loss occurs in the acquisition process, the method can also ensure that the subsequent voice signal is aligned with the reference signal, and avoid the failure of an echo cancellation algorithm.
Step S0 is also provided before step S1, a plurality of application programs are played simultaneously, and the audio data is automatically sent to the virtual sound card at the system layer through the standard plug-in of ALSA.
In summary, the echo cancellation algorithm requires two signal inputs: the patent provides a method for acquiring reference signals from software in a system layer in a Linux platform, which can save hardware resources for acquiring the reference signals.
The traditional method for collecting the reference signals from the hardware is used for collecting the reference signals from the software, the collection modes are different, and the hardware cost is saved.
The patent is based on Loopback virtual equipment of Linux platform ALSA frame and realizes that the echo cancellation module of this patent is located the application layer of Linux system, is an application program, and the integration of third party echo cancellation algorithm is more convenient to the application layer echo cancellation module that this patent used.
The apparatus for realizing the above method will be described below, and in the parts not described in the apparatus, reference is made to the description of the above method.
Referring to fig. 3, in an embodiment, an apparatus 1 for acquiring a reference signal is used in a Linux platform, and includes:
the reference signal acquisition unit 10 is configured to use a virtual sound card in the Linux kernel ALSA framework to acquire a played signal as a reference signal;
a voice signal acquisition unit 20 for acquiring a voice signal through an actual hardware sound card;
the synchronization unit 30 is configured to synchronize the first audio data of the reference signal with the second audio data collected by the voice signal by counting.
Preferably, the reference signal acquisition unit is further provided with a mixing unit 5 before, for playing a plurality of application programs simultaneously, and the audio data is automatically sent to the virtual sound card at the system layer while being played through the standard plug-in of the ALSA.
In the synchronization unit 30, counting is achieved by a nanosecond timer.
In the synchronization unit 30, the counting is implemented by means of the data register of the actual hardware sound card.
Referring to fig. 4, a system 100 for acquiring reference signals includes a Linux kernel having the apparatus 1 described above.
In an embodiment, a program product for acquiring a reference signal is used in a Linux kernel, the program product having computer program code for the steps of fig. 1.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made to the embodiments of the present invention without departing from the spirit or scope of the embodiments of the invention. Thus, if such modifications and variations of the embodiments of the present invention fall within the scope of the claims and the equivalents thereof, the present invention is also intended to include such modifications and variations.

Claims (8)

1. A method for acquiring a reference signal, for use in a Linux platform, comprising:
S1, a virtual sound card in an ALSA frame of a Linux kernel is used for picking back and forth a played signal to be used as a reference signal;
S2, collecting voice signals through an actual hardware sound card;
S3, the first audio data of the reference signal and the second audio data acquired by the voice signal are synchronized through counting;
step S0 is also provided before step S1, a plurality of application programs are played simultaneously, and the audio data is automatically sent to the virtual sound card at the system layer through the standard plug-in of ALSA.
2. The method according to claim 1, characterized in that in step S3, the counting is effected by means of a nanosecond timer.
3. The method according to claim 1, wherein in step S3, the counting is performed by means of a data register of said actual hardware sound card.
4. A device for acquiring a reference signal, which is used in a Linux platform, and is characterized by comprising:
the reference signal acquisition unit is used for acquiring played signals back and forth by using a virtual sound card in the Linux kernel ALSA frame as a reference signal;
The voice signal acquisition unit is used for acquiring voice signals through an actual hardware sound card;
the synchronization unit is used for realizing synchronization between the first audio data of the reference signal and the second audio data acquired by the voice signal through counting;
The reference signal acquisition unit is also provided with a sound mixing unit before, and is used for simultaneously playing a plurality of application programs, and audio data is automatically sent to the virtual sound card when being played at a system layer through the standard plug-in of ALSA.
5. The apparatus of claim 4, wherein the synchronization unit performs the counting by a nanosecond timer.
6. The apparatus of claim 4, wherein said synchronization unit counts by a data register of said physical hardware sound card.
7. A system for acquiring reference signals, comprising a Linux kernel, characterized in that the Linux kernel has the apparatus as claimed in any of claims 4 to 6.
8. A program product for acquiring a reference signal for use in a Linux kernel, said program product having computer program code for performing the steps of any of claims 1 to 3.
CN201910330490.4A 2019-04-23 2019-04-23 Method, device, system and program product for collecting reference signals Active CN110196707B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910330490.4A CN110196707B (en) 2019-04-23 2019-04-23 Method, device, system and program product for collecting reference signals

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910330490.4A CN110196707B (en) 2019-04-23 2019-04-23 Method, device, system and program product for collecting reference signals

Publications (2)

Publication Number Publication Date
CN110196707A CN110196707A (en) 2019-09-03
CN110196707B true CN110196707B (en) 2024-07-09

Family

ID=67752009

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910330490.4A Active CN110196707B (en) 2019-04-23 2019-04-23 Method, device, system and program product for collecting reference signals

Country Status (1)

Country Link
CN (1) CN110196707B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112579038B (en) * 2020-12-24 2023-05-23 上海商米科技集团股份有限公司 Built-in recording method and device, electronic equipment and storage medium
CN113990354B (en) * 2021-12-29 2022-06-17 北京鲸鲮信息系统技术有限公司 Audio control method, device, equipment and storage medium based on Linux

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101599285A (en) * 2009-07-02 2009-12-09 深圳市万兴软件有限公司 A kind of audio recording method and system
CN104010100A (en) * 2014-05-08 2014-08-27 深圳市汇川技术股份有限公司 Cancellation system and method for echo in VoIP communication
CN105323534A (en) * 2014-07-14 2016-02-10 深圳市潮流网络技术有限公司 Conference processing method of third party application and communication equipment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1291308C (en) * 2005-04-08 2006-12-20 北京中星微电子有限公司 Method for eliminating echo
CN101464787A (en) * 2008-07-18 2009-06-24 深圳市中兴移动通信有限公司 Implementing voice input/output system between built-in end and computer based on Linux operating system
CN102625006B (en) * 2011-01-31 2013-12-04 陈剑勇 Method and system for synchronization and alignment of echo cancellation data and audio communication equipment
CN107592430B (en) * 2016-07-07 2020-08-28 腾讯科技(深圳)有限公司 Echo cancellation method and terminal equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101599285A (en) * 2009-07-02 2009-12-09 深圳市万兴软件有限公司 A kind of audio recording method and system
CN104010100A (en) * 2014-05-08 2014-08-27 深圳市汇川技术股份有限公司 Cancellation system and method for echo in VoIP communication
CN105323534A (en) * 2014-07-14 2016-02-10 深圳市潮流网络技术有限公司 Conference processing method of third party application and communication equipment

Also Published As

Publication number Publication date
CN110196707A (en) 2019-09-03

Similar Documents

Publication Publication Date Title
CN110196707B (en) Method, device, system and program product for collecting reference signals
FR2594242A1 (en) METHOD AND APPARATUS FOR DIRECT ACCESS IN MEMORY
US20150269054A1 (en) Multiple Core Execution Trace Buffer
CN110138662B (en) Session table item processing method and device in multi-core system and multi-core system
CN106559706A (en) A kind of processing method of voice data, device and system
CN110234029B (en) Playing processing method, device, equipment and storage medium of multi-sensor data
WO2017080241A1 (en) Time-lapse photographing method and device
CN111182251B (en) Video backup method and device applied to online patrol synchronous transcoding and with hot-pluggable storage medium
CN106030532A (en) Software replayer for transactional memory programs
CN108573710A (en) A kind of method and device of real-time removal recording echo
US6427181B1 (en) Method of and apparatus for processing information, and providing medium
CN110569162B (en) Automatic testing method and device for FPGA in communication field
CN110354491A (en) The whole world is same to take game system, method of data synchronization, electronic equipment and medium
WO2024119930A1 (en) Scheduling method and apparatus, and computer device and storage medium
CN111290960B (en) Fluency detection method and device for application program, terminal and storage medium
CN103218251B (en) Verification method and the device of multiple nucleus system level chip
WO2018026452A1 (en) System and method for distributing and replaying trigger packets via a variable latency bus interconnect
CN104793917B (en) A kind of method of real-time acquisition Cocos2d x game play sound
CN109448738B (en) Network audio mixing processing method and device
CN111949512A (en) Application program jamming detection method and device, terminal and medium
CN110543416A (en) Method, device, equipment and storage medium for automatically testing terminal program
CN114071127A (en) Live video delay testing method and device, storage medium and electronic equipment
CN110391952B (en) Performance analysis method, device and equipment
CN106371992B (en) Browser error detection method and error detector element
CN111026810A (en) Data synchronization method, device and storage medium

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