[pulseaudio-discuss] Support for audio envelopes

Flavio Ceolin flavio.ceolin at profusion.mobi
Fri Jul 20 13:32:59 PDT 2012


Tanu Kaskinen <tanuk at iki.fi> writes:

Hi Tanu,

First of all, thanks for the answer.

> On Thu, 2012-07-19 at 14:35 -0300, Flavio Ceolin wrote:
>> Hi floks,
>> 
>> I'm trying to implement support for audio envelopes on pulse audio and
>> several doubts come to me. First i've checked that we already had
>> support for it, but it was removed. So my first doubt is, there were
>> problems with this code or it was removed just because no one was using ?
>
> There were problems with the code. I don't remember what exactly was
> broken, though. But at least I didn't like the concurrency handling: I
> really dislike doing inter-thread communication by using shared
> variables. Instead, message passing should be used, in my opinion.

I'll investigate how to solve it. Btw, do you think it's better start
from the scratch or it's ok start from this code ?

>
>> For purpose tests, i've re-applied the old code (doing just the necessary
>> things to compile). So far so good, it was pretty easy. Now i've other
>> questions:
>> 
>> 1) Should evenlopes be applied in source too, or just in the sink ?
>
> Probably also in sources, but I think you don't need to care about
> sources at this point. Once it's done for sinks, then we can copy it to
> sources.
>
Ok, I agree with you.

>> 2) How an application should use this code, AFAIK this code is not being
>>    exported.
>
> What's your use case? If we are talking about sink volume ramping, I
> don't see the need for a client interface at all, because it should be
> done automatically by the server.

Basically I want to set an envelope which apply a filter changing the
sound balance and/or the volume, it's easier demonstrating an idea of an
envelope:

    envelope {
      gain: 1.0;       /* gain or volume - total multiplier of envelope 1.0 (full volume) */
      type: LINEAR;    /* or any ohter algorithm, for example SPLINE */
      /* point = x (time) y (balance) */
      /* if stereo position values ate 0.0 -> 1.0 with 0.5 == center, 0.0 == left, 1.0 == right */
      point: 0   0.50; // middle
      point: 4   0.70; // right-ish
      point: 8   0.30; // left-ish
      point: 12  0.60; // a little right
      point: 16  0.40; // a little left
      point: 20  0.55; // very little right
      point: 24  0.45; // very little left
      point: 28  0.50; // back to middle
    }

>
>> Besides these points, i would enjoy any kind of tip/idea related with
>> this subject.
>
> You'll need to keep rewinds in mind. That is, if a rewind affects the
> envelope, you need to update the envelope state accordingly.

I'll keep it in mind.


Regards,
Flavio Ceolin


More information about the pulseaudio-discuss mailing list