[pulseaudio-discuss] Reading sound samples from different applications

Colin Guthrie gmane at colin.guthr.ie
Mon Jul 11 02:24:38 PDT 2011


Hi,

'Twas brillig, and Varun Vijayaraghavan at 10/07/11 21:35 did gyre and
gimble:
> I am quite new to PulseAudio and sound programming in general, so
> pardon me if I do not frame my question correctly.

Don't worry, we don't bite (hard) and your question is framed fine :)

> I would like to know if there a way to access the sound samples coming
> from different sources throughout your system? I would like to do some
> analysis and filtering of music from different applications and I am
> looking for a way to access the stream.


It really depends what you want to do. If you want to write filters to
process things before outputting normally then you will want to stay
inside PA at all times - writing various modules to make things work.

At present the "filtering" system is not really ideal, but how it works
is as follows:

 1. A filter sink is created. That is a module is loaded that attaches
to your normal output sink (e.g. your alsa sound card). This provides a
virtual sink that we can attach our stream to. This virtual sink will
then do whatever processing it feels is necessary.

We already have filter sinks for equalization and echo cancellation for
example that work in this way.


However, if you just want to analyse the data from an app and do
something else with it (e.g. visualisations) we have an API to allow you
to record from the "monitor source" of the sink the app is playing to
but to only record that one application, not the product of all apps
playing to that sink. This is a little bit clunky and involves putting
the stream index into a string when connecting your record stream. For
reference (and examples) this is how pavucontrols attaches it's VU
meters for individual applications.

Hope this helps. Feel free to describe what you want to do in more
detail and we can maybe give better and more appropriate advice.

Col






-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]



More information about the pulseaudio-discuss mailing list