Subject: Re: [linux-audio-user] virtual sampler
From: Juan Linietsky (coding_AT_reduz.com.ar)
Date: Fri Mar 22 2002 - 03:41:36 EET
On Fri, 22 Mar 2002 03:15:23 +0200
"xk" <xk_AT_myrealbox.com> wrote:
> > ok, lets get to my point, i'm basically talking about mixer speed, but
> seems that my point was "changed" along this thread. What i'm talking about
> is that VOICE MIXERS (aka, the critical zone of any synth -oscilator or
> wavetable based-). _that_ is what it should be written
> > using fixed point since it is what it uses the least CPU.
> >
> > in MIDI, and usually, any kind of wavetable synthesis, the mixing consists
> of:
> >
> > 1-find nearer(s) val
> > -simply done with a right shift
> > 2-interpolate
> > -ONLY multiply, division is made by shifting
> > 3-filter
> > -yet again, only multiply, and then shift
> > 4-mix into left/right buffers - only multiply
> > 5-increment sample iterator
> >
>
> With your approach you always have to check for overflowing. This is far
> more worse than clipping. The user will have to reprocess an entire track
> for example just because one overflowed/clipped kick. This is why I said
> using floats is a time saver.
>
No, no overflow check at all, because you read samples 16 bits and mix into a 32 bits buffer. This is specially nice for tables of basic waves
or mixtrures (such a sine/wav/square/etc) because you can get the iterator
to wrap around naturally.
> > this IS slower using floats, I did made sure of that myself, i've written
> > mixers in both fixed point and floating point, and the SAME MIXER using
> fixed point WAS FASTER in machines ranging from old pentiums to
>
> Like I said in the first place, I don't know this for a fact. So you could
> be right.
>
> > >
> > > 23 bits is more than enough precision for digital audio, so this is not
> an
> > > issue.
> >
> > Allow me to prove you wrong, lets say we've got 23 bits, now.. 23 bits
> means numbers ranging from 0->8388608.
> > now let's say we have a sample iterator, in other words the offset to a
> sample being played. in each sample mixed, we must do step 5 of what i have
> described above, this is:
> >
>
> You are kidding, right?
> When I said 23 bits are enough I meant that they are enough for holding
> audio data in them, and I assumed you were also reffering to this.
> No sane person would use a float for a sample iterator. It's obviuos that
> the sample iterator has to be an 32 bit integer.
>
oh! my apoligies then. I made this point because iiwusynth uses float iterators, which is what i tried to point out earlier in this thread,
but i guess i didnt get to explain myself properly. I suppose the thread
went into the wrong direction.
I'm sorry about all this.
regards
Juan Linietsky
This archive was generated by hypermail 2b28 : Fri Mar 22 2002 - 03:27:50 EET