ALSA PCM sharing
Apollon Koutlides
apollon at planewalk.net
Wed May 19 15:40:52 EEST 2004
Nikos M. wrote:
> Πως μπορώ να κάνω PCM sharing στο ALSA;Θέλω να κάνω δυο εφαρμογές να
> χρησιμοποιούν ταυτόχρονα την κάρτα ήχου χωρίς να πρέπει να σταματήσω
> την μια η την άλλη.Απο το documentation δεν έβγαλα και πολύ άκρη για
> αυτό plz help.
> Το σύστημα είναι Mandrake 10 community (εκδοση alsa 1.0.2c και kernel
> 2.6.3SMP)
>
Από άρθρο του Dave Phillips στο LinuxJournal
(http://www.linuxjournal.com/article.php?sid=7391):
<snip>
I'm going to stretch the definition of modularity here and include
ALSA's PCM plugin layer. These plugins extend the capabilities of PCM
devices, providing amenities such as sample rate conversion and direct
mixing of multiple audio streams. The .asoundrc file is where you can
optimize these plugins for use by ALSA-aware applications. For example,
here's my $HOME/.asoundrc file :
pcm.dsp0 {
type plug
slave.pcm "dmix"
}
ctl.mixer0 {
type hw
card 0
}
pcm.ladspa {
type ladspa
slave.pcm "plughw:0,0";
path "/usr/lib/ladspa";
plugins [
{
label delay_5s
input {
controls [ 0.8 0.3 ]
}
}
]
}
Thanks to this configuration my laptop can play multiple audio streams
simultaneously on my laptop (impossible without dmix). I can add a
five-second delay to any of those streams too by using a pre-defined
LADSPA <http://www.ladspa.org> plugin. The following series of commands
launches three sound players, all routed through dmix's software mixer,
with one stream treated by the LADSPA delay line:
alsaplayer -o alsa -d plug:dmix Natacha_Atlas-I_put_a_spell_on_you.mp3" &
aplay -Dplug:dmix -Dplug:ladspa ~/Basil_Bunting.wav &
alsaplayer -o alsa -dplug:dmix Albert_King-Born_Under_A_Bad_Sign.mp3 &
This example makes quite a noise, but in some situations multiple
audible streams can be desirable. More to the point, it's often
desirable not to shut down one stream in order to hear another. The dmix
plugin resolves this problem nicely.
Some cards require explicit configuration by way of .asoundrc. Check the
informative ALSA Wiki <http://alsa.opensrc.org/> for more information
about customizing that file.
</snip>
Πέραν των ανωτέρω, για σοβαρό realtime low-latency mixing με
sample-accurate συγχρονισμό, κοίτα το JACK (
http://jackit.sourceforge.net/ )
Απόλλων
More information about the Migrate2linux
mailing list