CN112752199A - Sound card left and right sound channel independent control device and method based on ALSA framework - Google Patents
Sound card left and right sound channel independent control device and method based on ALSA framework Download PDFInfo
- Publication number
- CN112752199A CN112752199A CN201911053715.2A CN201911053715A CN112752199A CN 112752199 A CN112752199 A CN 112752199A CN 201911053715 A CN201911053715 A CN 201911053715A CN 112752199 A CN112752199 A CN 112752199A
- Authority
- CN
- China
- Prior art keywords
- audio
- channel
- sound
- alsa
- processing module
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04R—LOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
- H04R5/00—Stereophonic arrangements
- H04R5/04—Circuit arrangements, e.g. for selective connection of amplifier inputs/outputs to loudspeakers, for loudspeaker detection, or for adaptation of settings to personal preferences or hearing impairments
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04R—LOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
- H04R2205/00—Details of stereophonic arrangements covered by H04R5/00 but not provided for in any of its subgroups
- H04R2205/026—Single (sub)woofer with two or more satellite loudspeakers for mid- and high-frequency band reproduction driven via the (sub)woofer
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Acoustics & Sound (AREA)
- Signal Processing (AREA)
- Stereophonic System (AREA)
Abstract
The invention relates to a sound card left and right sound channel independent control device and method based on an ALSA (equivalent thereto adaptive spatial analysis) framework. The sound card left and right sound channel independent control device based on the ALSA frame comprises the ALSA frame used for controlling the opening mode of the sound card, an audio acquisition module, an audio processing module and a sound channel processing module; the audio acquisition module, the ALSA frame, the audio processing module and the sound channel processing module are sequentially connected; the ALSA frame and the sound channel processing module are also respectively connected with the sound card. The ALSA frame-based sound card left and right channel independent control method is used for the control device to realize the independent control of the sound card left and right channels. Compared with the prior art, the method has the advantages of meeting the requirements of single sound card equipment, being simple and effective, saving storage space and network broadband and the like.
Description
Technical Field
The invention relates to the technical field of audio processing, in particular to a sound card left and right sound channel independent control device and method based on an ALSA (audio visual system) framework.
Background
At present, under the condition that two-path or multi-path voice control is needed, a mode of multiple sound cards is generally adopted for independent control. However, in the embedded platform, there is generally only one sound card, and the sound card is called in an exclusive manner. But it becomes more difficult if only two different outputs are required. On the operation terminal of the locomotive integrated wireless communication equipment CIR3.0, two independent control functions for sound are needed, one is only used for playing real-time voice stream, the other is used for playing prompt tone information and voice stream, and a device and a method which can automatically judge whether the audio is prompt tone or real-time audio and process the sound channel according to the audio type are not available in the prior art.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provide a simple and effective sound card left and right channel independent control device and method based on the ALSA framework, which meet the requirements of single sound card equipment.
The purpose of the invention can be realized by the following technical scheme:
a sound card left and right sound channel independent control device based on an ALSA frame is used for independently controlling left and right sound channels of a sound card and comprises the ALSA frame used for controlling the opening mode of the sound card, an audio acquisition module, an audio processing module used for judging the audio type and a sound channel processing module used for controlling the sound channels; the audio acquisition module, the ALSA frame, the audio processing module and the sound channel processing module are sequentially connected; the ALSA frame and the sound channel processing module are also respectively connected with the sound card.
Preferably, the audio types include alert tones and real-time audio.
Preferably, the prompt tone and the real-time audio are monaural audio or binaural audio.
Preferably, the channel processing module comprises a left channel processing unit and a right channel processing unit; the left sound channel processing unit is connected with a left sound channel of the sound card; and the right sound channel processing unit is connected with the right sound channel of the sound card.
A sound card left and right sound channel independent control method based on an ALSA frame comprises the following steps:
step 1: waiting for the audio acquisition module to acquire audio data to be played;
step 2: opening a sound card in an ALSA frame in a mode of mixing sound and two channels;
and step 3: the audio processing module judges whether the type of the audio collected by the audio collecting module is a prompt tone, if so, the step 4 is executed, otherwise, the step 5 is executed;
and 4, step 4: reading the wave file, filling cue sound data into a cue sound playing sound channel by a sound channel processing module, filling mute data into the other sound channel, and then ending the cycle;
and 5: the audio processing module decodes the real-time audio, judges whether the real-time audio is a dual-channel audio or not, if so, the audio processing module adjusts the real-time audio into a single-channel audio, and then executes the step 6, otherwise, directly executes the step 6;
step 6: and judging whether the real-time audio needs to be output in the left and right sound channels simultaneously, if so, filling the single-channel audio data into the two sound channels, otherwise, filling the single-channel audio data into the real-time audio playing channel, filling the mute data into the other sound channel, and then ending the circulation of the current round.
Preferably, the format of the intermediate real-time audio after decoding is a PCM format, an a-law PCM format or a U-law PCM format.
Preferably, the mute data is a mute code stream; when the real-time audio is in a PCM format, the mute code stream is 0x 00; when the real-time audio is in an A-law PCM format or a U-law PCM format, the mute code stream is 0x 80.
Preferably, the specific method for adjusting the real-time audio to the monaural audio by the audio processing module in the step 5 is as follows: and audio data of a channel corresponding to the real-time audio channel played in the two-channel audio is reserved, and the other channel is filled with mute data, so that single-channel audio is obtained.
Compared with the prior art, the invention has the following advantages:
firstly, the equipment requirement of a single sound card is met: the control device and the control method realize independent control of the left and right sound channels, do not need to add an additional sound card, meet the equipment requirement of a single sound card and reduce the hardware cost.
Secondly, the method is simple and effective: the control device and the method of the invention use the ALSA framework in the prior art to finish the sound mixing and the starting of the sound card in a dual-channel mode, do not need to consider the starting of the sound card through an algorithm, and are simple, quick and effective.
Thirdly, saving storage space and network broadband: the control device and the method support a single-channel audio input mode, and double-channel audio data are not needed to be adopted at a data source, so that the storage space and the network broadband are greatly saved.
Drawings
FIG. 1 is a schematic structural diagram of a control device according to the present invention;
FIG. 2 is a flow chart of a control method according to the present invention.
The reference numbers in the figures indicate:
1. audio acquisition module, 2, ALSA frame, 3, audio processing module, 4, sound channel processing module, 5, sound card.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, shall fall within the scope of protection of the present invention.
The invention provides a sound card left and right sound channel independent control device and method based on an ALSA (equivalent thereto adaptive clustering of distances) framework. As shown in fig. 1, the control apparatus includes an audio acquisition module 1, an existing ALSA framework 2, an audio processing module 3, and a channel processing module 4.
The audio acquisition module 1 can acquire prompt tones and real-time audio.
The ALSA frame 2 is used for opening the sound card in a sound mixing and dual-channel mode, and the sound mixing mode can achieve the sound mixing effect only by playing in respective modes without considering the problem of data combination when a plurality of audio sources are played simultaneously; the two-channel mode is adopted to facilitate the audio processing module 3 to process the audio data.
The audio processing module 3 can determine the type of the audio data, including the alert tone and the real-time audio, decode the real-time audio, and process the two-channel audio data into mono audio data.
The sound channel processing module 4 is configured to fill the audio data and the mute data into corresponding sound channels, and includes a left sound channel processing unit and a right sound channel processing unit, where the left sound channel processing unit is connected to a left sound channel of the sound card, and the right sound channel processing unit is connected to a right sound channel of the sound card.
As shown in fig. 2, the control method of the present invention includes the steps of:
step 1: waiting for the audio acquisition module 1 to acquire the audio data to be played;
step 2: opening the sound card 5 in the ALSA framework 2 in a mixed and binaural manner;
and step 3: the audio processing module 3 judges whether the type of the audio collected by the audio collecting module 1 is a prompt tone, if so, the step 4 is executed, otherwise, the step 5 is executed;
and 4, step 4: reading the wave file, filling the cue sound data into a cue sound playing sound channel by the sound channel processing module 4, filling the mute data into the other sound channel, and then ending the cycle;
and 5: the audio processing module 3 decodes the real-time audio, then judges whether the real-time audio is a dual-channel audio, if so, the audio processing module 3 adjusts the real-time audio to a single-channel audio, and then executes the step 6, otherwise, directly executes the step 6;
the specific method for the audio processing module 3 to adjust the real-time audio to the monaural audio is as follows: and audio data of a channel corresponding to the real-time audio channel played in the two-channel audio is reserved, and the other channel is filled with mute data, so that single-channel audio is obtained.
Step 6: and judging whether the real-time audio needs to be output in the left and right sound channels simultaneously, if so, filling the single-channel audio data into the two sound channels, otherwise, filling the single-channel audio data into the real-time audio playing channel, filling the mute data into the other sound channel, and then ending the circulation of the current round.
The format of the real-time audio after decoding is a PCM format, an A-law PCM format or a U-law PCM format, the mute data is a mute code stream, and when the real-time audio is the PCM format, the mute code stream is 0x 00; when the real-time audio is in an A-law PCM format or a U-law PCM format, the mute code stream is 0x 80. It should be noted here that the sampling bit of the sound is one byte to represent one small block if it is 8-bit sampling, and two bytes to represent one small block if it is 16-bit sampling.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (8)
1. A sound card left and right sound channel independent control device based on an ALSA frame is used for independently controlling left and right sound channels of a sound card (5) and comprises the ALSA frame (2) used for controlling the opening mode of the sound card (5), and is characterized by further comprising an audio acquisition module (1), an audio processing module (3) used for judging the audio type and a sound channel processing module (4) used for controlling the sound channels; the audio acquisition module (1), the ALSA frame (2), the audio processing module (3) and the sound channel processing module (4) are connected in sequence; the ALSA frame (2) and the sound channel processing module (4) are also respectively connected with a sound card (5).
2. The ALSA-framework-based left and right channel independent control device for the sound card according to claim 1, wherein the audio types comprise prompt tones and real-time audio.
3. The ALSA-framework-based left and right channel independent control device for the sound card according to claim 2, wherein the prompt tone and the real-time audio are single-channel audio or dual-channel audio.
4. The ALSA-framework-based sound card left-right channel independent control device according to claim 1, wherein the channel processing module (4) comprises a left channel processing unit and a right channel processing unit; the left sound channel processing unit is connected with a left sound channel of the sound card; and the right sound channel processing unit is connected with the right sound channel of the sound card.
5. An ALSA framework-based sound card left and right channel independent control method for the control device according to claim 1, wherein the control method comprises the following steps:
step 1: waiting for the audio acquisition module (1) to acquire audio data to be played;
step 2: opening a sound card (5) in the ALSA framework (2) in a mixing and binaural mode;
and step 3: the audio processing module (3) judges whether the type of the audio collected by the audio collecting module (1) is a prompt tone, if so, the step 4 is executed, otherwise, the step 5 is executed;
and 4, step 4: reading the wave file, filling cue sound data into a cue sound playing sound channel by a sound channel processing module (4), filling mute data into the other sound channel, and then ending the circulation of the round;
and 5: the audio processing module (3) decodes the real-time audio, then judges whether the real-time audio is a dual-channel audio or not, if so, the audio processing module (3) adjusts the real-time audio into a single-channel audio, and then executes the step 6, otherwise, directly executes the step 6;
step 6: and judging whether the real-time audio needs to be output in the left and right sound channels simultaneously, if so, filling the single-channel audio data into the two sound channels, otherwise, filling the single-channel audio data into the real-time audio playing channel, filling the mute data into the other sound channel, and then ending the circulation of the current round.
6. The ALSA framework-based sound card left and right channel independent control method according to claim 5, wherein the format of the intermediate real-time audio after decoding is a PCM format, an A-law PCM format or a U-law PCM format.
7. The ALSA frame-based sound card left and right channel independent control method according to claim 6, wherein the mute data is a mute code stream; when the real-time audio is in a PCM format, the mute code stream is 0x 00; when the real-time audio is in an A-law PCM format or a U-law PCM format, the mute code stream is 0x 80.
8. The ALSA framework-based sound card left and right channel independent control method according to claim 5, wherein the specific method for the audio processing module (3) to adjust the real-time audio to the monaural audio in step 5 is as follows: and audio data of a channel corresponding to the real-time audio channel played in the two-channel audio is reserved, and the other channel is filled with mute data, so that single-channel audio is obtained.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911053715.2A CN112752199B (en) | 2019-10-31 | 2019-10-31 | Sound card left and right sound channel independent control device and method based on ALSA framework |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911053715.2A CN112752199B (en) | 2019-10-31 | 2019-10-31 | Sound card left and right sound channel independent control device and method based on ALSA framework |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112752199A true CN112752199A (en) | 2021-05-04 |
CN112752199B CN112752199B (en) | 2022-11-04 |
Family
ID=75645591
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911053715.2A Active CN112752199B (en) | 2019-10-31 | 2019-10-31 | Sound card left and right sound channel independent control device and method based on ALSA framework |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112752199B (en) |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2002082790A1 (en) * | 2001-04-03 | 2002-10-17 | Porta Systems Corporation | Sound card based measurements for testing telephone lines |
CN101764655A (en) * | 2008-10-24 | 2010-06-30 | 杨林 | Multi-program source constant pressure broadcast system |
CN103258548A (en) * | 2012-02-15 | 2013-08-21 | 富泰华工业(深圳)有限公司 | Audio playing device and its controlling method |
CN105072299A (en) * | 2015-08-07 | 2015-11-18 | 河北远东通信系统工程有限公司 | Method for realizing two-path calls by utilizing single sound card |
CN205862318U (en) * | 2016-06-07 | 2017-01-04 | 深圳市航盛电子股份有限公司 | Many sound cards audio output device under a kind of embedded OS and system |
CN107135301A (en) * | 2016-02-29 | 2017-09-05 | 宇龙计算机通信科技(深圳)有限公司 | A kind of audio data processing method and device |
CN108182947A (en) * | 2016-12-08 | 2018-06-19 | 武汉斗鱼网络科技有限公司 | A kind of sound channel mixed processing method and device |
CN207968882U (en) * | 2018-02-09 | 2018-10-12 | 大连现代高技术集团有限公司 | A kind of vehicle termination equipment multi-path voice coupling switching device |
CN109817231A (en) * | 2017-11-21 | 2019-05-28 | 阿尔派株式会社 | Sound processing apparatus and sound processing method |
CN208987185U (en) * | 2018-11-29 | 2019-06-14 | 广州艾美网络科技有限公司 | Multichannel audio processing system and karaoke OK system |
-
2019
- 2019-10-31 CN CN201911053715.2A patent/CN112752199B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2002082790A1 (en) * | 2001-04-03 | 2002-10-17 | Porta Systems Corporation | Sound card based measurements for testing telephone lines |
CN101764655A (en) * | 2008-10-24 | 2010-06-30 | 杨林 | Multi-program source constant pressure broadcast system |
CN103258548A (en) * | 2012-02-15 | 2013-08-21 | 富泰华工业(深圳)有限公司 | Audio playing device and its controlling method |
CN105072299A (en) * | 2015-08-07 | 2015-11-18 | 河北远东通信系统工程有限公司 | Method for realizing two-path calls by utilizing single sound card |
CN107135301A (en) * | 2016-02-29 | 2017-09-05 | 宇龙计算机通信科技(深圳)有限公司 | A kind of audio data processing method and device |
CN205862318U (en) * | 2016-06-07 | 2017-01-04 | 深圳市航盛电子股份有限公司 | Many sound cards audio output device under a kind of embedded OS and system |
CN108182947A (en) * | 2016-12-08 | 2018-06-19 | 武汉斗鱼网络科技有限公司 | A kind of sound channel mixed processing method and device |
CN109817231A (en) * | 2017-11-21 | 2019-05-28 | 阿尔派株式会社 | Sound processing apparatus and sound processing method |
CN207968882U (en) * | 2018-02-09 | 2018-10-12 | 大连现代高技术集团有限公司 | A kind of vehicle termination equipment multi-path voice coupling switching device |
CN208987185U (en) * | 2018-11-29 | 2019-06-14 | 广州艾美网络科技有限公司 | Multichannel audio processing system and karaoke OK system |
Also Published As
Publication number | Publication date |
---|---|
CN112752199B (en) | 2022-11-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109246672B (en) | Data transmission method, device and system and Bluetooth headset | |
JP3186472U (en) | Audio decoder using program information metadata | |
US7724885B2 (en) | Spatialization arrangement for conference call | |
CN110832579A (en) | Last mile equalization | |
CN102932567B (en) | Terminal and audio processing method | |
CN107273086A (en) | Audio-frequency processing method and device based on navigation | |
CN108062212A (en) | A kind of voice operating method and device based on scene | |
CN113689864B (en) | Audio data processing method and device and storage medium | |
CN111128212A (en) | Mixed voice separation method and device | |
CN102216983A (en) | Apparatus and method for encoding at least one parameter associated with a signal source | |
CN104113384A (en) | Main control system of vehicle-mounted broadcasting equipment | |
CN112752199B (en) | Sound card left and right sound channel independent control device and method based on ALSA framework | |
CN104506932B (en) | A kind of audio transmission control system and control method | |
CN110473558A (en) | A kind of real-time multi-functional codec of 450M locomotive station unit | |
CN106412767B (en) | Sound mixing method and sound mixing circuit | |
WO2022012677A1 (en) | Audio encoding method, audio decoding method, related apparatus and computer-readable storage medium | |
CN101361276B (en) | Method and apparatus for processing an audio signal | |
CN107172521A (en) | A kind of bluetooth earphone and system for Real-time speech recognition | |
CN112216290A (en) | Audio data transmission method and device and playing equipment | |
CN110246495A (en) | Information processing method and electronic equipment | |
CN105979260B (en) | A kind of machine shake test fixture of audio output apparatus, system and method | |
CN114422282B (en) | Conference device, client and remote conference system | |
CN218332560U (en) | USB sound card signal transmission system | |
CN117714958B (en) | Audio detection method, system and related equipment | |
WO2023173941A1 (en) | Multi-channel signal encoding and decoding methods, encoding and decoding devices, and terminal device |
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 |