CN112752199B - 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 PDF

Info

Publication number
CN112752199B
CN112752199B CN201911053715.2A CN201911053715A CN112752199B CN 112752199 B CN112752199 B CN 112752199B CN 201911053715 A CN201911053715 A CN 201911053715A CN 112752199 B CN112752199 B CN 112752199B
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.)
Active
Application number
CN201911053715.2A
Other languages
Chinese (zh)
Other versions
CN112752199A (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.)
CRSC Communication and Information Group Shanghai Co Ltd
Original Assignee
CRSC Communication and Information Group Shanghai 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 CRSC Communication and Information Group Shanghai Co Ltd filed Critical CRSC Communication and Information Group Shanghai Co Ltd
Priority to CN201911053715.2A priority Critical patent/CN112752199B/en
Publication of CN112752199A publication Critical patent/CN112752199A/en
Application granted granted Critical
Publication of CN112752199B publication Critical patent/CN112752199B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R5/00Stereophonic arrangements
    • H04R5/04Circuit 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R2205/00Details of stereophonic arrangements covered by H04R5/00 but not provided for in any of its subgroups
    • H04R2205/026Single (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

Sound card left and right sound channel independent control device and method based on ALSA framework
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 single-channel audio or two-channel 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;
and 2, step: opening a sound card in an ALSA frame in a mode of sound mixing and double 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 real-time audio decoded in step 5 is PCM format, a-law PCM format or 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 0x00; and when the real-time audio is in an A-law PCM format or a U-law PCM format, the mute code stream is 0x80.
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 a real-time audio channel played in the two-channel audio is reserved, and the other channel is filled with mute data, so that a single-channel audio is obtained.
Compared with the prior art, the invention has the following advantages:
1. the equipment requirements of the single sound card are 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.
2. 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.
3. 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. the system comprises an audio acquisition module, 2, an ALSA frame, 3, an audio processing module, 4, a sound channel processing module and 5 and a 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 device 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, the sound mixing mode can enable the problem of data combination not to be considered when a plurality of audio sources are played simultaneously, and the sound mixing effect can be achieved only by playing in respective modes; 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 3, 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 0x00; when the real-time audio is in an A-law PCM format or a U-law PCM format, the mute code stream is 0x80. 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 the 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);
the audio acquisition module (1) acquires audio data to be played, and then the sound card (5) is opened in the ALSA framework (2) in a mode of sound mixing and dual-channel;
if the audio processing module (3) judges that the type of the acquired audio is a warning tone, reading the wave file, filling the warning tone playing sound channel with the warning tone data by the sound channel processing module (4), and filling mute data in the other sound channel;
if the audio processing module (3) judges that the type of the acquired audio is not a prompt tone, the audio processing module (3) decodes the real-time audio and then judges whether the audio is a dual-channel audio;
if the audio is a dual-channel audio, the audio processing module (3) adjusts the real-time audio into a single-channel audio, and then judges whether the real-time audio needs to be output in the left channel and the right channel simultaneously;
if the audio is a single-channel audio, directly judging whether the audio needs to be simultaneously output in the left and right channels;
if the audio needs to be output in the left channel and the right channel simultaneously, the single-channel audio data is filled into the two channels, otherwise, the single-channel audio data is filled into the real-time audio playing channel, and the mute data is filled in the other channel.
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 3, 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 tone data into a cue tone playing sound channel by a sound channel processing module (4), filling mute data into the other sound channel, and then ending the cycle;
and 5: the audio processing module (3) decodes the real-time audio, judges whether the real-time audio is a dual-channel audio, 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 real-time audio decoded in the step 5 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 sound 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 0x00; and when the real-time audio is in an A-law PCM format or a U-law PCM format, the mute code stream is 0x80.
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.
CN201911053715.2A 2019-10-31 2019-10-31 Sound card left and right sound channel independent control device and method based on ALSA framework Active CN112752199B (en)

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 CN112752199A (en) 2021-05-04
CN112752199B true 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 (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103258548A (en) * 2012-02-15 2013-08-21 富泰华工业(深圳)有限公司 Audio playing device and its controlling method
CN108182947A (en) * 2016-12-08 2018-06-19 武汉斗鱼网络科技有限公司 A kind of sound channel mixed processing method and device

Family Cites Families (8)

* Cited by examiner, † Cited by third party
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
CN105072299B (en) * 2015-08-07 2017-12-26 河北远东通信系统工程有限公司 A kind of method that two-way call is realized using monophone 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
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

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103258548A (en) * 2012-02-15 2013-08-21 富泰华工业(深圳)有限公司 Audio playing device and its controlling method
CN108182947A (en) * 2016-12-08 2018-06-19 武汉斗鱼网络科技有限公司 A kind of sound channel mixed processing method and device

Also Published As

Publication number Publication date
CN112752199A (en) 2021-05-04

Similar Documents

Publication Publication Date Title
JP3186472U (en) Audio decoder using program information metadata
CN109246672B (en) Data transmission method, device and system and Bluetooth headset
KR101276849B1 (en) Method and apparatus for processing an audio signal
CN110832579A (en) Last mile equalization
JP2009500976A (en) Spatial mechanism for conference calls
CN109003617A (en) System and method for optimizing loudness and dynamic range between different playback apparatus
JPWO2005081229A1 (en) Audio encoder and audio decoder
EP1609335A2 (en) Coding of main and side signal representing a multichannel signal
CN113689864B (en) Audio data processing method and device and storage medium
CN103312425A (en) Wireless broadcasting system
WO2021022087A1 (en) Encoding and decoding ivas bitstreams
CN112767955B (en) Audio encoding method and device, storage medium and electronic equipment
CN104113384A (en) Main control system of vehicle-mounted broadcasting equipment
CN102216983A (en) Apparatus and method for encoding at least one parameter associated with a signal source
CN101202042A (en) Expandable digital audio encoding frame and expansion method thereof
US8271291B2 (en) Method and an apparatus for identifying frame type
CN112752199B (en) Sound card left and right sound channel independent control device and method based on ALSA framework
DK1389372T3 (en) TESTING LEAVES FOR CHANNEL CODECS
KR20120072254A (en) Apparatus for processing a multi-channel audio signal and method thereof
CN204669587U (en) Audio processing equipment and Baffle Box of Bluetooth
CN110473558A (en) A kind of real-time multi-functional codec of 450M locomotive station unit
CN106412767B (en) Sound mixing method and sound mixing circuit
CN101361276B (en) Method and apparatus for processing an audio signal
WO2023031498A1 (en) Silence descriptor using spatial parameters
CN203588677U (en) Wireless audio adapter and audio playing 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