[flac-dev] Regain play analysis patches

Erik de Castro Lopo mle+la at mega-nerd.com
Fri Feb 17 15:30:00 PST 2012


Earl Chew wrote:

> I'm a little reluctant to introduce another compiled program when there are
> so many other options that will work well enough out of the box.
> 
> Here are two ideas:
> 
> 1. Use bc(1) to compute the raw samples
> 2. Use perl(1) to compute the raw samples
> 
> To generate raw unsigned samples using bc(1) for example:
> 
> samplerate = 1000;
> duration = 2;
> bitspersample = 24;
> 
> samplerange = 2 ^ (bitspersample-1) - 1;
> samplemidpoint = 2 ^ (bitspersample-1);
> 
> pi = 4 * a(1);
> 
> scale = 18;
> obase = 16;
> 
> for (ix = 0; ix < duration * samplerate; ++ix) {
>   sample = samplemidpoint + samplerange * s(2 * pi * ix / samplerate);
>   s = scale;
>   scale = 0;
>   sample /= 1;
>   sample;
>   scale = s;
> }
> 
> 
> 
> Are you ok with bc(1) ?

Yes, bc looks quite nice.

As Richard Ash mentioned, the test should detect the presence of bc
and it its not available, print a nice big warning, and exit the 
script with an error code of 0. If bc is available, run the tests
and any failure should result in the script exiting with a non-zero
error code.

Cheers,
Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/


More information about the flac-dev mailing list