# Tag Info

## Hot answers tagged interpolation

11

Does cubic interpolation (or any other) have any advantages over linear for the specific case of audio? You'd use neither for audio. The reason is simple: The signal models you typically assume for audio signals are very "Fourier-y", to say, they assume that sound is composed of weighted harmonic oscillations, and bandlimited in its nature. Neither linear ...

10

Both low pass filtering and polynomial regression smoothing could be seen as approximations of a function. However, the means of doing this are different. The key question to ask here is "Can you do one in terms of the other?" and the short answer is "not always", for reasons that are explained below. When smoothing by filtering the key operation is ...

10

There is no such proof because it's not always true. It's a rule of thumb, because I guarantee that you could come up with a situation- an infinite number of situations actually- where higher order splines would do better than cubic splines. The optimal spline order for any given situation is the exact same order as the system you are trying to model. If ...

9

That depends somewhat on the application. In most cases a "constant energy" pan will be best. This can be expressed as $$y(t)=\sqrt{\alpha} \cdot x_{1}(t)+\sqrt{1-\alpha}\cdot x_{2}(t)$$ where $\alpha = .5$ is the point of equal energy. If you are working with fixed point signals, such as wave files for examples, you may run into clipping problems. That ...

9

This is not the case. First of all, a second-order hold would use three sample points to compute an interpolation polynomial, but your suggested impulse response $\text{tri}(t)\star\text{tri}(t)$ is non-zero in an interval of size $4$ (assuming a sample interval of $T=1$, as you do in your question). However, the impulse response corresponding to a second-...

8

The difference between cubic interpolation as described in your question and cubic spline interpolation is that in cubic interpolation you use 4 data points to compute the polynomial. There are no constraints on the derivatives. Cubic spline interpolation computes a third order polynomial only from two data points with the additional constraint that the ...

8

I don't get your downsample step when you downsampled by factor $M$. Let me go from scratch with the spectrum visualization below, with time domain, continuous frequency domain and discrete frequency domain from left to right. When we reduce the sampling frequency by a factor $k$, the signal spectrum is copied to new replicas at $f_s/k$. The discrete ...

7

There are several key insights you need in order to understand how DFT allows you to shift an image. First, Fourier's theorum: It's probably easier to look at the continuous (i.e., analog) case first. Imagine you have some function, call it g(t). For simplicity, let's say that g(t) is an analog audio recording, so it's a one-dimensional function, which ...

7

Getting a sub-sample resolution A very cheap (in terms of code size) solution is just to upsample your signal. In matlab, this can be done with interp(y ,ratio). A slightly more complicated solution consists in naively detecting peaks ; and for each peak, fitting a parabola through y[peak - 1], y[peak], y[peak + 1] ; then using the point at which this ...

7

I don't have a real answer but I have the feeling that this result will help you out: Bernstein's inequality says that, if the signal $x(t)$ is bandlimited to $|f|\leq B$, then $$\left| \frac{\textrm{d}x(t)}{\textrm{d}t}\right|\leq 4\pi B \,\textrm{sup}_{\tau\in\mathbb{R}}|x(\tau)| ,\,\,t\in\mathbb{R}$$ where $\textrm{sup}$ stands for "least upper bound". I ...

7

I do not understand why you have 30Hz resolution so I will focus only to the principle of the question "does interpolation increase resolution?". Short answer is no, no new data, no new information. A longer answer needs the spectrum visualization below, with time domain, continuous frequency domain and discrete frequency domain from left to right. The ...

6

You want to have an interpolation with a equal number of weights on both sides of the points you want to interpolate in between. So you choose either one or two weights on each side, resulting in an interpolation of two (linear) or four (cubic) points. An quadratic interpolation would need three points, which would only make sense at the border of a grid, ...

6

This plot depicts how to convert your digital signal back to the analog one, using $\mathrm{sinc}$ functions. The nice property of these functions used in this process, is that maximum of each function always occurs at minimums of the other, shifted function: Now the process of the D/A conversion that is depicted on your plot is basically taking a $\mathrm{... 6 Interpolation (sampling frequency 44.1 kHz ➔ 88.2 kHz) Your original 44.1 kHz sampled signal has frequencies up to 22.05 kHz, so you should lowpass filter at 22.05 kHz after dilution with zeros. Your filter should have a gain of 2. Otherwise the signal amplitude drops to half because you set half of the samples to zero. Like Jim Clay says, you can combine ... 6 so this is why i think an$n$-th order hold is a$\operatorname{rect}\left( \frac{t - T/2}{T} \right)$convolved against itself$n$times. Wikipedia isn't the final reference of all things, but there is something that i sniffed from there. consider sampling and reconstruction (the Shannon Whittaker whatever formula). if the original bandlimited input is$...

6

Duane Wise and i wrote a paper back in the 90s that we presented to an AES convention that spelled out how to model time-domain polynomial interpolation (of which linear interpolation is an example) in the frequency domain. i think you can get a copy here: Performance of Low-Order Polynomial Interpolators in the Presence of Oversampled Input

5

While I'm not familiar with this specific type of filter, based on the plot you've shown, I would guess that the maxima that aren't found by your process are just butting up against the time resolution inherent in the process. Any kind of "smoothing" implies that there is some time-local smearing of the signal of interest, such that if there are two nearby ...

5

Implementation Assuming you already have a line drawing routine, you just need to supplement that with some kind of interpolation. The curves are created by drawing enough interpolated short lines to make the result look smooth. A good starting point would be to use an existing interpolation routine, like the ones given by Paul Bourke here. I'll illustrate ...

5

The interpolation lowpass filter computes a weighted sum of input samples, which results in the zero input samples being interpolated using the non-zero samples of the input signal. The $*$ sign is NOT multiplication but convolution! EDIT: I'm adding a simple example to clear things up a bit. Let's consider the impulse response $h = [0.5, 1, 0.5]$ and a ...

5

You are looking at the wrong metric of "correctness". Nearest neighbor is introducing significant discontinuities that are showing up as massive quantities of noise in the result. The problem is that you should be comparing to the result you would have gotten if you had sampled at 26.25MHz in the first place. Let's try it (sample a 12Hz sine wave at 26 Hz ...

5

There are various methods on 2d interpolation (this one, and this one). But most of them considered at least 4 points rather than 2. The simplest 2d interpolation is 3 1d interpolation, in which you interpolate the points between (x1-d1, y1-d2) and (x1+d1, y1-d2) as (x2,y2), then you interpolate the points between (x1-d3, y1+d4) and (x1+d3, y1+d4) as (x3,y3)....

5

Yes, you can interpolate and decimate at the same time. This is called "resampling". If you google resampling you will find lots of information about it. And yes, your reasoning about resampling is mostly correct. When thinking about resampling theoretically you usually put the interpolation first to avoid Nyquist issues. An interpolator is upsampling ...

5

Observations I have used +1 and -1 in the sequence instead of your 1 and 0. With $\alpha=1$, the band-limited continuous function $f_m(T)$ in your first two figures (with the above mentioned modification) is: $$f_m(T) = \sum_{k=1-m}^m \operatorname{sign}\left(\operatorname{sinc}(\pi k - \pi/2)\right)\operatorname{sinc}(\pi T-\pi k),\tag{1}$$ where: $$\... 5 First a demonstration that the squares of both$$\begin{align}&[\dots, 0, 0, 1,\hphantom{-}1, 0, 0, \dots] \text{ and}\\ &[\dots, 0, 0, 1, -1, 0, 0, \dots]\end{align}$$equal$$[\dots, 0, 0, 1, \hphantom{-}1, 0, 0, \dots]\hphantom{\text{ and}}$$but the squares of their sinc interpolations differ (Fig. 1): Figure 1. Squares of sinc interpolations ... 5 Take a look at the cubic Hermite spline. The interpolated function is continuous at the data points and the first derivative is also continuous. Away from the data points all of the derivatives are continuous. Let's say that the function f(x) is defined by equally-spaced data points for all x that is an integer. This means you know the values of f(0)... 5 Your interpolation operation is an upsampling operation with subsequent low-pass filtering. This translates to zero-padding in the frequency domain. Given your original signal x[n], you upsample it to become$$y[n] = \begin{cases}x[n/M]& n/M \in \mathcal{Z} \\ 0 & \text{else}\end{cases} to become an M-times upsampled signal. Then, your ...

5

Three reasons to increasing the sampling rate further are 1) To relax the requirements of the post D/A conversion filtering for image rejection. 2) Increase signal SNR by spreading quantization noise for a fixed number of DAC bits across a wider frequency range. 3) Minimize passband droop in the D/A reconstruction. Reason 1 is the most dominant one in my ...

4

It's a bug. M_PI*config->count++ You are processing 2 channels, but incrementing your modulation in the inner loop. So at the end of processing 1 channel, you continue to increment the modulation as you process the second channel. c1 [ 1,2,3,4] [9,10,11,12]... c2 [5,6,7,8] The modulation has a discontinuity, i.e in my simplifies example ...

4

It's important to remember that, for an even N, you have both F(0) and F(N/2) points, neither of which has a counterpart. So, for instance, with N = 8, you have: F(0), F(1), F(2), F(3), F(4), F(-3), F(-2), F(-1) (some people consider the N/2 point as a negative frequency ( ie: F(-4) ), but we'll consider it to be positive) So to interpolate an 8 ...

Only top voted, non community-wiki answers of a minimum length are eligible