Re: [linux-audio-dev] EVO 0.0.5 released , resampling (interpolation) support added

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] EVO 0.0.5 released , resampling (interpolation) support added
From: David Benson (daveb_AT_idealab.com)
Date: Wed Sep 20 2000 - 00:05:54 EEST


i recommend the glib.h version 1.3 for a great dissection;
i'll cut and paste for your convenience:

/* IEEE Standard 754 Single Precision Storage Format (gfloat):
 *
 * 31 30 23 22 0
 * +--------+---------------+---------------+
 * | s 1bit | e[30:23] 8bit | f[22:0] 23bit |
 * +--------+---------------+---------------+
 * B0------------------->B1------->B2-->B3-->
 *
 * IEEE Standard 754 Double Precision Storage Format (gdouble):
 *
 * 63 62 52 51 32 31 0
 * +--------+----------------+----------------+ +---------------+
 * | s 1bit | e[62:52] 11bit | f[51:32] 20bit | | f[31:0] 32bit |
 * +--------+----------------+----------------+ +---------------+
 * B0--------------->B1---------->B2--->B3----> B4->B5->B6->B7->
 */
/* subtract from biased_exponent to form base2 exponent (normal numbers) */
#define G_IEEE754_FLOAT_BIAS (127)
#define G_IEEE754_DOUBLE_BIAS (1023)
/* multiply with base2 exponent to get base10 exponent (nomal numbers) */
#define G_LOG_2_BASE_10 (0.30102999566398119521)
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
union _GFloatIEEE754
{
  gfloat v_float;
  struct {
    guint mantissa : 23;
    guint biased_exponent : 8;
    guint sign : 1;
  } mpn;
};
union _GDoubleIEEE754
{
  gdouble v_double;
  struct {
    guint mantissa_low : 32;
    guint mantissa_high : 20;
    guint biased_exponent : 11;
    guint sign : 1;
  } mpn;
};

On Tue, 19 Sep 2000, Miller Puckette wrote:

> Hi Benno,
>
> The technique was first written down by Robert Hoeldrich, in the 1995 ICMC
> proceedings (Banff), but was folk knowledge much earlier.
>
> In the Pd oscillator, look for osc_perform(). It's ugly all right; the
> second version of the inner loop is an unwrapped version of the first one
> (hand unwrapping sped the thing up some.)
>
> The heart of the thing is the "union tabfudge" which is accesses as a
> double (64 bits) and as a pair of "longs" (32 bits each.) YOu accumulate
> into the "double" and then pull bits out of the "longs". To get the
> fractional part back into floating point, bash the upper 32 bits to
> a known value and subtract a constant.
>
> I can be more verbose if needed but perhaps I should do so privately...
>
> cheers
> Miller
>
> On Tue, Sep 19, 2000 at 11:48:40PM +0200, Benno Senoner wrote:
> > Hi Miller,
> >
> > On Tue, 19 Sep 2000, Miller Puckette wrote:
> > > Hi all,
> > >
> > > You can do the trick in double precision and get at least 40 bits of
> > > real precision. I usually use the bottom 32 bits for the fractional
> > > part and some of the top 20 bits for the integer part; this would have
> > > to be adjusted for huge "wavetables" though.
> >
> > Since I stream from disk, (thus from buffers), I have to adjust the pos (double)
> > ponter when it gets bigger than the buffersize.
> > So in theory 20bits would be enough.
> >
> > I've looked at d_osc.c but the code is quite hard to read.
> > Can you explain briefly, where you do the splitting/assembling of the double in
> > integer and fractional part.
> >
> > Benno.
>


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Wed Sep 20 2000 - 01:04:21 EEST