Audio Project Amplifier Speaker Loudspeaker Kit
diyAudio.com diyAudio Forums Archive > Top > Source > Digital
 
dsp upsample question - Click HERE for Original Thread
rlim
Hello,
So we know that upsampling/interpolation is the process of padding zeros to the samples that are coming in, but what happens if instead of padding zeros, we hold the sample at that value?
Specifically, a forum member was doubling the data sample rate, i.e. same data is sampled 2 times before being processed by an interpolation filter. So assume the original data was a sampled sine wave with points spaced 1/fs apart. Now when you double the sample rate while holding the same data, joining the dots at every 1/2fs will not give you the same original sine wave. So does that mean that after the interpolation filter, the processed waveform will be different from the original waveform?

Thanks,
Richard
rfbrw
Don't you mean creating zero valued samples ?
rlim
Yeah, doesn't quite make sense if I were to fill in zero-value samples, does it?

So then if I were to double the sample rate and now sample the same bit twice, would this be equivalent to upsampling by 2?

If this were true, then technically, I should be able to run the sampling clock at a much higher rate, thereby sampling the same data many times and thus push the images way out there where a 2-3 pole low-pass filter should take care of the out-of-band noise.

Where did I go wrong here? It can't be that simple.
rfbrw
Haven't given it too much thought but doubling the sample rate and repeating samples would seem to get you back to where you started.
rlim
But the images will be 2x or 4x higher, wouldn't it?
rfbrw
quote:
Originally posted by rlim
But the images will be 2x or 4x higher, wouldn't it?

Given it more thought and I asssume you are referring to linear interpolation, oversampling at its simplest. Can be done with simple hardware with no need to dither,truncate or round-off. Philips use it in the Bistream process and Wadia and a few others also use it. Used on its own it sounds awful and it doesn't get any better as you increase the oversampling ratio. Unless you actually need the higher sample rate, kicking the images into touch is probably the only reason to go beyond 2x but then again this is not my area of expertise.
Werner
quote:
Originally posted by rlim
Hello,
So we know that upsampling/interpolation is the process of padding zeros

That's not what it is.

quote:
Originally posted by rlim
[B]But the images will be 2x or 4x higher, wouldn't it?

Not at all.

In the context of digital audio replay oversampling comprises of incr4easing the data rate (either by inserting 0 samples or by repeating the previous one(s), the difference is not very relevant here) following by steep digital low-pass filtering at half the original sample rate. It's that last part that makes the output fluid and pushes the images out to above half the target sample rate.
rfbrw
quote:
Originally posted by Werner

In the context of digital audio replay oversampling comprises of incr4easing the data rate (either by inserting 0 samples or by repeating the previous one(s), the difference is not very relevant here) following by steep digital low-pass filtering at half the original sample rate. It's that last part that makes the output fluid and pushes the images out to above half the target sample rate.

If the OP is referring to the thread I think he is then there is definitely no low digital pass filter involved as there is no oversampling filter involved.
rlim
Probably because it's not even clear in my head either.
So let's recap. Let's assume we have data, bit clock and fs clock going into a 2X oversampled digital low-pass filter before hiting a dac. I have attached a drawing where in the left column, you see interpolation at work, where data samples are padded with zeros for every adjacent sample(middle plot). After going through the filter, the data is reconstructed but now at a rate of 1/2fs.

Now on the right column, instead of sending the data into the filter directly, we double the sample rate, sampling the same data twice, which after the 2X oversampling in the chip, will result in the middle plot - overall 4X oversampling.

So my question is whether doubling the sample rate before sending data into the 2x oversampling digital filter give us the same original waveform as just sending data straight to the digital filter? Seems like that's a way of increasing the overall oversampling ratio.

The thing that's confusing me is that the middle plot in the right column isn't quite 4X upsampling since the 'filled in' points are not zeros.
rlim
image attached.
rfbrw
quote:
Originally posted by rlim
Now on the right column, instead of sending the data into the filter directly, we double the sample rate, sampling the same data twice, which after the 2X oversampling in the chip, will result in the middle plot - overall 4X oversampling.

None of this makes sense. You don't sample sampled data.
rlim
Assume I2S signals from the RX decoder, where within one fs period, you have 64 bit clocks, 32 bit clocks each for serial data (L & R). These 3 lines go into the interpolation filter in the normal sense.

Now instead of doing that, you double the rate of fs and bck, and you manipulate data accordingly. When I say 'sample the same data twice', I mean bck latching the same data bits. So you latch the first 64 bits into the filter at double the original rate (data needs to be stored before latching at 2x rate), and at the next 2fs, you latch the same 64 bits into the filter. This will result in the middle plot on the right column in the filter before convolution.

Is it clearer?
gmarsh
Interpolation with zero order hold (keeping the last sample) creates a sinc frequency response in the interpolated signal. If you're upsampling a CD, this will cause treble roll-off.

Zero stuffing doesn't suffer from this.
rlim
quote:
Originally posted by gmarsh
Interpolation with zero order hold (keeping the last sample) creates a sinc frequency response in the interpolated signal. If you're upsampling a CD, this will cause treble roll-off.

So if I latch the same set of data twice but at 2x the rate, the roll-off should then occur 2x higher?
rfbrw
Post #3. http://www.diyaudio.com/forums/show...7685&highlight=
gmarsh
quote:
Originally posted by rlim
So if I latch the same set of data twice but at 2x the rate, the roll-off should then occur 2x higher?
The response will be multiplied by x(f) = sinc(f/fnyq)*, where f is the output frequency you're looking at and fnyq is the nyquist frequency of the input. This is regardless of the interpolation factor used - going with a higher interpolation rate increases the bandwidth of the output signal, but ultimately you just get more "hops" of the sinc response affecting it.

And the sinc response will trash your audio. Rolloff at a sampling rate of 44.1KHz is -3.2dB at 10KHz, -9.6dB at 16KHz and -20dB at 20KHz.

NOS DACs suffer from thie same problem. This is part of the reason I don't like them. :D

* sinc(x) = sin(2*pi*x) / (2*pi*x)
Werner
Actually Sinc(f/fs), and thus -3.16dB at 20kHz for a CD system ...
gmarsh
quote:
Originally posted by Werner
Actually Sinc(f/fs), and thus -3.16dB at 20kHz for a CD system ...

right!

excuse my pre-coffee math. I knew something wasn't right with those numbers. :D
rlim
Really appreciate the help. Rfbrw has provided the link that I have questions to the implementation, and the revelent post is repeated below:
quote:
Originally posted by John Swenson


I DID run this without a digital filter by using an FPGA to do a 4X data rate (each input sample was replicated so each sample became 4, no "interpolation" was done). This worked but sounded terrible, it seems the digital filter really is necassary with this DAC.

When using its own internal filter you have two modes, sharp and slow, they sound very different. In shap mode the sound is very clean and smooth, but also the soundstage collapses and its very "boring" sounding, the music looses its "life". The slow mode brings back the soundtsage and "life" but looses the high end air. I had one listening session where two people had opposite reactions, one loved the slow mode, one hated it for what it did to the high frequencies.

What I liked the best was a compromise, I did a 2X reclocking (again just duplicating each sample, not changing them in any way) and using slow mode, this gave the best of both worlds. This mode sounded WAY better than no digital filter mode and much better than the default sharp mode with 1X data going in (the 8X oversampling happens in the internal digital filter) The 2X data in and sharp mode also sounds better than the default 1X sharp, but not nearly as good as 2x slow.. :D

First off, can someone confirm that with the "2X reclocking" which I think is basically zero-order hold in his implemention (please correct me if I am wrong), it will result in a sinc rolloff at 8X fs (since he eventually pass data through the 8X filter)?

And second, if he were to "stuff zeros" instead of "duplicating each sample", would it then be considered true interpolation with no sinc rolloff, where in this case it would be effectively 16X oversampling?

Page generated in 0.056107997894287 seconds with 17 queries,
spending 0.00738764 doing MySQL queries and 0.04872036 doing PHP things.

Powered by: Search Engine Indexer and vBulletin
Copyright ©1999-2008 diyAudio.com

Please support our sponsor.