Hot answers tagged

21

The discrete Fourier transform (DFT), commonly implemented by the fast Fourier transform (FFT), maps a finite-length sequence of discrete time-domain samples into an equal-length sequence of frequency-domain samples. The samples in the frequency domain are in general complex numbers; they represent coefficients that can be used in a weighted sum of complex ...


8

Are you sure you shouldn't be using numpy.correlate instead of numpy.convolve? To estimate delay, you want to cross-correlate your signals, not convolve them. You'll possibly end up with a much larger delay by convolving. Trying something simple: x = [1, 0, 0, 0, 0 ]; y = [0, 0, 0, 0, 1 ]; conv = numpy.convolve(x,y); conv array([0, 0, 0, 0, 1, 0, 0, 0, ...


6

Spherical head, distant source For a spherical head with the ears at opposite points on its surface, a planar wave from a distant sound source reaches an ear on a straight line through air or if blocked by the head then partially through the shortest path along the surface of the sphere. If the sound source is at the same vertical coordinate $z$ as the ears,...


6

If you are not changing the delay length very often, and you don't want to have a Doppler effect that comes from continuously changing the delay length, then try a cross-fade. Both delay lengths should be running simultaneously for a moment, and you would fade the old one out while fading the new one in.


6

Your mathematical derivation is correct, your $H[k]$ is the single-tap equalizer (i.e. one tap for each subcarrier, and the subcarriers do not mix with each other. That's the orthogonal in OFDM). Let me try to explain this a bit more general, without going into coherence bandwidth and flat fading. To my understanding, explaining it with $B_c$ and flat ...


5

This is basically what @hooman suggests: fit a parabola to the three points near the peak of the sample cross-correlation of the data. Using the formula for $p$ here: $$ p = \frac{1}{2} \frac{\alpha - \gamma}{\alpha - 2\beta + \gamma} $$ where $\alpha,\beta,$ and $\gamma$ are the values of the sample cross-correlation just before the peak, at the peak, and ...


4

Hard to believe, that you actually looked. You probably don't even need a DSP for that, a normal microcontroller should be sufficient. For example, the STM32F4-Discovery board comes with an ARM Cortex-M3 that has several ADC channels that can do 2.4MSps each and up to 7.2MSps in interleaved mode. There's a DAC for signal output as well. But since your ...


4

If you consider the transfer function of a causal IIR filter $$H(z)=\frac{B(z)}{A(z)}=\frac{\sum_{m=0}^M b_mz^{-m}}{\sum_{n=0}^N a_nz^{-n}},\quad a_0=1$$ then you always get the same number of poles and zeros, regardless of the choice of $M$ and $N$ (as already pointed out by Robert). However, what is meant by a system with "more zeros than poles", is a ...


4

The thing you're looking for is known as an "all-pass filter", which has a flat amplitude response, but modifies the phase relationships within a signal. This would be a separate stage from the one that limits the bandwidth. Note that the 50-500Hz bandpass filter is going to modify phase relationships, too, so the all-pass filter will need to be designed so ...


4

In the sampled digital realm, poles at the origin represent delay, which may be necessary to make a filter implementation strictly causal. This delay usually requires no additional arithmetic ops (as a pole elsewhere than zero would require). Sometimes when describing a filter where delay is irrelevant (offline processing, etc.), the filter is centered at ...


4

The term delay line comes from (analog) telecommunications where timing between different signals needed to be adjusted by delaying one of them. For example, the chrominance and luminance channels in a cathode-ray-tube colour television. The reason it's called a line is because that's all it really is: a wire. The website linked to above has the following ...


4

You can fit a curve to the points around the peak of the crosscorrelation ontained by xcor and find the peak of the fitted curve. Ideally you know the cross correlation function of your signals and you fit that function. For practical purposes a parabola also would do. As a rule of thumb for this approach to work properly the bandwidth of your signal should ...


4

Lagrange parabolic estimator The standard Lagrange polynomial parabolic interpolation peak finding formula from Peter's answer, $$p = \frac{1}{2} \frac{\alpha - \gamma}{\alpha - 2\beta + \gamma}$$ has bias as function of the true delay $d$ if the cross-correlation peak is that of a critically sampled sinc. If the sampling frequency is increased, the ...


4

The problem here is a discontinuity in the signal, which results in the click you're hearing. A possible solution is to make the delay variation as smooth as possible so that step-like discontinuities are avoided. If $x(n)$ represents the signal associated to the delay-line control (e.g. a knob) and $y(n)$ represents the signal associated to the effective ...


4

Standard Savitzky-Golay filters are linear phase (type I) FIR filters. So they have an odd number of filter coefficients $2N+1$, and the delay equals $N$. For a good overview of Savitzky-Golay filters see this article by Ronald Schafer. For the definition of the four types of linear phase FIR filters see this answer.


3

From the KVR forum link above, dig in from this section: a Tape or Bucket Brigade Delay is better emulated using a fixed delayline with a variable sampling-rate. Classic digital delays typically modulate the length of the delay-line while, Tape and BBD modulate the speed to change the delay. It's similar to a guitar where to change pitch you can ...


3

Typically simplistic models for don't work very well and don't result in externalization (out of head localization). The diffraction effects are quite complicated and at higher frequencies the details pinna (ear lobes) and shoulder reflections are quite relevant. Interaural time and level differences are also highly frequency dependent. It's much more ...


3

Correct answer is in the comment already but for completion: Your transfer function is $$H(z) = b_0 + b_1 \cdot z^{-1}, \mbox{ with } b_0 = 1, b_1 = .9$$ which makes the inverse $$H^{-1}(z) = \frac{1}{b_0 + b_1 \cdot z^{-1}} $$ which corresponds to the difference equation $$y(n) + 0.9 \cdot y(n-1) = x(n) $$ or $$y(n) = x(n) -0.9 \cdot y(n-1) $$


3

If you have a continuously varying delay like, for example, a chorus or flanger, you need a to implement a time varying fractional delay in addition to your regular (integer) delay line. If you only need to change the delay occasionally in discrete steps, a cross fade will work fine.


3

You are seeing the difference between "wide band FM" and "narrow band FM" in your modulated waveform. Observe your modulation index for each case and then review the sideband levels versus mod index using Bessel functions. (The modulation index is the ratio of the frequency deviation over the frequency modulation). The first case is wide-band FM as your ...


3

Calculating a delay between two signals is not as simple as you described and it cannot be generalized as easily either. The case for two sinusoidal signals seems trivial, as the delay then agrees with the phase (divided by the angular frequency) of the Fourier component (of this pointwise multiplication) for the respective frequency. This is not ...


3

The OP asked about a phase shift specifically but from the written details without seeing the actual demodulator implementation, I suspect he may possibly be asking how to implement the delay that is used for some simple FM demodulation approaches. I want to mention the possibility that this may actually be a delay element and not a phase shift in the sense ...


3

As your plot shows, the second form allows for the correlation peak to be negative. Now, what does a strong negative cross correlation mean? It means the signals are very similar, except one has a negative sign in front of it, i.e., $x_1 \approx -x_2$. Whether or not this makes sense depends a lot on the actual application. In the application you describe, ...


2

The problem is that you are using "upsample", which merely inserts zeros in between the original samples, instead of "interp", which upsamples and then low-pass filters.


2

The transient edge or pulse shape of a tone burst represents a modulation. The resulting modulated signal will contain frequency components higher than the tone frequency. Thus you may need a sample rate much higher than just over 2X the tone frequency to reproduce a waveform accurately enough for cross-correlation to match the edges of the pulse envelopes....


2

a causal discrete-time filter, $H(z)$, cannot have more zeros than poles. you can factor it out and you will be left with positive powers of $z$ and that means an advance of the impulse response before $n=0$. but a causal $h[n]$ must be zero for $n<0$.


2

First of all make sure that the magnitude of $a_M$ is strictly less than $1$; this is necessary for the filter's stability. Second, you use several unnecessary variables. This is no serious problem, but it makes it harder to see what's going on. For $M=1$ a simple pseudo-code would be v = x - aM * v_old; y = v * b + v_old; v_old = v; The important thing is ...


2

I also suggest a general purpose microcontroller. Your problem involves no processing and your data appears to be digital - so you don't even need an onboard ADC and DAC. The only thing you need is RAM and some very lightweight logic. It would be silly to record digital data bit by bit - you only need to record the number of clock ticks between transitions....


2

Given two signals with the same finite duration and number of samples $N$, we can calculate the periodic or cyclic crosscorrelation function which has $N$ values, or the aperiodic crosscorrelation function which has $2N-1$ values. For signals with $N$ and $M$ samples respectively ($N > M$), the aperiodic crosscorrelation function has $N+M-1$ values. ...


2

I am not familiar with signal processing for audio, but I would like give answer which contain common programming suggestions. Sorry, I really do not know your programming level and may be this suggestions will be look obvious and ridiculous, but I hope it will be useful. I'm getting some odd results with some code I'm working on. When you get odd ...


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