ALSA and OSS sound systems [Turn]

Source: Internet
Author: User
Tags emit
Yesterday, the new installation of MPlayer and SMPlayer, encountered a strange phenomenon, I was first on the Web page with songs to listen to, and then use SMPlayer film, always no sound, toss for a long time, and finally turn off the song page, incredibly good. As long as the music first, then the film, there is no sound. This is the idea of a sound card exclusive issue. Then the Internet search for a moment, the following is found a blog, very not good, reproduced over.

Original Blog Address: http://hi.baidu.com/%D1%FD%BE%AB%D6%AE%D3%F2/blog/item/9b86b581877667d0bc3e1eda.html
Yesterday playing music and movies, found a strange phenomenon, my realplayer and mplayer can not play the movie at the same time, the back of the play must be no sound, but there is video output; there is also a phenomenon that yoyoplayer and audacious two players can't play music at the same time. , the back start must not play, even if the progress bar backwards, but the sound is not, two phenomena also reflects a problem: the problem of sound output.
Baidu search the next, looked at the following introduction:
OSS (Open Sound System)The implication of OSS is that Open Sound System is a unified audio interface on UNIX platforms. Previously, each UNIX vendor provided a proprietary API for processing audio. This means that an audio processing application written for a UNIX platform must be rewritten when porting to another UNIX platform. Not only that, the functionality that is available on one platform may not be implemented on another. However, after the advent of OSS, the situation is very different, as long as the audio processing application is written according to OSS APIs, it is only necessary to recompile when porting to another platform. As a result, OSS provides a source-code-level portability.
At the same time, many UNIX workstations can only provide recording and playback functions. With OSS, the MIDI features of these workstations, along with audio streaming, speech recognition/generation, computer telephony (CT), Java, and other multimedia technologies, can also enjoy the same audio world as Windows and Macintosh environments in UNIX workstations. In addition, OSS provides audio capabilities that are synchronized with video and animation playback, which helps to implement animations and games in Unix.
This paper first explains the meanings of the nouns and equipment files that are frequently encountered in audio programming, and then introduces the usage of OSS interface in recording, playback and mixer respectively.
Digital Audio Devices (sometimes called CODEC,PCM,DSP,ADC/DAC devices): Play or record a digitized sound. Its main indicators are: sampling rate (telephone for 8k,dvd 96K), channel number (mono, stereo), sampling resolution (8-bit,16-bit).
Mixer (mixer): Used to control the volume of multiple inputs, outputs, and also control the switching between inputs (MICROPHONE,LINE-IN,CD).
Synthesizer (synthesizer): The use of some predefined waveform to synthesize sound, sometimes used in the game to produce sound effects.
MIDI Interface: MIDI interface is to connect the stage synthesizer, keyboard, props, lighting controller of a serial interface.
In a UNIX system, all devices are unified into files, accessing the device by accessing the file (first open, then Read/write, and then by using IOCTL read/set parameters, and finally close). In Oss, there are mainly the following types of device files:
*/dev/mixer: Access the built-in mixer in the sound card, adjust the volume size, select the sound source.
*/dev/sndstat: Test the sound card, perform cat/dev/sndstat will display the sound card driver information.
*/DEV/DSP,/DEV/DSPW,/dev/audio: Reading this device is equivalent to recording, writing this device is equivalent to playback. The difference between/DEV/DSP and/dev/audio is that the sampling encoding is different,/dev/audio uses the μ-law code,/DEV/DSP uses 8-bit (unsigned) linear encoding,/DEV/DSPW uses 16-bit (signed) linear encoding. /dev/audio is mainly for compatibility with SunOS, so try not to use it.
* L/dev/sequencer: Access the synthesizer that is built into the sound card or connected to a MIDI interface.
Related files for OSS in Linux:
Include/linux/sound.h
Sound/sound_core.c
OSS device node, character device, whose main device number is 14
0 =/dev/mixer Mixer control
1 =/dev/sequencer Audio Sequencer
2 =/dev/midi00-A-i-MIDI port
3 =/DEV/DSP Digital Audio
4 =/dev/audio Sun-compatible Digital Audio
6 =/dev/sndstat Sound card status information {2.6}
7 =/dev/audioctl SPARC Audio control device
8 =/dev/sequencer2 Sequencer--Alternate device
=/dev/mixer1 Second soundcard mixer Control
/DEV/PATMGR0 Sequencer Patch Manager
/DEV/MIDI01 Second MIDI Port
=/DEV/DSP1 Second soundcard Digital Audio
/dev/audio1 Second soundcard Sun Digital Audio
/DEV/PATMGR1 = Sequencer Patch Manager
/dev/midi02 = Third MIDI port
=/dev/midi03 Fourth MIDI port

ALSAALSA (abbreviated for Advanced Linux Sound architecture) is a driver-driven Linux kernel component for sound cards to replace the original OSS (open sound system). Part of the purpose is to support the automatic configuration of sound cards, and Perfect handling of multiple sound devices in the system, most of these goals have been achieved. Another sound frame Jack uses ALSA to provide low latency professional-level audio editing and mixing capabilities.
Jaroslav Kysela used to be the leader of the project, which began as a driver developed for the 1998 Gravis Ultrasound, which has been developed as a separate package until 2002 when he was introduced into the Linux kernel development version ( 2.5.4-2.5.5) 1. Starting with version 2.6, ALSA becomes the default standard audio driver set in the Linux kernel, and OSS is marked as obsolete.
ALSA is a fully open source audio driver Assembly, in addition to providing a set of kernel driver modules like OSS, ALSA provides a library of functions specifically for simplifying application authoring, compared to the IOCTL based native programming interfaces provided by OSS, The ALSA function library is more convenient to use. With this function library, developers can easily and quickly develop their own applications, the details are left to the function library internal processing. Of course, ALSA also provides a system interface similar to OSS, but ALSA developers recommend that application developers use the Audio function library instead of the driver API.
Key files for Alsa in Linux:
Include/sound/driver.h
Sound/core/*.c
Note: OSS (Open Sound System) is another driver framework for audio in Linux.

here are some of my understandings:

ALSA (Advanced Linux Sound System) and OSS (open Sound System). These two are software systems that emit the lowest level of sound in the system and can be considered (or even) driven.
Note the following points:

1, two sound systems can not drive the sound card at the same time
Two applications that are based on the two sound systems are not able to drive the sound card at the same time, so neither application can sound at the same time.
The RealPlayer can only be driven by the OSS sound system, while the MPlayer may choose Alsa and not emit sound at the same time; Ausacious is Alsa, and Yoyoplayer can not speak at the same time (I guess Yoyoplayer also goes to make voice by driving OSS)

2. OSS (open Sound System) does not support mixing
Said OSS has a sound card exclusive problem, and two OSS-based applications cannot drive the sound card at the same time.
My RealPlayer is the OSS sound system, and MPlayer can choose OSS and not sound at the same time; RealPlayer and Yoyoplayer cannot speak at the same time.

3, ALSA (Advanced Linux Sound System) support mix, with sound card sharing characteristics

Two ALSA based applications can drive a sound card at the same time, that is, the sound can be issued at the same time, need to install LIBALSA.
Audacious and the choice of Alsa MPlayer can be simultaneously audible,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.