The Stack Overflow podcast is back! Listen to an interview with our new CEO.

# Tag Info

21

First of all, how the data is encoded in a mp3 file is irrelevant to the question unless you aim at doing compressed-domain processing (which would be quite foolish). So you can assume your algorithm will work with decompressed time-domain data. The sum / difference is a very, very basic trick for vocal suppression (not extraction). It is based on the ...

21

There are indeed rare instances of recordings in which the L&R channels are in opposite phase. This was done in the late 70s and early 80s to create a cheap "spatial sound" effect (like the "surround" button on low-end hi-fi systems of the time), and on such recordings, computing the average of the left and right channels gives a null output. Some stereo ...

17

You are correct that if your signal is bandlimited to <5 Hz, then you can perfectly represent it with a 10Hz sampling rate. This is the well-known sampling theorem But ... there may be practical considerations for why one would not be able and/or inclined to use critically sampled data. One reason is the difficulty of making a signal critically sampled....

15

You need to filter first and then downsample. Otherwise, you will run into aliasing problems. I.e. frequencies that are above 30 Hz will create images within your frequencies of interest. You can consider the little script below to compare both methods: Fs = 128.0 t = np.arange(0, 10, 1/Fs) signal = np.sin(2*np.pi*10*t) + np.sin(2*np.pi*50*t) sigma2 = 0.5 ...

11

Downsampling and upsampling are operations that change the sampling rate of a signal. Each one of them is composed of two steps, changing the sampling rate and filtering. Usually, the amount of change is expressed as a ratio. When downsampling, we are trying to take the signal from some $Fs$ to some $Fs_n < Fs$. The key problem with doing this is that we ...

10

If linear phase is a requirement, that will probably steer you toward an FIR implementation. It is possible to build IIR filters that have approximate linear phase, but it is easy to design a linear-phase FIR. If you're concerned about latency, forward-backward filtering as in filtfilt isn't really a good option. In general, it's really meant to be used an ...

10

It should not, the need really depends on your application. However, this is a safe bet for most needs, and almost mandatory when you want to control the information lost by the downsampling. Blurring is often another word for low-pass filtering. When an image contains high-frequency content (fast variations), downsampling can produce visually weird or ...

9

This derivation is a tricky one. The approach suggested before has a flaw. Let me demonstrate this first; then I will give the correct solution. We wish to relate the $\mathcal{Z}$-transform of the downsampled signal, $Y_D(z) = \mathcal{Z}\{x[Mn]\}$, to the $\mathcal{Z}$-transform of the original signal $X(z) = \mathcal{Z}\{x[n]\}$. The wrong way One ...

8

Two more reasons to over-sample: Low latency: for example control loops require very low latency. Oversampling gets data in and out faster, so that reduces latency. Also any lowpass filtering introduces group delay. The sharper the lowpass filter, the higher the group delay. If you oversample, you need a less steep anti-aliasing filters and end up with less ...

8

I think you're looking for a free lunch that does not exist. Your original question and response to Peter K's answer suggests that you want to sample a signal that has both lowpass and highpass content, with the highpass content extending beyond the Nyquist frequency associated with your target sample rate. That is probably not going to work. Given a sample ...

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 ...

8

Yes the signal is perfectly reconstructed. Consider the process at each stage as I show using the block diagram below: Consider each sample of the signal at each node in the diagram (each sample is shown using the sample index at the node for each row): (Note: You see the same form of reconstruction in the FFT algorithm). I will attempt to illustrate how ...

7

You don't have a loss in time precision when using FFTs because the FFT is fast. The FFT is just a fast algorithm for implementing the discrete Fourier transform (DFT), nothing more. Instead, there is an inherent tradeoff in time and frequency resolution due to the Heisenberg uncertainty principle. While its statement is explicitly focused at quantum ...

5

I've not seen this notation before. However, it does seem to make sense. The $M$-downsampler is defined by the equation: $$y_D[n] = x[Mn]$$ Its $z$ transform is defined by the equation: \begin{align} Y_D(z) &= \sum_{n=-\infty}^\infty y_D[n]z^{-n} \\ &= \sum_{n=-\infty}^\infty x[Mn] z^{-n} \end{align} Apply a change of variable, letting $n'... 5 The "spikes" (they are quite small in magnitude, but large compared to the nearby filter taps) at the beginning and end are part of how the equiripple property is achieved. In his book "Multirate Signal Processing for Communication Systems" (a book that I recommend quite highly), fredric harris indicates that it is sometimes advantageous to eliminate the ... 5 Provided you can meet the conditions shown in this answer, $$\frac{2 f_H}{n} \le f_s \le \frac{2 f_L}{n - 1}$$ your anti-aliasing pre-filter should be a bandpass filter, with$f_L$the lower band limit and$f_H$the higher bandlimit, filtering the signal frequencies of interest to you. 5 According to (digital) sampling theory, signals should be properly bandlimited, before they are (down) sampled. A digital filter limits the bandwidth of the signal and makes it suitable for downsampling without aliasing. A Gausssian filter is very suitable as a filter, as it has a number of nice features. The Gaussian function is mathematically tractable. ... 4 Decimating before calculating the autocorrelation, in the presence of noise, is inferior to calculating the autocorrelation using the full dataset. Assume that the signal of interest is embedded in white noise. The vector$x[n], n = 0, 1, ..., N-1$consists of samples from a discrete random process. The autocorrelation function of the vector$x[n]$is: $$... 4 Thanks for the reference! You forgot to mention your work on drums enhancement, which may also be of interest for Summer_More_More_Tea's application. Well, that all really depends on what you want to do with it. Do you have a specific "end application" in mind? I completely agree with pichenettes's above statements. To be complete, I should however say that ... 4 Simplest reason for downsampling is simply to reduce the amount of data you have. Say you have a audio raw stream sampled at 44.1 kHz. You may simply want to reduce your data rate to 22.05 kHz because your algorithm can work with that sampling rate. Apply the same principle anywhere else. Just because you have more data does not mean you always need it. It ... 4 The root of your problem is that you are not familiar with the Nyquist Sampling Theorem. First of all, I question your premise that your sample rate is 70 MHz and that you can represent your signals, which range from 0 to 70 MHz, at this rate. The Nyquist sampling theorem indicates that you can only represent signals up to half the sample rate, which is 35 ... 4 The RTL-SDR, as most software-defined radios, has an analog front-end that includes a tunable mixer. This mixer can down-convert the frequency band you're interested in to baseband, where it is sampled. For example, let's say that you want to receive a signal centered around 900 MHz and with bandwidth 2B -- that is, the band covers the range from 900-B ... 4 Your understanding is correct. I don't have the full text of the paper, but it sounds like they aren't being very precise with their description. As you pointed out, downsampling doesn't improve frequency resolution in and of itself, it merely reduces the amount of bandwidth that can be represented unambiguously. However, I can take a guess at what they ... 4 Since I can't comment on this particular site I'd say this, consider the following before you do what you're trying to do. Due to the Nyquist law you want your sampling frequency to be that of the DOUBLE of the maximum frequency your analog signal has. If you downsample to 64 hz that means you'll only be able to see signal data up to 32 Hz. EEG contains the ... 4 First, the P. P. Vaidyanathan condition is a sufficient one, not a necessary one. The upper part keeps every even sample. The lower part convert odds to evens, keeps every (novel) even, and put the (novel) evens back to thir old place. Hence, the delays z^{-1} and z^{+1} exactly interleave the kept evens (top) and odds (bottom). From P. P. ... 4 First note that when you use a logarithmic function you shall avoid negative arguments if it's output should be real valued. Then consider the following relation:$$ y[n] = \ln( 1 + x[n] )$$where the input x[n] is conditioned such that 0 < 1 + x[n] \leq2 is maintained. Then a Maclaurin series expansion of this expression will be$$ y[n] = \ln(1 + ... 4 Decimating a signal (selecting every Dth sample and discarding the rest) does not distort the signal within the passband in any way other than to cause aliases from higher frequencies to fold into the signal bandwidth. Depending on how we model the system the phase may be effected since$z^{-n}$is replaced with$z^{-n/D}\$, but the phase will still be ...

4

Since you have already properly low pass filtered the signal, then there is no risk in taking every other sample to complete the downsampling operation. If you were to create a low pass filter that passed your spectrum of interest with no distortion, and rejected all energy in the alias frequency locations then taking every other sample would provide a ...

3

A common reason for upsampling is rate matching, for instance mixing two signals with different sample rates, or sending different lesser rates of audio to a player that only plays at 44.1kHz. And you are correct that downsampling does potentially destroy information in a signal (assuming there was spectral energy in the portion that has to be low-pass ...

3

As you've figured out, for the filter specifications you gave, you need a very high filter. To summarize, you're asking for: Passband edge: 30 Hz Stopband edge: 32 Hz Minimum stopband attenuation: 68 dB The main determining factor for the filter order that you need to meet the specifications is the width of the transition band as a fraction of the sample ...

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