Re: [ecasound] replaygain with ecasound

From: Edoardo Pasca <edo.paskino@email-addr-hidden>
Date: Tue Nov 24 2009 - 15:21:57 EET

Hallo everybody,

first of all thanks for the prompt response. I decided to use a less
accurate calculation of the apparent volume of the track, by emulating
the ecasignalview tool. (actually it would be nice if the
ecasignalview would return the average volume after the file has

In practice I calculate the average of the volume of the track as read
by the bar meters. It's a bit coarse but it is sort of how you would
do it for real with a mixer and a good hear.

Find below the code that I wrote and that seems to give good results.
At least now the volumes don't look to be so different (which is what
I wanted).

I run getFileLengthVolume() on some files and set the volume of the
background music as -20dB with respect to the foreground sound.



#reproduce ecalength and calculates the average signal power
def getFileLengthVolume(filename):
    e.command("cs-add main")
    e.command("c-add main")
    e.command("ai-add "+filename)
    e.command("ao-add null")
    e.command("cs-set-audio-format wav")
    e.command("cop-add -evp");
    e.command("cop-add -ev");
    e.command("cop-select 1");
    i = 1
    dx = 0.
    sx = 0.
    while 1:
        e.command("copp-select 1");
        sx += e.last_float()
        e.command("copp-select 2");
        dx += e.last_float()
        i += 1
        if e.last_string() != "running":
            print e.last_error()
    curpos = e.last_float()
    return curpos , sx/i , dx/i

On Mon, Nov 16, 2009 at 6:59 PM, Antonio P. P. Almeida
<perusio@email-addr-hidden> wrote:
> On 16 Nov 2009 11h55 WET, edo.paskino@email-addr-hidden wrote:
>> Hallo Julien,
>> the answer is: in a frequency sense. In particular, I know what is
>> the cut of the filter at each frequency by means of a function.  For
>> instance I know that at 100Hz it cuts -3dB and at 110Hz it cuts
>> 2.5dB and so forth.
>> So I can provide what is the cut of the filter in the range 20-20000
>> Hz in steps of, say 100 Hz.
>> I hope I clarified my point
>> Thank you very much
> Hello Edoardo,
> Like Julien wrote there's always the possibility of using a more
> "granular" tool. You can use Snd
>, for instance,
> which allows sample level processing in the frequency domain.
> If you're using a Linux distribution there's bound to be a Snd
> package for you to install. In debian is called snd-gtk.
> Snd requires using Guile (Scheme), Ruby or Forth.
> But if I understand correctly I think that you can get the effect you
> want by using one of the several filter operators it provides.
> There's an example in the docs for ecassound interactive where a
> low-pass brickwall filter gets its cuttoff frequency shifted every
> second.
> Does this suits you? Or do you need to implement a filter with a
> specific transfer function? If it's the later then you'll have to use Snd,
> or CLM, or csound like Julien suggested.
> Regards,
> --- appa

Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.
Ecasound-list mailing list
Received on Tue Nov 24 16:15:06 2009

This archive was generated by hypermail 2.1.8 : Tue Nov 24 2009 - 16:15:07 EET