texts: Apply filter before or after Downsampling?

texts:
Context: I'm trying to do formant estimation. My first attempt didn't work out all that well so I'm trying to follow closely Praat since their formant estimation is remarkably accurate.
Question: I thought it was obvious to apply the filter (pre-emphasis) before Downsampling, however Praat doesn't. Is there a reason for this? Are filters usually applied before or after downsampling?


texts:
How identify the presence or absence of regular stripes of different colors, but ranging from very very very very light pink to black inside of a scanned image (bitmap 200x200dpi 24-bit).
Carry a few examples.

Example 1

Example 2 (the lines are in all the columns except 7 in the second row of the last column)

For now try to identify (using python language) whether or not there is at least 5-10 pixels for the presence of different color from white to each strip, however, does not always work because the scanned image is not of high quality and the strip changes color very similar to color that surrounds it.

Thanks.


texts: How Does Color Conversion and Downsampling work When JPEG compressing a grayscale image?

texts:
For color images I know you have to convert to YCbCr format, and then for downsampling is based on the fact that human beings see differences in Y more than differences in Cb or Cr.
How do I do these things but for grayscale (or monochrome) images?


texts: Minimum number of Poles and zero of transfer function H(z)?

texts:
Suppose $G(z)=H(z)(1-\frac{1}{2}z^{-1})$ now in question its saying ROC of G(Z) is entire Z plane except Z=0,so here we need not to add anything because G(Z) already a right sided signal with ROC entire z plane except at z=0.

now  $H(z)=\frac{G(z)}{(1-\frac{1}{2}z^{-1})}$, for the input $x(n)=(1+j)^n$,
  H(z) should become zero.

Now here i am not getting what should be the value of G(z) so that its output becomes zero for the input $(1+j)^n$.


texts: Extracting audio track to determine the song beat

texts:
I'm completely new to this field.

Perhaps I'm calling it by a wrong name, but I want to analyze an audio track and retrieve a timestamp to beat mapping.

Is there an open source 3rd party library that can perform this, or could/should I do it myself?


texts: Next steps for analyzing this PWM algorithm and choosing a low pass filtering technique?

texts:
The Broadcom BCM2711 GPIO controller used by the Raspberry Pi has a hardware PWM implementation option using an algorithm that provides an average value defined by a rational fraction $N/M$ defined as follows in section 8.3. PWM Implementation starting on page 156:

  Set context = 0
  context = context + N
  if (context >= M)
  context = context - M
  send 1
  else
  send 0
  Repeat from step 2

  where context is a register which stores the result of the additions/subtractions.

I've implemented this in a Python script to try to start to get an idea how I'll need to filter it in order to get a low-noise, stable voltage. Here with $M=200$ I've incremented through $0 \le N \le M$ for over 1000 time points each, then applied a gaussian smoothing with a $\sigma$ of 10 time points just to get a quick look.

I took the Fourier transform of the middle 1024 points, ignoring a $3 \sigma$ buffer on each side.

I was surprised to see that some values of $N$ produce signals that are orders of magnitude more noisy than other nearby values of $N$.

Questions:

This kind of analysis is new territory for me, if I've made any major errors in the analysis I would appreciate knowing about it.
If I need near-DC voltages I can just run the BCM2711 at a moderately high frequency and filter the heck out of the output with a simple RC filter.  But if I wanted to work closer to the frequency that the algorithm was running, what additional analysis should I do on this algorithm before deciding on a more aggressive low-pass filter and simulating it's performance?

Here's the Python script for the plots and analysis:

import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage
from numpy.fft import rfft, rfftfreq

sigma = 10
ignore = 3 * sigma
M = 200
big = []
for N in range(M+1):
    context = 0
    bob = []
    for i in range(1024 + 2 * ignore):
        context += N
        if (context >= M):
            context -= M
            bob.append(1)
        else:
            bob.append(0)
    big.append(bob)

big = np.array(big, dtype=float)
fbig = ndimage.gaussian_filter1d(big, sigma=sigma, mode='mirror', order=0, axis=-1)
fbig_trunc = fbig[:, ignore:-ignore]
print('fbig_trunc.shape: ', fbig_trunc.shape)
ft = rfft(fbig_trunc, axis=-1)
power = np.abs(ft)**2
power /= power.max()
dB_rel = 10 * np.log10(power)
print('power.shape: ', power.shape)
print('power.max(): ', power.max())
print('dB_rel.shape: ', dB_rel.shape)
print('dB_rel.max(): ', dB_rel.max())

if True:
    plt.figure()
    for thing in fbig:
        plt.plot(thing, linewidth=0.8)
    plt.ylim(-0.02, 1.02)
    plt.title('sigma={:2d}, M={:3d}'.format(sigma, M), fontsize=16)
    plt.xlabel('time steps', fontsize=16)
    plt.show()

if True:
    plt.figure()
    maxi = dB_rel[:, 1:201].max()
    plt.imshow(dB_rel[:, :201], vmax=maxi, vmin=-100)
    plt.colorbar()
    plt.gca().set_aspect(2.0)
    plt.title('FT relative power (dB), sigma={:2d}, M={:3d}'.format(sigma, M), fontsize=16)
    plt.xlabel('frequency', fontsize=16)
    plt.ylabel('N', fontsize=16)
    plt.show()

if True:
    plt.figure()
    std = fbig_trunc.std(axis=-1)
    plt.plot(10*np.log10(std**2))
    plt.title('stdev relative power, sigma={:2d}, M={:3d}'.format(sigma, M), fontsize=16)
    plt.xlabel('N', fontsize=16)
    plt.ylabel('stdev (dB rel)', fontsize=16)
    plt.show()


texts: $\rm Q$ number format singed or unsigned?

texts:
I am studying $\rm Q$ number formats and in a few places it's used to represent $2$'s complement fixed point numbers , and other places it's used to represent unsigned fixed point numbers. Given a $\rm Q$ number e.g $\rm Q1.4$:

How do I know if it's a signed or unsigned number ?
Should it be given that it's used in a signed or unsigned context?


texts: Terminologies: Adaptive, recursive and iterative

texts:
Considering non-linear filtering technique like Extended Kalman filtering with Expectation Maximization (EM). EM is an iterative technique but what is Kalman filtering? Is Kalman Filtering called iterative approach?
Adaptive signal processing algorithms like Least Mean Square and Recursive Least square (RLS) estimate weights at each time instant and then update them. Since, RLS has a recursive nature and it falls under adaptive technique, then does this mean that adaptive is another name for recursive?
What is the difference between adaptive and iterative terminologies? Are Kalman filtering and its nonlinear versions adaptive?

Q1: In short, is adaptive=recursive=iterative?

Q2: Where is EM and Kalman Filtering approaches categorized under and why?


texts:
I'd like to have your overview if what I'm doing is OK.

I need to plot the BER vs Eb/No. So the noise power which I should generate should be related to Eb/No.

bits are encoded into 1/2 rate encoder.
the output of the encoder is converted to +1 and -1 symbols
symbols are oversampled by OS ratio.
the oversampled symbols are passed through Gaussian filter and this is the data which i send to the channel.

now i need to generate AWGN:

EbNo_dB_bit_list = -2:0.25:2;
EsNo_dB_no_code = EbNo_dB_bit_list - 10*log10(OS);
dec_EsNo_dB_no_code=10.^(-EsNo_dB_no_code/10);
sigma2 = 1/(2*Rate)*dec_EsNo_dB_no_code; % to include the code rate

ni = randn(1,length(modulated));
nq =randn(1,length(modulated));
noise=(ni+1j*nq)*sqrt(sigma2(k));


texts:
I have two images $I_1$ and $I_2$ suppose $I_2 = downscale(I_1)$, so for example if $I_1$ has resolution 1024x1024 $I_2$ could be 512x512.

How can I measure how much quality I've lost during this process?

I was thinking to do something like the following, but I'm not sure it's the most correct way to deal with such problems.

I take $I_2$, I upscale it to the same resolution of $I_1$, giving me $\tilde{I}_2$ (by any algorithm, it could be for example replicating pixels value, bilinear interpolation, etc...)

At this point I would use as measure

$$
\mu = \max_{(x,y)} \left\{ 1 - \frac{\tilde{I}_2(x,y)}{I_1(x,y)}\right\}
$$

However I'm not sure this would correspond to the signal to noise ratio.
It would be clear to me that $\tilde{I}_2(2x,2y) = I_1(2x,2y)$ (i.e. pixels with even indices won't change), but when at least one index is odd there will be some reconstruction error (noise?) that the measure would take into account.

So again, is the one above a valid measure? if not what's a better measure?


texts: Calculating the inverse DTFT of a signal

texts: There is a signal $y[n]$ with a differentiable DTFT $Y(e^{i\omega})$. How do I find the inverse DTFT of $i\frac{dY(e^{i\omega})}{dw}$ in terms of $y[n]$ (where of course $i =  \sqrt{-1}$)?


texts: Help Understanding Radial Gaussian Filter

texts:
I am currently reading through Mueller's "Fundamentals of Music Processing" and I am trying to understand audio segmentation through the use of self-similarity matrices.

Currently, my matrix looks good, and I am trying to understand the use of a "checkerboard slide" down the diagonal, where large differences should denote different sections of a musical piece (well, in a perfect world...).

I am running into trouble with generating a "Gaussian-tapered checkerboard" and I haven't been able to easily find any specific references online that have helped me.

As I understand, the checkerboard $K$ would initially look something like this:

[-1, -1, 0, 1, 1;
 -1, -1, 0, 1, 1;
  0,  0, 0, 0, 0;
  1,  1, 0,-1,-1;
  1,  1, 0,-1,-1]

The formula for a radially-symmetric Gaussian function provided by Mueller is as follows:

$$\phi(s,t) = e^{-\epsilon^2 \cdot (s^2 + t^2)}$$

And the resulting checkerboard would be calculated as such:

$$KGauss(s, t) = o(s, t) \cdot K(s, t)$$

Meaning that a three-dimensional representation of the checkerboard would look something similar to this:

Now, I may be just easily confused about how this is calculated, but here are my thoughts on how this would work:

Assume we are calculating the point $(0, 0)$ for our Gaussian function, this would mean that we would have $o(0, 0) =  e^{-\epsilon^2 * (0 + 0)} = e^0 = 1$.

However, this would not make sense, as the Gaussian checkerboard should taper to zero as we go along.  Furthermore, as $s$ and $t$ increase, $e^{-\epsilon^2 * (s^2 + t^2)}$ would decrease and approach zero, which would not match my expectations for the checkerboard.

Therefore:

Can anyone help explain what I am missing here that would allow me to generate the checkerboard as I would expect?  Is there any good reading on how this works that I have overlooked?
I also have not found any material on selecting a good value for epsilon.  How can I know how to select the "best" value for a given input?  Is this just trial and error, or a threshold that I should keep consistent across different music files, for example?

Thanks for any help!  (And if there are better ways to format matrices on here, I'd love to know...)


texts:
I know that Fourier transform of $t^n f(t)= i^n \frac{d}{d\omega^n} F(\omega)$.
But does this work when $n<0$?
Is there any direct relation to compute the Fourier transform of $\frac{f(t)}{t}$?


texts: Requirement on sampling rate for Doppler shift estimation

texts:
What is the requirement of sampling rate on channel impulse response (CIR) for Doppler shift estimation? Suppose that there is a bi-static radar system with perfect synchronization, the receiver samples the CIR and estimates the Doppler shift caused by the dynamic object in the targeted area.
Does the sampling rate have impact on Doppler shift estimation, and how?


texts: Trying to identify the best method for IIR realizations

texts:
I'm relatively new to implementing IIR filters in raw programming formats (i.e. C or C++) and I've run into the concept of IIR filter realizations.

So my question: is there a 'best format (works 99% of the time)' for implementing these filters? i.e. an implementation that will typically be 'best' regardless of the application? Or is the actual implementation highly dependent on the application?

Here's an array of smaller yet related questions:

Is there ever an application in IIR filters where implementing the direct form of the filter is beneficial? Or should I always attempt to realize the filter as a cascade of subsystems?
Regarding cascade and parallel realizations, is cascaded always better?
Assuming that the exact filter implementation is dependent on the application, is it worth the effort to spend time and analyze the filter implementation from the beginning, or should I always aim for implementing as a cascaded subsystem and only deviate from that if the results are poor?
What is the purpose of transposed systems? I understand mathematically the differences, however, are there actual physical benefits of implementing a transposed vs nontransposed system?


texts:
I am reading some paper, and I am having some trouble with some Fourier transform,

Suppose that $F(\omega)$ is the Fourier transform of $f(x)$, i.e. where

$$F(\omega)=\int_{-\infty}^{\infty}f(x)e^{-i\omega x}\,dx.$$

What is $$\frac{1}{2\pi}\int_{-\infty}^{\infty}\frac{F(\omega-a)}{i\omega}e^{i\omega x}\,d\omega ?$$
I was thinking of using the time integration property, since $i\omega$ appears at the denominator, but I am not sure how to start it.


texts: Perform Convolution in Frequency Domain Using FFTW?

texts:
I'm trying to convolve two signals $x(n)$ and $h(n)$ in C by using the FFTW library's functions to perform a Fourier transform on each, multiply the appropriate complex components together, and take the IFFT of the resultant product. Unfortunately, my IFFT'd result isn't correct, and I'm not sure what I'm doing incorrectly.

I'm testing using a modified version of code I found online (.c and Makefile here), which populates two arrays with random numbers between 0 and 1. My process is as follows:

Create double buffers for x (audio signal) and h (impulse response) of lengths n and nIR respectively.
Populate each buffer with random numbers between 0 and 1.
Create two complex buffers X and H, each of length nOut = n + nIR - 1
Create and then execute two real-to-complex FFT plans, one for each of the signals, both using nOut elements (i.e. plan_forward = fftw_plan_dft_r2c_1d ( nOut, x, X, FFTW_ESTIMATE ); and plan_forwardIR = fftw_plan_dft_r2c_1d (nOut, h, H, FFTW_ESTIMATE);
Create complex array fftMulti to hold the frequency products of the two arrays. Its size is nc = nOut / 2 + 1 because FFTW doesn't store the redundant half of the FFT
Loop for ( i = 0; i < nc; i++ ) and perform complex multiplication, i.e. fftMulti[i][0] = X[i][0] * H[i][0] - X[i][1] * H[i][1]; for the real component and fftMulti[i][1] = X[i][0] * H[i][1] + X[i][1] * H[i][0]; for the imaginary component
Create double array convolvedSig of size nOut. This array will hold the IFFT of fftMulti
Create and execute a complex-to-real FFT plan of size nOut, i.e. plan_backwardConv = fftw_plan_dft_c2r_1d(nOut, fftMulti, convolvedSig, FFTW_ESTIMATE);
Normalize convolvedSig by dividing each element by nOut

The values in convolvedSig are not correct (they are way too high), but I'm not sure what I'm doing wrong. I also created arrays and complex-to-real plans for my unmodified signals X and H (also of size nOut), and those IFFTs worked just fine (i.e. values were exactly the same as before I performed FFTs on them).

Using my process and/or my code, can someone please help me identify what I'm doing incorrectly?


texts: Are all LTI systems invertible? If not, what is a good counterexample?

texts: I have been trying to figure this out for a while now. Everywhere I have looked I could easily find examples of invertible LTI systems, but I could not find any counterexamples. Can anybody shed some light on this for me?


texts: Why the correct probability for a square M-QAM is equal to the square of correct probability of ($\sqrt M$)-PAM?

texts:
The question is why:

$P_c (\text{square} $ $M-QAM) = (1 - P_{\sqrt M})^2$

where: $P_{\sqrt M}$ is the error probability for $\sqrt M$-PAM signal.
Thanks.


texts: getting frequency response from input and output signal

texts: How does one get the frequency response of a filter, given an input signal and the signal output by the filter?


texts: Forward and Backward Filtering (MATLAB's `filtfilt()`)

texts:
I have an input sequence $x(n)$ and impulse sequence

\begin{equation}
h(n) = \begin{cases} 0 & \quad \text{when } n = 0 \\ .239052 & \quad \text{when } n = 1 \\1.3357\exp(-0.650286n) & \quad \text{when } n > 1\\ \end{cases}
\end{equation}

I did a convolution and obtained $y(n)=x(n)*h(n)$. I trimmed some of the data  in the end from $y(n)$ and then I flipped $h(n)$ and I did reverse filtering $w(n)=y(n)*h(-n)$.
When I researched about this I found filtfilt in matlab is an easier option but I am trying to implement this in C.
So my question is without trimming the first output sequence  $y(n)$ I am getting a drifted version of the result (there is a delay).

Is it trimming really necessary or am I doing something wrong here.
One more question is I can see some transients both at the start and end  of $w(n)$ sequence when I use filtfilt I don't see that transients.The reason is matlab is using some initial states based on the below paper to get rid of the transients.

Gustafsson, F. "Determining the initial states in forward-backward filtering." IEEE® Transactions on Signal Processing. Vol. 44, April 1996, pp. 988–992.

To summarize :

Is it trimming really necessary ?
PS the figure attached without trimming the the resultant data has a lag..Trimming the $y(n)$ sequence before backward filtering aligns the result.
how to determine the initial states for getting rid of transients.


texts:
I have a sailing yacht where speed is measured using a peddle wheel. It measures speed through water (STW). This measurement contains a measurement error whose magnetude is dependend on both speed (it gets larger when speed increases) and heel of the vessel (this relationship is unknown). The vessel is also equiped with a GPS system that provides speed over ground (SOG). SOG also got its errors, however these are independend of boat speed and heel. SOG is less usefull on a sailing vessel compared to STW. This is because the water itself canstream.
I want to correct the speed measurement of the paddle wheel. (For the moment I will ignore streaming of the water itself). I think there are two ways to correct it. One way is to log a lot of data on heel, STW and SOG and use a method (least sum of squares) to solve COG = f(STW, heel). But I think there must be another method that constantly and real time updates correction factors. The LSQ method has the disadvantage that there is time between calculating the correction and applying it. Also when circumstances change (think of growth on the hull or paddlewheel for example) a recalibration is needed. Its advantage of course is that one can collect data only when one knows the water is not streaming. I would like to try out the second method.
Let me describe the method I have in mind.

I start with a default set of corrections and use both heel and STW to calculate a best estimate of real STW (I call this BESTW).
BESTW = heel * STW * cor1 + STW * cor2 + cor3

I then compare this to SOG and calculate the difference. This is the error of my estimate:
error = COG - BESTW

I then use this error to tune the set of corrections. But I want to do this slowly as COG also has its own error:
corrections = corrections + error * factor

I have three things I do not know:

do I have the right formula for calculating the best estimate (step 1)?
How to spread the error over the different correction factors cor1, cor2 and cor3 in step 3. Should they all be affected equally?
Is there a way to have an educated guess of the factor to use in step 3?


texts: ImageJ Object Detection within AVI Stack

texts: I am working on a project in which I am attempting to analyze a fish within a petri dish using ImageJ and an AVI clip of the fish under a microscope. My first hurdle is to locate the fish within the dish, which I assume I could do without even needing the entire stack (maybe even just a single frame). I am new to image processing, but with the libraries available in ImageJ, I am hoping to be able to locate the edge of the fish and either cut out that edge or cut out a smaller box containing just the fish. Any help would be greatly appreciated from those of you with experience in either ImageJ or image processing in general. Thanks!


texts: MATLAB, Removing Certain Elements From An Array That Fits The Condition

texts:
removing elements from an array that have difference of 3 or less between the next element...
eg. A=[3 6 10 14 17 20] to this B=[3 10 14 20]...I believe I can use diff but in what context should I use it to achieve this ?


texts:
i have a cosine pattern antenna but i would like to repeat it 2 more times in order to get 3 cosine patterns to cover whole 360 azimuth

ant = phased.CosineAntennaElement('FrequencyRange',[2 3]*1e9,'CosinePower',[8 15]);


texts: Spectrogram power/magnitude normalization in analogy with image intensity normalization

texts:
In analogy with the 8-bit grayscale image color depth, in which the intensity of a sample pixel is normalized to a value between 0 and 255 by taking into account the minimum and maximum intensities present in the original image, is there a standard for normalizing the powers/magnitudes (of short time Fourier transform buckets) in spectrograms of audio samples?

(I am new to audio signal processing, so please let me know if my question does not make sense.)


texts: What's the Underlying Algorithm for Detail Preserving Upsampling in Photoshop CC?

texts:
The detail-preserving upsampling algorithm in Photoshop CC is truly amazing. It can upscale any image while preserving details in almost real-time. And I truly wonder how it is implemented.

I've started by searching papers with keywords single image super resolution. And seems the current state-of-art algorithms require an trained external database to guess the missing high frequency information. And I believe it is really hard to train & distribute a complete dictionary, right? Also, I don't think it's possible to train a dictionary with image pyramid in real-time.

After that I've turned to the area of image upsampling, which seems fast enough comparing with super resolution algorithms, but there are so many algorithms, I'm totally lost.

So, does anyone have any guesses or hints on how can that tool is implemented? Thanks!


texts: Learner level information on Kalman filtering for different input kinds

texts:
I am learning Kalman filters and have seen example on data as state varaibles that have real values / numeric. However, in digital communication the information is in digital - bits. So, can Kalman filter not work on bits?

I have not found this information in any text book, tutorials and other reading materials. In text books and in wikipedia, it says that the state $x$ of the system is represented as a vector of real numbers I want to know if Kalman filter and Ricatti Equations needs to modified if the input signal $x$ is a discrete, taking values from a symbol set. Examples of such input is the DNA genes, BPSK symbols, quantized pixel values. Is there a different Kalman filter for symbolic input? Or can we use the same Kalman filter and its equations. Thank you


texts: Which method to remove small unwanted region and fill holes

texts:
I have a hard problem that need your help. I have a binary image that maintains some unwanted region (small white dot) and hole regions (in figure 1).My idea is that the first I will remove unwanted region by calculating area these region and then filter with small area value.At the second step, I fill in hole region to make clear image.What do you think best method to fill in hole region. D.Because my idea need threshold value to remove unwanted region. I want to find automatic method to do it. Do you have any idea to resolve it? Thank you so much. This is my reference code for remove unwanted region. But it need threshold term. You can download image test at here

function exImage=rmUnwantedRegion(Img,threshold)
    lb = bwlabel(Img);
    st = regionprops(lb, 'Area', 'PixelIdxList' );
    toRemove = [st.Area] <threshold; % fix your threshold here
    exImage = Img;
    exImage( vertcat(st(toRemove).PixelIdxList ) ) = 0; % remove
 end


texts: How to determine which measurements cause which?

texts:
Suppose I have two sequences of measurements, $x_1[n]$ and $x_2[n]$ for $0 \le n \le N-1$.
How do I determine if there is a causal relationship between the two?
My first thought was, well... I can just find the correlation between $x_1$ and $x_2$.  But almost immediately I was struck by correlation is not causation.
OK, so in Python, we can generate  a uniform noise signal x1 and then filter it to get x2.  Clearly, in this case, x2 is causally related to x1.
import numpy as np
import scipy.signal as signal

Q = 50
N =1000
x1 = np.random.uniform(-1,1,N)
b,a = signal.iirfilter(1,[2*500*(1-1/(2*Q))/44100,2*500*(1+1/(2*Q))/44100])
x2 = signal.lfilter(b,a,noise1)

x1

x2

Unfortunately, the correlation of the two doesn't tell us much:

Next, I thought about using coherence:
$$
C_{x_1x_2}(\omega) = \frac{|G_{x_1x_2}(\omega)|^2}{G_{x_1x_1}(\omega) G_{x_2x_2}(\omega)}
$$
where $G_{ab}$ is the cross-spectral density between $a$ and $b$.
However, this just seems to tell me that the two are causally related... it doesn't tell me the direction of the causation.

The figure above shows what should be obvious: $C_{x_1x_2}(\omega) = C_{x_2x_1}(\omega)$.
So... how do I determine the direction of the causation?

For example, suppose I want to know whether $x_1$ caused $x_2$, or vice versa.
So either
$$
x_1 = h \star x_2
$$
or
$$
x_2 = g \star x_1
$$
where $\star$ is convolution, and $h$ and $g$ are the impulse responses of LTI systems. Presumably, $g$ is the inverse of $h$ so that $g \star h = 1$.
Is it possible that both $g$ and $h$ are stable and causal?


texts: What is the best way to spatialise a real-time stream of a speech? Developing a C++ engine

texts:
I'm working on a mobile application in C++. The app brings listeners to a virtual room to listen to real-time streams, such as interviews, talks, lectures. The idea is to make sound immersive, to give the user a feel like he or she is in the real room and able to localize speakers (2 speakers for example). I've tried Steam Audio SDK adjustments for different kinds of room properties, but it doesn't seem for me realistic enough. I have an idea to try real-time convolution reverb working on selected (or self-recorded) IRs.
The idea is to get a binaural microphone and record a pair of IRs for each ear for a couple of rooms. Then to unfold the reverb for each ear with a custom C++ convolution reverb in real-time, having the sound more natural in the end.
Does somebody know any well-made custom C++ convolution reverbs that I can try or maybe has further advice on the processing approach?
PS. Surely there's gonna be issues with users' listening devices. But such functionality would be a good option for those who have a good pair of headphones.
Thank you.


texts: How to deconvolve dependent part of signal from independent part?

texts:
I have a problem of the following form.  There are two signals, x(t) and y(t).  The model for the system is such that:
$$x(t) = x'(t) + f(y(t))$$
where $f(y(t))$ is a variable offset introduced by interaction of $x$ with $y$.  The function $f$ is unknown.  As an additional constraint, $x'$ is expected to vary slowly and $y$ varies rapidly (and slowly as well).  $x$ has both slow and fast components as a result.  $f$ can probably be approximated pretty well by a linear function: it is monotonic increasing and fairly smooth.

The question is how to estimate $f$ and $x'$ given $x$ and $y$?

Sample data:

t = linspace(0, 100, 100)
y = sin(pi * t / 5) + t/50 + 1
x = sin(pi * t/100) + 0.05 * y * y

x in blue, y in green, xprime in red


texts: Basics of frequency spectrum for onset detection using FFT

texts:
I'm pretty new on signal processing and I've been reading a lot the last days in order to understand a little about it. But still there are things that I'm not sure if I got well. Sorry if I don't use the terms well.

I'm developing an application that detects onsets using a frequency spectrum, using KissFFT. Basically I apply FFT to 1024 samples, so I get 513 values (one for DC and the rest are the different values for each frequency range). I analyse the variations in each frequency range (each value of the resulting array from the FFT) in order to detect the onsets (comparing them to the values' mean from the past half second, and checking that the next values are lower). I want to know in which frequency the onset has been detected. So here are my questions:

As I'm analysing music, it doesn't make sense to consider the whole spectrum range, am I right? I mean, based on this, I should worry to check only until the 4k range.
So, in case the previous sentence is right, I shouldn't take all the 512 spectrum values, but only the first ones. So if my samples are at 44100Hz, and I have a spectrum with 512 values, each one should cover a range of (approximately) 86Hz. Is that correct? In that case, I should only analyse the first 47 array values and safely ignore the rest, I guess.
If I want to analyse a wider frequency, would be enough to sum the values from each frequency and calculate the mean? Is that correct?
What I'm doing is reasonable? Or I'm just making crazy random stuff?

Sorry for making such basic questions, as I said, I'm just entering in this and the more I read, the more confused I get. Thanks


texts: BPSK modulation under bandlimited channel

texts:
I modulated signal using BPSK modulation and I have series of -1 and 1. Now I have to pass these signal from band limited channel that has frequency response of the form $$\frac{s^2}{as^5+bs^4+cs^3+ds^2+es+f}.$$ Now I am thinking to convolve my -1 and 1 with time domain version of the above frequency response. I defined $a$, $b$, $c$... as a symbolic variable and I have their numerical value  however I need to have my impulse response in terms $a$, $b$, $c$... Therefore I would like to know:

How to find impulse response when the frequency response is order 5 in denominator? Matlab seems to give me error message when I leave the expression in terms of symbolic coefficients.
Is my reasoning correct to multiply square pulse shape with a carrier and then convolve it with the impulse response of the channel?
Also what do you think is a good way to demodulate the signal? would that be sufficient to multiply the received signal by my basis vector like cosine or sine?


texts: What is the DCT used for in Computer Vision?

texts:
DCT, what is the benefit of using it for image processing?

I noticed that it is used in JPEG compression.

Can i use it for something else?

Is it useful for motion detection?

Is it useful for compressing further? If I convert an image to its DCT I could remove the higher frequencies to zero, then convert back to image.  Would that make the image size smaller in bytes?

I have ordered books on Amazon about DCT but I cannot wait to start working with it.

In a brief synopsis/paragragh what could I consider DCT of an image for?

Thanks


texts: Scaling factor for comparing spectrums obtained via Continuous Fourier Transform and Discrete Fourier Transformation?

texts:
Essentially I am trying to calculate the Bremsstrahlung spectrum numerically for magnetized plasma and want to compare the resultant spectra with the standard textbook spectrum formula for unmagnetized plasma, which is calculated using continuous FT. There are at least three choices of scaling factors, namely scale by 1/N, 1/sqrt(N), or don't scale at all. Which scaling factor should I use? I want to compare both the shape as well as the magnitude of the spectrums.

I found this answer on MathWorks forum and judging by the second answer, I should use 1/sampling_frequency as the scaling factor but I am not sure about it. Any help is appreciated. Thanks in advance.


texts:
I am trying to get $X[k]$ when $x[n]$ is equal to

$$x[n] = \cos\left(\tfrac{\pi}{4}n-\tfrac{\pi}{4}\right)$$

I'm using this equation:

$$X[k] = \sum_{n=0}^{N-1}x[n]e^{-j \frac{2 \pi}{N}kn}$$

but I'm really getting stuck.
So far I have done Euler on the cosine and I am now trying to multiply the two exponents I get from this with the exponent on the right hand side of the equation that I have included above but I cannot get it into any form that I can convert using the DFT.

Does anyone know what I can do?


texts: Explain the Adaptive Part of Adaptive Algorithms - Kalman Filter and Least Mean Square / Constant Modulus

texts:
General questions:

Is the Kalman filter (they have used Unscented Kalman Filter) adaptive or not? Is the Unscented Kalman Filter used in the paper an adaptive algorithm?
Adaptive algorithms such as Constant Modulus and Least Squares are adaptive. Why? What is being adapted ? Based on my understanding, the step size is adapted and the weights as well. But I am not sure for the case of Kalman filters -- is the Kalman Gain getting adapted? Adapted to what?


texts:
The signal constellation for a communication system with 16 equiprobable symbols is shown as below. The channel is AWGN with noise power spectral density of $N_ 0/2.$Using the union bound, ﬁnd a bound in terms of $A$ and $N_0$ on the error probability for this channel.

Does the union bound means error probability?the solution said
$$P_e \le 15Q\left(\sqrt{\frac{d^2_{min}}{2N_0}}\right)=15Q\left(\sqrt{\frac{2A^2}{N_0}}\right)
$$

but why is

\begin{align}
&2\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)+3\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)+3\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)+2\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)\\
&+3\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)+4\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)+4\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)+3\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)\\
&+3\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)+4\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)+4\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)+3\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)\\
&+2\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)+3\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)+3\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)+2\cdot\frac{1}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)\\
&=\frac{48}{16}Q\left(\frac{A}{\sqrt{\frac{N_0}{2}}}\right)\quad{?}
\end{align}


texts: Does fading memory mean impulse response with finite support?

texts:
Given a continuous-time impulse response $h(t)$, bandlimited to $B$.
The discrete-time $h[n]=h(n/(2B))$ is then a unique and perfect representation of $h(t)$ and a discrete-time system $h[n]$ is then a perfect representation of $h(t)$ (impulse variance).
However, $h[n]$ generally requires infinitely many terms. I am looking for a name of systems $h(t)$ where $h[n]$ has finite terms (that means $h(t)$ has finite support) or can arbitrarily well approximated by finite terms.
Obviously the name for $h[n]$ (the discrete-time equivalent) is a FIR filter.
Is a system with fading memory the right term?
If not, why not and what is the right term?
PS: FIR seems to be a terms almost exclusively used for discrete-time systems. Why does it not exist for for continuous-time systems?


texts:
I am new here. I hope I can get help.

I want to ask a question regarding digital communication.

Does anyone know what are pulse shaping used for? Are they used for ISI mitigation or for something else? Also what is the receiver side of this operation is it matched filter?


texts: Calculate the harmonics in the power supply of $50\textrm{ Hz}$ using FFT

texts:
I need to calculate the harmonics in the power supply of $50\textrm{ Hz}$.
If suppose I need to calculate up to 20 harmonics.

Then my sampling frequency by Nyquist criteria should be :

$$f_s \ge 2 f_m$$

where $f_m$ will be of the highest harmonic frequency, i.e $f_m = 20 \times 50\textrm{ Hz} = 1000\textrm{ Hz}$.  So $f_s = 2000 \textrm{ samples/sec}$.

If the signal is $50\textrm{ Hz}$ then in this case, $T_{\rm period} = 0.02 \textrm{ sec} = 20\textrm{ msec}$. So in each $20\textrm{ msec}$ period I am taking $0.02 \times 2000 = 40$ samples per period of $50\textrm{ Hz}$.

So in this case do I need to do $40$ point FFT ?
Also if input signal is split into $40$ points then the output of the FFT is also $40$ different values. So this means the output is produced for $40$ harmonics not for $20$ harmonics is it right ?
How this has to be done at software level?

I will take a timer which interrupt at every $1/2000\textrm{ sec} = 0.5\textrm{ msec}$. On every interrupt take the ADC sample. So after $40$ interrupts ($20\textrm{ msec}$ is passed) I will be having buffer of $40$ samples then I will perform the $40$ point FFT algorithm to get the harmonics value, right ?

Then I will clear the buffer & again fill the buffer with new $40$ samples after $40$ interrupts ($20\textrm{ msec}$ is passed) then again I will perform the $40$ point FFT algorithm to get the harmonics value, right ?

As my FFT window is $40$ samples,  do I have to clear the buffer every time after the FFT is performed or I will shift the signal in the buffer to the right by $1$ (i.e. use array of $40$ as ring buffer or FIFO ) ?

Please suggest, is my calculation is right ?


texts:
In some publication I have found a formula that for some reason squares signal in time domain.
I am analyzing it now.

What should be the Fourier transform of a signal that was squared in time domain? I do not understand why $\mathcal{F}[sin(x)^2]$ results in peak in zero and why side peaks are moved.

I fully understand the fact that multiplication in time domain is convolution in frequency domain and squaring is just $x\times x$.


texts: How to apply two notch filters simultaneously

texts:
I have a sound file that I need to apply a notch filter to in Matlab.

comparing to original file I have two frequencies which are the noise. Applying a notch filter like this one:

wo = 1750/(44100/2);  bw = wo/35;
[b,a] = iirnotch(wo,bw);
fvtool(b,a);
f1 = filter(b, a, f);

This will atenuate the frequency at 1750 Hz. However there is one more frequency that is causing trouble at 820Hz. What I can do is reapply the same notch to the "new" version:

wo = 820/(44100/2);  bw = wo/35;
[b,a] = iirnotch(wo,bw);
fvtool(b,a);
f2 = filter(b, a, f1);

and f2 will be my clean file. However I need to have one vector "b" and one vector "a" that will clean all the noise at one go. Can I apply two notches simultaneously? I am very new to this kind of stuff. Thanks


texts: Why shouldn't the magnitude of a practically realizable frequency selective filter be constant for a range of frequencies?

texts:
According to Paley-Wiener theorem, a practically realizable frequency selective filter shouldn't have a constant magnitude for a range of frequencies. Why is this so? How do we prove and understand it?!

  To summarize, causality has very important implications in the design
  of frequency-selective filters. These are: (a) the frequency response
  $H(\omega)$ cannot be zero, except at a finite set of points in
  frequency; (b) the magnitude $|H(\omega)|$ cannot be constant in any
  finite range of frequencies and the transition from passband to
  stopband cannot be infinitely sharp [this is a consequence of the
  Gibbs phenomenon, which results from the truncation of $h(n)$ to
  achieve causality]; and (c) the real and imaginary parts of
  $H(\omega)$ are interdependent and are related by the discrete Hilbert
  transform. As a consequence, the magnitude $|H(\omega)|$ and phase
  $\Theta(\omega)$ of $H(\omega)$ cannot be chosen arbitrarily.

Point b in the quote. Source: Proakis ch.10 4th edition


texts: Why does gamma correction of image use two different definitions of gamma?

texts:
I've noticed that the gamma value used in level adjustment of Photoshop and Canvas is 'opposite' of gamma values defined in Wikipedia or MATLAB imadjust documentation.

In Wikipedia or MATLAB, high gamma (>1) will make an image darker, whereas in Photoshop high gamma (>1) will make an image brighter.

I've also noticed that, even among image processing software, Zeiss' Zen software uses high gamma (>1) to make an image darker.

There seem to be two definitions of gamma value. This is just confusing... I assume that this is related to 'gamma encoding' and 'gamma correction'. But can anyone explain the rationale of these two defintions and when to use which one?

Vout = Vin ^gamma % Wikipedia or MATLAB

Vout = Vin ^1/gamma % Photoshop or Canvas


texts: Linearity and shift-invariance of 2-D system on lattice

texts:
I know how to check a 1-D system for these conditions, but am confused about translating this to a 2-D system over a lattice. The system $H$ is define as:

$$w[\mathbf x] = H\left\{u[\mathbf x]\right\} = \sum_{\mathbf y  \in \mathbf Q} \varphi[\mathbf y] u[\mathbf x - \mathbf y],\quad\text{with}\quad\begin{cases}
&\mathbf x \in \Lambda \subset R^2,\\
&\mathbf Q = \left\{\mathbf q \in  \Lambda : \lVert\mathbf q\rVert \le \rho\right\},\\ &\quad \rho \in R,  \ 0 < \rho < \infty
\end{cases}$$

I have mainly done problems with very simple 1-D systems. I know that the summation part represents convolution and that the check for linearity is:

$$H\left\{af_{1}[\mathbf x] + bf_{2}[\mathbf x]\right\} = aH\left\{f_{1}[\mathbf x]\right\} + bH\left\{f_{2}[\mathbf x]\right\}$$

and the check for shift invariance is:

$$w[\mathbf x - \mathbf y] = H\left\{f[\mathbf x-\mathbf y]\right\}$$

However I can't figure out how to actually do these checks on this particular system.


texts: What will be the output when a square wave of time period 1sec is applied to the input of LPF of cutoff frequency 1Hz. Please help me, I am not getting the exact expression. What if cutoff of LPF is increased to 4Hz.


texts: How to normalize predesigned IIR filter coefficients to have unity gain?

texts:
There is a low pass filter with difference equation already provided.

$$
y_n = (x_n - 2x_{n-6} + x_{n-12}) - (-2y_{n-1} + y_{n-2})
$$

$$
a_0 = 1, a_1 = -2, a_2 = 1
$$
$$
b_0 = 1, b_6 = -2, b_{12} = 1
$$

However the filter was designed with some gain as the filtered output is significantly exceeds original signal dynamic range x1 = scipy.signal.lfilter(b, a, x)

Is it possible to normalize filter coefficients to have the same as input signal dynamic range or approximately redesign it from filter frequency response?


texts: "How is the noise floor of RF section is mapped to ADC noise floor for a 10MHz BW?"

texts: My interpretation is if a gain of 40 is used before AGC -40 dBm become 0 dBm and -121dBm (noise level) becomes -81dBm SNR remain same (assuming NF =0 for theretical purposes). Noise floor of ADC is (6.0212+1.76+ 10log10(100e6/(2*10e6) =- 81dBm assuming 100 Msps sampling rate. So the noise floor of ADC mapped to analog section (-121 dBm) below the KTB bandwidth(-174+NF+10log(10e6) = -101 dBm ). Is this correct ??


texts: What is the difference between phase delay and group delay?

texts:
I'm studying some DSP and I'm having trouble understanding the difference between phase delay and group delay.

It seems to me that they both measure the delay time of sinusoids passed through a filter.

Am I correct in thinking this?
If so, how do the two measurements differ?
Could someone give an example of a situation in which one measurement would be more useful than the other?

UPDATE

Reading ahead in Julius Smith's Introduction to Digital Filters, I've found a situation where the two measurements at least give different results: affine-phase filters. That's a partial answer to my question, I guess.


texts: Channel Impulse Response is zero mean Gaussian random variable?

texts:
In the Paper "Key Generation From Wireless Channels" the channel estimation is given as:
$\tilde{h}_{1,A} = \sigma_1^2 + \frac{\sigma^2}{||S_B||^2}$,
$\tilde{h}_{1,A} = \sigma_1^2 + \frac{\sigma^2}{||S_A||^2}$

So the different $\tilde{h}_{1,x}$ are zero mean Gaussian random variables with some variance.

At the end, they calculate the secret key rate by

$R_s = \frac{1}{T} I \left( \tilde{h}_{1,A}, \tilde{h}_{1,B}  \right) = \frac{1}{2T} \log\left( {1+\frac{\sigma_1^4 P^2 T^2}{4(\sigma^4+\sigma^2+\sigma_1^2PT)}} \right)$, there P is power and T is the coherence time.

I would like to calculate that for WiFi at 2.4 GHz. I'm searching for a typical value for the variances $\sigma$ and $\sigma_1$. In addition, a value for 60 GHz would be also awesome.


texts: Scipy visualize Linear filter using numerator coefficients

texts:
Python scipy signal package has a function freqs to get the frequency response of a linear filter from [b, a] numerator and denominator. So, I should be able to get the response using the code below
w, h = scipy.signal.freqs(numerator, denominator)

I created an FIR filter (equiripple) using matlab as follows and got the corresponding numerator values into python

As I figured out from this question, I should set the denominator to either [1, 0, 0, ...] or just [1]
Here's the code I use to plot the frequency response (I want to reproduce the plot Matlab tool showed me so I'm not using a log x axis)
from scipy import signal
import numpy as np
import matplotlib.pyplot as plt

w, h = signal.freqs(numerator, denominator, worN=np.arange(0, 4001))
plt.plot(w, 20 * np.log10(abs(h)))
plt.xlabel('Frequency')
plt.ylabel('Amplitude response [dB]')
plt.show()

When I use denominator as [1, 0, 0, ...], I get this output plot
denominator = np.zeros(len(numerator))
denominator[0] = 1

When I use denominator as [1], I get this
denominator = [1]

Neither of these are the expected plot. But when I use the same numerator with scipy.signal.lfilter, I get the expected filtered output. Both [1, 0, 0, ...] and [1] denominator works similarly in that case.
x_filtered = signal.lfilter(numerator, denominator, x)  # x is my input signal

What am I missing here?

Here's the numerator coefficients I got from Matlab filterDesigner tool
numerator = [0.0004505121978623484, 0.0015391270577797295, 0.0034849738530219137, 0.0059935571891852986, 0.008153435576056406, 0.00859295274071084, 0.00606548279898037, 0.0002846755213858822, -0.00742297904630505, -0.014153857203798368, -0.016427408828624798, -0.011924076853454632, -0.0011931648752793917, 0.011684815603418677, 0.020213206095187067, 0.018298423359451726, 0.003718245377587605, -0.019451127400893112, -0.04099016948947245, -0.04779531970776775, -0.029274426761207544, 0.01733488350917493, 0.08424518003037892, 0.1546060172782279, 0.20800438955526646, 0.2279136247956023, 0.20800438955526646, 0.1546060172782279, 0.08424518003037892, 0.01733488350917493, -0.029274426761207544, -0.04779531970776775, -0.04099016948947245, -0.019451127400893112, 0.003718245377587605, 0.018298423359451726, 0.020213206095187067, 0.011684815603418677, -0.0011931648752793917, -0.011924076853454632, -0.016427408828624798, -0.014153857203798368, -0.00742297904630505, 0.0002846755213858822, 0.00606548279898037, 0.00859295274071084, 0.008153435576056406, 0.0059935571891852986, 0.0034849738530219137, 0.0015391270577797295, 0.0004505121978623484]


texts: How to demonstrate the orthogonality of OFDM subcarriers?

texts:
Assume if we have $N$ OFDM subcarriers represented  by results of the inverse FFT of $N$ data symbols $\mathbf x$. As I know, the subcarriers of OFDM should be orthogonal. It means that
$$X(n)X(n+1) = 0\quad\text{where}\quad n = 0,\ldots,N-1$$
My question is that I can't get that right when doing it in MATLAB. For example suppose that $N=4$ and
$$\mathbf x = \begin{bmatrix}
0.7+0.7i\\
0.7-0.7i\\
-0.7+0.7i\\
0.7+0.7i\end{bmatrix}$$
is a data symbols gotten after QAM modulation.  The OFDM $N\times 1$ subcarriers are gotten by iFFT of the data symbol as below:
X = ifft(x)*sqrt(4);

It means that
$$X = \begin{bmatrix}
0.7+ 0.7i\\
1.4 + 0.0i\\
-0.7 + 0.7i\\
0.0 + 0.0i\end{bmatrix}$$
Then,
$$\begin{align}
X(1)\cdot X(2) &= (0.7000 + 0.7000i)\cdot(1.4000 + 0.0000i)\\
& = 0.9800 + 0.9800i
\end{align}$$
If subcarriers are orthogonal, that wil be zero.
Thus, my question, how can I demonstrate the otrhognality of OFDM subcarriers ?


texts: Matching guitar signal with tablature, near real-time algorithms?

texts:
I'm looking for candidate algorithms that might work for a use-case comparable to Rocksmith's analysis system. To compare a clean electric guitar signal with a tablature reference.

A higher latency is acceptable, as well as compromises in accuracy, but the goal is to have near real-time information on whether what you actually played, is within a threshold of what you were expected to play.

The output would be a probability value per expected strum (or pluck or tap). Which is then matched against a configurable threshold.

My current line of thinking is to take multiple algorithms and predetermine which algorithm should be used per segment of the song.

One for chords (compare lowest note & 12-bin PCPs?)
One for sustained / single notes (FFT cross-correlation?)
One for fast or polyphonic riffs (Supervised training? Classification models? Don't know.)
One for bends... etc.

My two question are:

Is a (context-sensitive) combination of sub-algorithms required for such a use-case?
Which algorithms would make good candidates for the individual tasks, given this use-case?

Bonus question:
do any "master" algorithms already exist to do such switching / tweaking of sub-algorithms?

Extra details,

What is considered acceptable processing time depends on the reference. For example if you're instructed to play a sustained single note for 3 bars, it's perfectly acceptable to do a slow analysis of the plucking envelope.

However if you're instructed to play a solo, alternating picking and hammering, 1/16th notes and bends. You're working with shorter samples, more human error and residual noises while playing. But we still need to attribute a binary decision if it was "close enough" for each note within, say ~200ms after each note was supposed to be released.

The guitar signal comes directly from a dedicated USB guitar audio interface, making it single instrument and a good quality signal.

The tablature is highly detailed. Assume a modern guitar pro format. Making relatively accurate training samples possible, but they will not contain the characteristics of the exact guitar, pickups, noise, etc. that the guitar signal would have.


texts: Wavelet, scaling, detail, and smooth/approximation coefficients

texts:
I was reading through the documentation for the R wavelets package and doing a little experimentation and noticed that the modwt and mra functions have similar outputs, yet the coefficients are called different things.  The modwt function produces wavelet and scaling coefficients (W and V), whereas the mra function produces detail and smooth coefficients (D and S).
library("wavelets")

mod = modwt(data.frame(X=c(1,2,3,4)), filter="haar", n.levels=3)
wtrma = mra(data.frame(X=c(1,2,3,4)), filter="haar", n.levels=3, method="modwt")

What I'm trying to figure out what the differences are between these two sets of coefficients and how they work together (assuming they do), especially since the mra function can take a method of "modwt".
I did see this explanation of scaling versus wavelet coefficients, however, I'm not sure if the example aligns with MODWT.  I'm specifically trying to learn about multiresolution analysis as I understand it can fit with ensemble machine learning regression strategies and I saw some references to it specifically being used with MODWT, but I seem to be lacking the basics in terms of wavelet transforms.  I think part of the confusion is that multiresolution analysis is a term used for wavelet transforms, however modwt is described in the R package as a type of wavelet transform and it's distinct from the mra function.
If anyone can suggest an online course, that would also be helpful.


texts:
I have a mystery audio signal that I need to decode, it's from a discontinued product. Inspecting the object code shows a module called decodeFSK so that suggests it is a form of FSK. I've tweaked it in MATLAB ad-nauseum but think I must be missing something.

The only documentation I can find says:

  "[Binary data is PCM encoded PPG sensor waveform. 68bits of binary data are sent in 12msec bursts at 25Hz.] Current modulation scheme used is Manchester encoder/decoder. Modulated signal is a square signal with frequency range from 4kHz to 8kHz."

Not sure if the 4-8kHz part is correct, as I don't see much there?

Inspecting the signal spectrum shows frequency peaks at 12.4kHz, 6.2kHz, and 200Hz.

Here's a closeup of the peak at the 12.4kHz carrier. Is this perhaps BPSK instead of FSK?

here is the waveform and my attempts to decode it so far:
waveform sample
| matlab file

Any help much appreciated!


texts: Adjust Matlab Gui parameter while playing an audio

texts:
I would like to design a very simple MATLAB Gui program to adjust the magnitude of an audio while it is being played via a slider (slider1). However, the program any adjustment will not response until the audio is finished playing. How could I fix this?

The audio is played after a push button is pressed

function PlayFile_Callback(hObject, eventdata, handles)
%Reading the audio file
FrameSize = 2048;
AR = dsp.AudioFileReader('Filename','test.wav','SamplesPerFrame',FrameSize);
Fs = AR.SampleRate;
%initializing audio player
AP = dsp.AudioPlayer('SampleRate',Fs);
tic
Tstop = 30;    %playing time

 while toc < Tstop
    gain = get(handles.slider1,'value');  %Get the gain factor
    audioIn = step(AR);
    audioOut = audioIn*gain;
    step(AP,audioOut);
end


texts: Hilbert transform to compute signal envelope?

texts:
I've heard that the Hilbert transform can be used to calculate the envelope of a signal.  How does this work? And how is this "Hilbert envelope" different from the envelope one gets by simply rectifying a signal?

I'm interested specifically in finding a way to calculate an envelope for use in dynamic range compression (i.e., "turning down the volume" of the loud parts of an audio signal automatically).


texts: Stability of the Low pass filter after Spectral Transformation

texts:
Using a spectral transformation a filter $G(z^{cap})$ is
designed to be a low pass filter from an existing lowpass filter $G_{lp}(z)$ via $G(z^{cap}) = G(z)z=H(z^{cap})$
.  Which property should H(z) have in order to preserve
stability of the designed filter?


texts: Finding local brightness maximas with OpenCV

texts:
I want to find points (of a processed image) that are the brightest in their local region.

Basically, I want all of the points whose 8 neighbors are all smaller but I want to have brighter maxima block out nearby dimmer maxima. So, for example, the 8-neighbor maximas could be sorted by descending brightness then yielded in order while excluding points covered by previously-yielded points.

I know how to implement this logic, but because I'm using python there's a huge runtime speed advantage to using built-in opencv/numpy functions.


texts: Definition of sampling using delta or indicator function?

texts:
I just came from a class where the professor showed a slide with the definition of sampling:

But I do not understand how we can multiply a signal $x(t)$ with the delta function $\delta(t)$, as the $\delta(t)$ is infinite at $x=0$. So this multiplication would amount to multiply a real-valued function with $\infty$ which is obviously not what is meant here. I think.

So would it make the formula formally correct if we would swap the $\delta(t)$ with the indicator function?

$$\mathbf{1}_0(x) =
\begin{cases}
1 &\text{if } x = 0, \\
0 &\text{if } x \neq 0.
\end{cases}$$


texts: mathematical equation for Power Line communication channel

texts: How can I derive the mathematical equation for the powerline communication channel to capture the input data signal, the power line channel, and noise?


texts:
I'm trying to compute FFT of size (N/2) for sequence of real values of length N. I'm using this recipe.
Here is my code in matlab:

clear;
clc;
x = [1, 2, 3, 4, 5, 6, 7, 8];
n = length(x);
z = [1 + 2j, 3 + 4j, 5 + 6j, 7 + 8j];
Z = fft(z);
Fe = (Z + (conj(Z)))/2;
Fo = (-1j*(Z - (conj(Z))))/2;
for k = 1 : n/2-1
     F(k) = Fe(k) + exp(-1j * 2 * pi * ((k-1)/n)) * Fo(k);
end;
F(n/2) = 0.5*(Z(1) + conj(Z(1)) + 1i*(Z(1) - conj(Z(1))))
fft(x)

Obviously, I get wrong result (at least I think it's wrong). As far as I understand, first four terms of F and fft(x) should be equal.

The part that confuses me is when I compute Fe and Fo I'm using fliplr(conj()) to get Z(N/2) - k)*, I'm not sure, if it's the proper way to do this.


texts: Costa's loop questions, design, tracking and limitations

texts: Why does Costa's loop PLL bandwidth need to be narrow? and why can't it track a certain frequency offset? and does that hold even if it has a filter with a pole at DC?


texts: Fourier transform of a Fourier transform

texts:
I generate a Gaussian noise and then I filter it with a passband FIR Kaiser window filter. When I perform the Fourier transform of the output of the filter and plot its magnitude spectrum, it is filtered in the correct frequency band. Now, I perform a second Fourier transform on the output of the first Fourier transform (I'm performing it on a complex vector this time and in the frequency domain), and when I plot the magnitude spectrum I see something very similar to the original filtered noise. I know this isn't time domain, I know this spectrum is not even because the input signal is complex. But as the time plot of the filtered noise and the absolute value plot of the Fourier transform (of the Fourier transform of the noise) are visually similar a doubt arised on me.

Why is the amplitude spectrum of the complex vector obtained after performing a Fourier tranform on the filtered noise once again occupying the whole vector (the whole frequency band) as if they were time samples spread in the time vector?
Is the negative symbol in the inverse Fourier transform of the Fourier transform of the noise having no effect so that it is visually similar performing a Fourier transform of Fourier transform of noise and performing an inverse Fourier transform of Fourier transform of noise?

This doubt arised to me when I was trying to filter on a matched filter implemented in Matlab using IFFT(FFT(signal_1).*FFT(signal_1_inverted)) and I accidentally filtered the output of an already Fourier transformed signal and coudn't notice the difference (not on the output of the filter but on the output of the first FFT stage). And this leads me to another question.

Suppose I would like to detect the likelihood of 2 signals by comparing their spectrums and I want to measure the likelihood by using a matched filter. Knowing that the convolution in time is the multiplication in frequency, is the convolution in frequency the multiplication in time and I get the same result if I use a matched filter (sort of convolution operation) on the spectrums than if I perform a sample by sample multiplication in time domain of the signals whose spectrums likelihood I want to determine?


texts: What modulation is done when I connect a signal source to a USRP block in GNURadio?

texts: When I connect a sinusoidal signal source to a USRP sink and upconvert the frequency, what modulation is done to convert the baseband signal to a passband signal?


texts:
Is there any way to synchronize phase of output of inverse DFT in each buffer? When I send the output of inverse DFT to the speaker it sounds nasty.

Of course I know the windowing functions but it just gives me in/decreasing level at the beginning and the end of buffer. It sounds better but with tremolo effect. I’ve also heard about overlapping windowing, I haven’t tried that but I am pretty sure it also won’t give me clean signal. Probably it will give me some phasing/chorusing effect that will appear periodically on each beginning and end of buffer. So I wonder how to repair that?


texts: What is the current "state of the art" in future audio sample prediction, given recent developments in "image inpainting" using deep learning?

texts:
In the last few years, there have been many breakthroughs in the image processing world regarding repairing "damaged" images, images with corrupt pixels, or even reversing artefacts from formats such as JPEG, which have received media attention. I am trying to determine if these methodologies can similarly be used to predict future samples of audio, rather than pixels of an image.
Some examples:

https://www.engadget.com/2018-04-24-nvidia-ai-fixes-photos.html
https://www.dpreview.com/news/3422748291/this-neural-network-can-fix-damaged-photos-and-enhance-low-res-shots
https://heartbeat.fritz.ai/guide-to-image-inpainting-using-machine-learning-to-edit-and-correct-defects-in-photos-3c1b0e13bbd0

much of which derives from an NVIDIA thesis published in EECV 2018: Image Inpainting for Irregular Holes Using
Partial Convolutions, EECV 2018.
In theory, this basic method should have a direct analog to audio: where, rather than predicting missing pixels, we're trying to predict the next ms or so of future audio from the last second. So, it can really be thought of as a type of nonlinear prediction, which clearly performs very well.
QUESTION: What is the state of the art in using this method for audio processing rather than image processing? Is there any published literature on this? Does anyone have any references?
Below are some examples of the technique that I am talking about in the image processing realm. In all these situations, the missing pixel data is reconstructed from the remaining pixels, which is basically 2D sample prediction; I am hoping to get some insight into the 1D analog of this.


texts: Using only positive frequencies in fourier domain, How will it affect the ifft?

texts:
I am going to do some kind of transformation and transform a data to another domain, and again back to the first domain. For this, I take a fourier transform of the data and separate the positive part and I use the positive frequencies only.

I know that for example in the frequency domain of a wavelet we have positive and negative frequencies. what will be the effect of using only positive frequencies?


texts: How to Remove Gaussian Noise from an Image without Destroying the Edges?

texts: What is the best filter for removing Gaussian noise without destroying the edges? I am using the standard Lena images with additive Gaussian noise and I want to denoise before applying anisotropic diffusion. I don't want to median filter because edges become blurred. I tried adaptive filtering but results were not satisfactory.


texts: Analytic solution for non-flat filter design

texts:
I'm trying to write an accelerometer calibration script that uses filters to convert from volts into $m/s^2$.  As accelerometers tend to have non-flat response curves, this means I have to design a rather complex filter.  I'm not worried about phase, as I can just apply the filter twice in opposing directions to correct for any phase offsets (like matlab's filtfilt), so the focus is on designing a filter that approximates a user-provided magnitude curve.

Ideally, the user provides a calibration curve as input into an analytic algorithm to solve for the best fitting filter poles.

I'm aware MATLAB has a filter design function, but I don't know what the underlying algorithm is (if its an optimizer, or a closed form solution).

So my question is...

Is there an analytic solution to my filter design problem?  Or do I have to use optimisation scripts to get the best filter?

I'm not mentioning programming language here, as I want to understand the underlying math behind this.


texts: Are there any advantages of undersampling or oversampling in signal processing point of view?


texts: Error implementing Harmonic Product Spectrum algorithm

texts:
I'm trying to find the fundamental frequencies present in a piano recording using MATLAB. These are the steps I've followed;

Find the envelop of the signal
Find the note onsets
perform FFT between each onset
Harmonic product spectrum.

It's when I try to implement the HPS algorithm that I face a "dimensions don't agree" error. This is the whole code that implements the HPS algorithm .

**% In harmonic prodcut spectrum, you downsample the fft data several times and multiply all those with the original fft data to get the maximum peak.
    %HPS
    seg_fft = seg_fft(1 : size(seg_fft,1)/2 );
    seg_fft = abs(seg_fft);

%HPS: downsampling
for i = 1:length(seg_fft)
    seg_fft2(i,1) = 1;
    seg_fft3(i,1) = 1;
    seg_fft4(i,1) = 1;
%   seg_fft5(i,1) = 1;
end
for i = 1:floor((length(seg_fft)-1)/2)
    seg_fft2(i,1) = (seg_fft(2*i,1) + seg_fft((2*i)+1,1))/2;
end
for i = 1:floor((length(seg_fft)-2)/3)
    seg_fft3(i,1) = (seg_fft(3*i,1) + seg_fft((3*i)+1,1) + seg_fft((3*i)+2,1))/3;
end

for i = 1:floor((length(seg_fft)-3)/4)
    seg_fft4(i,1) = (seg_fft(4*i,1) + seg_fft((4*i)+1,1) + seg_fft((4*i)+2,1) + seg_fft((4*i)+3,1))/4;
end

%HPS, PartII: calculate product
p1 = (seg_fft3)  .* (seg_fft4);
p2 = p1.* (seg_fft2);
p3 = p2.* (seg_fft);

HPS, PartIII: find max
[f_y1,I] = max(p3)

 for c = 1 : length(p3)
     if(p3(c,1) == f_y1)
         index = c;
     end
 end

 % Convert that to a frequency
 f_y(h) = (index / NFFT) * FS;

 h = 1;
 h=h+1;
f_y = abs(f_y)';

 end**

Before implementing p3 = p2.* (seg_fft); the sizes of seg_fft, seg_fft2, seg_fft3, seg_fft4 all have the same dimensions of 16384 1. Then when I DO implement p3 = p2.* (seg_fft); the size of seg_fft changes to 8192 1 while the sizes of rest remain at 16384 1 thus causing an error in multiplication as the dimensions aren't the same.

I'm really confused as to why this keeps happening and nothing I try seems to work out. Would really REALLY appreciate some help here... If someone could fix this code it'd be a GREAT help... Thanx in advance.. I'm real desperate here......


texts: Do you know a reference (book, article) which gives (with a proof) the theoretical BER in the CDMA protocol for a differential modulation?


texts: Am new to signal processing and was wondering when given two signals, what are the widely used statistical analysis methods to understand the relationship between them?


texts: Programmatically (e.g. in Python) adding clipping to an audio file?

texts:
I am trying to replicate the audio artifact exemplified here to a set of 1000 audio files. In particular, I would like to be able to 'clip' the louder parts of each sound clip so they become distorted as in this video. Is there a way I can do this with a script?

Thanks!


texts: Can IR emitter signal be distorted by curved glass housing around receiver?

texts:
I have built a garage door opening circuit that includes an IR sensor and an IR emitter (a remote control). When the IR sensor is in the open air it works fine.

If I put the sensor inside a glass jam jar, the signals received are different but sometimes consistent, ie. each button on the remote returns a consistent (wrong) signal from the receiver.

My understanding is that the signal is a combination of high/low pulses with different duration.

Could the jam jar's reflection and refraction be impacting the length of the pulses? If not, how can this effect be explained?


texts: Can the DFT can be performed without normalization?

texts:
If we have OFDM system with $N$ sub-carriers, the DFT matrix can be expressed as follows:
$F = dfmtx(N)/sqrt(N)$
My question, is it possible and practical to use the matrix without Normalization, it means use the iDFT as $F = (dfmtx(N))'$, and then at the receiver end, I will multiply with  that matrix and divided by $N$  (like this $dfmtx(N)/N)$ to get scalar diagonal matrix whose diagonal elements are 1?
thank you


texts: Extracting the talking (lyrics) from an audio in python

texts:
I am new in signal processing and I want to extract the talking (lyrics) of a person from a sound so I can analyze it ;another application would be if that person is talking and there are many sounds behind him the applications will detect his sound only.

I have read many articles about single processing like (analog to numeric,FFT,Gaussian, FTD , Correlation  ..... ) but I can't combine those all information together because i am new in this domain like i said before.

please  someone help me I am totally lost
---> sorry for my English <----


texts: I have seen people using 10*log10 and/or 20*log10 while converting magnitude to dBs. What are the differences and which one is valid?


texts: Why do we need to have unity gain at DC for a lowpass filter?

texts: I have seen many times, including in a post on this forum, that it is recommended to have unity gain at DC for a lowpass filter. I would like to now the mathematical explanation.


texts: Designing a discrete-time inverse system

texts:
I am trying to design a discrete-time inverse system to eliminate an undesired echo in a data transmission problem.

The echo caused by the transmission channel is represented as attenuation by a factor of 0.9 and a delay corresponding to one time unit of the input sequence.

The received signal $y[n]$ can be expressed as follow;

$$y[n] = x[n] + 0.9x[n-1]$$

So basically, I'm trying to determine the unit impulse response of a causal inverse system to discover $x[n]$ from $y[n]$.

Conceptually, I'm thinking I need to connect a system $h_2[n]$ in series with the system $h_1[n]$ such that $h_1[n]*h_2[n] = \delta[n]$.

Can anyone offer some advice on how best to go about this ? I've been searching online but can't find a concrete example to use as a starting point.


texts:
Why Filter Kernel is flipped during convolution process? What are the consequences if the kernel is not flipped?

Note: Filter Kernel means: Impulse response or convolution kernel.


texts: STFT output frequency does not match sin wave frequency

texts:
I have the following function and pre definition for producing a sin and its' stft:
fs=48000
nfft=2048
hop_len=nfft/2
win_len=2048
nfft = next_greater_power_of_2(win_len)

def sinus_gen(f):
   np.expand_dims(np.sin(2*np.pi*f*np.arange(fs*20)/fs).astype(np.float64)...
    ,axis=1)

I am trying to generate and plot an 8KHz using the following stft command:
audio=sinus_gen(8000)
s=librosa.core.stft(audio[:, 0], n_fft=nfft, hop_length=hop_len,
                                        win_length=win_len, window='hann')
librosa.display.specshow(librosa.amplitude_to_db(abs(s)),x_axis='time',y_axis='log',cmap='jet')
plt.title('Power spectogram before beamforming')
plt.colorbar(format='%+2.0f dB')
plt.clim(-60,30)
plt.tight_layout()
plt.show()

I am getting the following spectrogram image, which shows 4000KHz for some reason:

Why am I not seeing the expected 8000KHz frequency? what am I doing wrong?


texts:
Does anyone have a ressouce on how I can calculate second order section bandpass coefficients?

What I tried allready:

I used following formulas from the Book Electronic Circuits (U.Tietze, Ch. Schenk) for the Lowpass:
My coefficients match exaclty (difference is max 2e-14) with the second order sequions of MATLAB for the same lowpass.

For a bandpass filter I used following formulas:

The results differ quite alot from MATLAB, expecially if the order is higher than 2.
Also I dont think I can apply the formulas direcly for second order sections because the coefficients only depend on constant values.


texts: Fourier transform of an integrator filter

texts: I have to find the Fourier transform , and $y(t)$ of an $ x(t) = e^{- \frac {t}{T} } u(t) $ that passes into a integrator filter. I know that $ Y(f) = X(f) H(f) $ so I first calculate the Fourier transform of $x(t)$ and I found that $ X(f)= \frac{T}{1+ i2\pi fT} $. Now I don’t know how to calculate the step response of the integrator filter. After, using inverse transform I should obtain $y(t)$.


texts:
I have the moving-average mask as

   mask = [1 1 1; 1 1 1; 1 1 1];

and then I compute the convolution 3 times

   imageF = conv2(conv2(conv2(originalImage, mask), mask), mask);

I want to know how can I get an equivalent mask to compute the filter with just one convolution

   imageF = conv2(originalImage, equivMask);


texts: Removing the 'red' artifact from my JPEG

texts:
I have a JPEG that originally came from a IP Camera. I have converted the JPEG to a bytes and have uploaded it to my server. Upon receiving it on my server I save it to disk.

When I view the image it looks 'grainy' and 'reddish'.

When I perform a contrast stretch I get this:

When I perform a Hist-Equalization I get this:

N.B.
I have also tried a filter just on the Red Channel:

Image<Bgr, byte> CurrentFrame = new Image<Bgr, byte>((Bitmap)picOriginal.Image.Clone());
CvInvoke.cvSmooth(CurrentFrame[2], CurrentFrame[2], SMOOTH_TYPE.CV_GAUSSIAN, 3, 3, 1.5, 0);

Is there another approach so I could make the image look better, 'balanced', if that makes sense?


texts:
If a signal contains frequencies from $500$ to $1000\textrm{ Hz}$, what is the Nyquist sampling frequency, $2$ times $500$ or $2$ times $1000$?

Twice the highest frequency of the signal, or twice the bandwidth of the signal?


texts:
I'm  looking for a tool\method which allows me to design a filter without involving the frequency response at all.
Specifically, I'm trying to design a simple FIR smoothing filter for an emmbedded system which reads different analog sensors. My sampling rate is 1kHz and I'd like to generate an FIR filter with 0-overshoot and a smoothing effect (e.g. in attached pic).

The different tools I found (including MATLAB) all involved a design around a LP filter, which means I have to analyze the frequency response of my system.

Any relevant tools\methods out there?


texts:
I need to understand what a snapshot of a signal is.
Suppose I have a signal of duration, say, 10 microseconds from multiple channels and that the ADC samples every 20 nanoseconds from each channel. Is the signal acquired at each clock cycle from all channels a snapshot or the data acquired for complete 10 microseconds from all channels is one snapshot.


texts: Detecting sloppy hand-drawn arrows in images

texts:
How can I easily and efficiently detect hand-drawn arrows and their directions from an image?

They're probably drawn lightly, with something like a pencil, on a piece of paper.

If I had implemented a system for fitting straight lines to hand-drawn lines, I'd probably look for 3 lines that roughly shared an endpoint and that formed approximately 45 degree angles. However, this is only half a solution, and I don't know if it's a very good approach.

How should I approach this problem?

If possible, I'd like to have a simple solution over the most efficient solution because I'm a 9th grade math student with limited knowledge, but that's not a requirement


texts: Question about harmonic calculations and other functionals for image analysis

texts:
I am implementing a method known as trace transform for image analysis. The algorithm extracts a lot of features of an image (in my case features pertained to texture) using a set of transforms on the values of the pixels. Here is a paper describing the algorithm: (PDF link).

The algorithm finally constructs a "triple feature" which is a number that characterizes the image and was calculated by applying a first set of transforms on the pixel values extracted by all the tracing lines going through the image at all angles. On the paper you can see this description starting on page 2, Figure 1 shows an abstraction of such a tracing line which is defined by its angle (phi) and the distance (d) of the line from the center of the image. So we can describe each tracing line by the pair (phi,d).

Now on the next page on the paper (page 3) we have Table 1 which is the set of functionals that is applied to the pixel values extracted by the tracing lines. Each of these functionals applied to all the tracing lines generates another representation of the image. Then another set of functionals (those that appear on Table 2 on page 4) are applied to the new representation of the image along the columns which is basically along parameter d generating, this way, another new representation of the image.

Finally another set of functionals is applied to this last representation which is an array of values over parameter phi which was the angle parameter (that means we have 360 values describing the image, one for each angle of the tracing lines). You can see these functionals in the paper on Table 3 page 4.

Now some of this last set of functionals that have to be applied to the last representation of the image over parameter phi need to calculate the harmonics of this set of 360 values. First I need to calculate the first harmonic and then the amplitude and phase of the first through fourth harmonic but I don't know how to do this.

You can read the first couple of pages of the paper since it's probably better explained there. And figure 1 makes it clear what I mean by tracing lines and the representation of each line by the (phi,d) pair.

Other functionals I have trouble with since I don't know if I'm understanding them correctly are:

$$
 \text{c so that:}\sum_{i=1}^cx_i=\sum_c^Nx_i.
$$

where $x_i$ is one of the values and $N$ is the total number of values.

So my doubt is with what the result should be. The source (the paper listed above) has nothing else to contextualize this functional that's all it says so I'm interpreting that the result is $c$ rather than the sum of $x_i$ until $c$ right?

So let's say I have this set of numbers {2 2 3 1} where each number is one value $x_i$

So the above functional will tell me $c=2$ but the result of the sum is 4. So which should I take as the result in this case given the above functional?

The other functionals I'm having trouble with are related to the calculation of harmonics based on the dataset extracted from the image:

$$
\text{i so that } x_i=\min_{i=1 \ldots N}x_i\text{ without the first Harmonic}
$$
$$
\text{i so that } x_i=\max_{i=1 \ldots N} x_i\text{ without the first Harmonic}
$$
$$
\text{Amplitud of the first Harmonic}
$$
$$
\text{Phase of the first Harmonic}
$$

all the way to

$$
\text{Amplitud of the fourth Harmonic}
$$
$$
\text{Phase of the fourth Harmonic}
$$

I really don't know how to calculate a Harmonic or the amplitude or phase of it for the values. If someone more knowledgeable than me on image analysis can look into the paper linked above and provide me some tips I'll be greatly appreciated.


texts: Frequency-selective channel: Basic in theory

texts:
In a lecture, it was covered a topic "frequency selective and flat fading channel models".

For case, the frequency selective channel we have a channel impulse response H for each frequency,  is varying in frequency.

Last week I have a lab task where I have implemented the different precoding algorithms. Now I am thinking about how you calculate a precoding matrix for the frequency selective channel. You have more than one channel response, so you have to calculate for each of them. A calculation takes long. Of course, Matlab can do that very fast but you can have more than thousands response and it takes a long for Matlab too. How do you calculate in that case a precoding matrix? Do you take an average?

Thanks in advance

Best regards

Noel


texts: Image 2D Real Cepstrum with DFT, Is `ifftshift` Needed?

texts:
This is my testing image,it is taken from this paper:

I tried to transform it into its real cepstrum domain with this simple MATLAB code:

cepstrum_img=ifft2(log(1+abs(fft2(img(:,:,1)))));
imshow((abs(cepstrum_img)))

But my result is very weird: The maximum is not at the center of image, they are at the 4 corners. And here is the zoomed-in picture with the  maximum at the left top corner:

But the result in this paper is like this:

The maximum is actually at the center!!

As I didn't do any fftshift ,  I don't think I need to do any ifftshift.

This makes me so confused. Is there something wrong with my code?
or my understanding about 2D real cepstrum with DFT?

UPDATE 1: Why do I think that fftshift or ifftshift is not needed here.

For a length-$N$ sequence $x[n]$, you do an $N$-point DFT. You will get another length-$N$ sequence $X[n]$. The first element of the resulting sequence is corresponded to the zero frequency. Then we do fftshift to the resulting length-$N$ sequence, and we get a third length-$N$ sequence $X'[n]$, because we want to make the center (may not be at the center if $N$ is even) of the element in $X'[n]$ corresponded to the zero frequency.

The question is how can you get the original  $x[n]$ with IDFT?

$\textrm{IDFT}(X[n])$ is right. $\textrm{IDFT}(X'[n])$ is wrong.

Check this MATLAB code:

% the original sequence
x=1:8
% this will give you the original sequence
ifft(fft(x))
% but this won't
ifft(fftshift(fft(x)))
% anyway, the amplitude is the same.

The case would be the same for images and fft2 & ifft2. i.e.this will get you the original img:

 ifft2(fft2(img))

And if the cepstrum is defined as

$$C=\mathcal F^{-1}\left\{\ln\left(\lvert \mathcal F\left\{I(x,y)\right\}\rvert\right)\right\}$$

Where $I$ = img. This is something like transforming from Fourier domain back to the spatial domain.

UPDATE 2: I found where I am wrong..

When the papers are saying

  The Cepstrum (Calculated with FT) has the maximum at the center

I misunderstood it as

  The Cepstrum calculated with DFT & IDFT has the maximum at the
  center

If the Cepstrum above is really calculated with Fourier transform, the Cepstrum will be with the maximum at the origin. That means if I calculate this with DFT & IDFT,the maximum should be at the corners. The same as FT vs DFT, I have assumed the Cepstrum calculated with DFT should have its maximums at the center. That's where I am wrong.


texts: determine two signals with a scale factor

texts:
Suppose I have 2 signals from function $f_1(x)$ and $f_2(x)$, respectively, and assume the sampling rate is above Nyquist frequency, so we can restore the underlying functions $f_1(x)$ and $f_2(x)$. But my question is, from the 2 signals, how to tell if the underlying functions $f_2(x)$ is scaled from $f_1(x)$, i.e. to determine if $f_2(x)=f_1(ax)$, where $a$ is a non-zero real number.

Thanks!


texts: Detecting expected patterns in repeated measurements

texts:
I am new to signal processing and I am trying to learn myself. To understand what i am interested in, let me show this on example (note that this is just a random example to illustrate). Here is some signal detected from a device:

You can notice there are 3 peaks there, and let's say there is a task to detect times of beginning of each peak (where it starts to rise). I then need to evaluate times of these 3 peaks and compare it to expected value. Now I am interested in ways how to detect these "patterns" and I am trying to find more info/learn about (something general, not specifically to this signal).

So far I learnt how to use basic filters to get rid of noise (moving average, exponential smoothing) and some really simple techniques how to find some of these points (checking sudden changes (difference between two successive filtered values) in the filtered value that is above certain threshold, etc...). My question is, where can I get to know more about this area, if you can point me to some resources, direction... Something that is not about finding unknown patterns in signal, but more about being able to accurately detect already known/expected "patterns". I will be thankful for any info/references.


texts: What do we achieve by using PAM symbols symmetrical with respect to 0?

texts: I can't seem to find the answer to this one anywhere online. We want them symmetrical with respect to 0 and also at even distance between each other. Why is this important?


texts: Blind 1D equalization/deconvolution with some knowledge of filter kernel

texts:
Let $s_{\rm out}[n]$ be the 1D output signal of a system, $s[n]$ be the input, and $k[n,q]$ be the filter kernel for an element $n$ and for fixed value $q$.  Then:

$s_{\rm out}[n] = s[n] \ast k[n,q]$

If I know $q$ as a real number, then I can compute the filter kernel $k[n,q]$ and determine $s[n]$.

The values for $q$ normally range between $q = 30$ and $q = 500$.  The signal $s[n]$ is discrete data that is bounded between two values.  Moreover, $s[n]$ is minimum-phase.

In the frequency domain, the filter kernel $k[n,q]$ modifies both the magnitude and phase of the input $s[n]$ to cause attenuation.  This is a "lossy" transmission channel.

However, I do not know $q$ and $s[n]$, and so I am looking for a well-known, "classic" reference that details how to estimate $s[n]$ with some knowledge of $k[n,q]$.  I know the mathematical form of $k[n,q]$, but I just don't know $q$.

I'm looking for an algorithm that works fairly well and is reasonably well-understood and applied.  In this case, $s[n]$ could be contaminated by noise (as are all real signals), but the main goal is to remove $k[n,q]$ to estimate $s[n]$.


texts:
I'm wondering if anyone knows of any open source solutions to note recognition. I'm planning on building a program for online sheet music, which recognizes your notes, and tries to tell you what you can improve, and how.

However, for piano for example, I don't even know if it's possible to have software that detects various notes at once, with very high speed. If anyone knows anything like this, please let me know!


texts: Confusion about the impact of flat fading and frequency selective fading on OFDM

texts:
OFDM divides the signal in frequency domain into orthogonal and relatively narrow subcarriers where fading can be considered to be flat
Flat fading is not associated with delay spread and is corrected in frequency domain

Delay spread caused by multipath is associated with frequency selective fading and in OFDM it is absorbed by the cyclic prefix which isolates consecutive OFDM symbols

How would delay spread show up in the frequency response of the channel? would it show up like "nonflat" fading or a notch within the relatively small bandwidth of some subcarriers?

i.e. it would be wrong in this case to consider the affected subcarriers still experiencing flat fading?


texts: Extraction of fundamental signal information-Fourier full cycle algorithm

texts:
After filtering my noisy input signal using an anti-aliasing and FIR filter, I now wish to get the basic signal information (peak voltage and impedance; $R$ and $X$) from the pre-filtered as well as the post filtered signal.

A method to find the peak value that was strongly recommended to me was, Fourier Full Cycle Algorithm (DFT Technique). Not having a firm theoretical grounding yet, (going to take a DSP next semester), I fail to understand the significance of this method, or if this is a better way to find peak values than the ones I've read about such as, taking the first derivative of signal and looking at the zero crossings.

According to this method:

$$V_{sin}=\frac{2}{K}\sum_{n=0}^{k-1}V_n\sin \omega $$

$$V_{cos}=\frac{2}{K}\sum_{n=0}^{k-1}V_n\cos \omega $$

$$V_{peak}=\sqrt{V_{sin}^2+V_{cos}^2} $$

where:

$V_n $ - stored samples of voltage (basically my raw input signal)

$K$ - number of samples chosen per cycle

$\omega=\frac{2\pi n}{K}$  (if $K=60$ samples, then $\omega =6^o $ for $n=1$)

The way I found the peak of the pre-filtered signal (raw-input) was by smoothing it out using a moving average filter using 4 points and then finding the global maxima using statement:

[max_value, index_number]=max(Vn)

I also coded in MATLAB, to find the peak value of voltage using the above mentioned DFT algorithm. The peak values don't match.

My raw input:

Smoothed out data:

I'd be grateful if someone can can tell me if the above mentioned DFT algorithm can even be implemented for an input signal that looks like mine and why the peak values obtained using both the methods don't match. Sorry that I sound confused, I truly am!

Also, a normalised FFT plot of the pre-filtered signal and the code to find peak using Fourier full cycle algorithm, as requested:

K=600; %Number of samples chosen per cycle
x=1;
y=1;
f=0;g=0;
angle=1;

while (x<600)
   theta=(2*pi*angle)/K;
   f=f+(VolTime(x,2)*sin(theta)); %VolTime is the matrix [601X2],2nd column contains the input voltage values
   g=g+(VolTime(x,2)*cos(theta));
   x=x+1;
   angle=angle+1;
end
Vsine= (2/K)*f;
Vcos=(2/K)*g;
disp('Peak voltage')
VPeak=sqrt(Vsine^2 + Vcos^2)


texts: How does µlaw encoding work with 16-bit signals?

texts: I am new to DSP, so I wan't to know a couple of things. How does µlaw encoding function on a log scale such that you can input 16-bit signals and get the 8-bit µlaw signal output, after compression, and then use that as a building block to expand it back to 16-bit signals. I would love if someone can guide me through this. Also, how is this lossless compression, if that is what it is.


texts:
Consider an LTI system $$H(z)=1-\frac{1}{2}z^{-1}+\frac{3}{4}z^{-2}$$
  Let $x[n]=(\frac{1}{3})^n\cdot u[n]$ be the input signal. It is desired to determine the output for $n=0,1...,N_a$. To achieve that, a relevant part of the DFT will be used together with an uniform sampling of $H(z)$ in the unity circle with a separation of $\frac{2\pi}{N_b}$.
  a) Explain the process to achieve this. b) Are there any restrictions for $N_a$ and $N_b$? c) For the same $x[n]$, would the method described in a) work if $H(z)=\frac{1}{1-\frac{1}{2}z^{-1}}$? If not, correct the previous method to find the correct result.

$H(z)$ is sampled in $N_b$ points. $\hat{h}[n]$ (the sequence whose DFT is the sampled version of $H(z)$) has only 3 non-zero values, so... the sampled version of it would have $N_b -3$ zeros (I'm not sure about this). About the size of $X[k]$, I thought that, if I want to know the first $N_a +1$ values of $y[n]$, maybe it is enough to grab the first $N_a +1$ points of $x[n]$ to do the DFT and add the necessary amount of zeros to avoid aliasing? This may be false but I just don't know how to determine the relevant part of the input signal that has to be used. If everything I said above is correct (I highly doubt it), then I thought that the only restriction on $N_a$ and $N_b$ is that $N_a +3 = N_b$.

About c), I have no idea of how to do that.

Any suggestion?
Thanks for your time!


texts: Inter aural time difference generation using sine waves

texts:
I have a stereo sound for Inter  aural time difference consisting of sine wave(16 samples as 16 bit PCM Data) for left and right audio. From time to time I would like to advance either the left or right audio so that sound in one ear comes earlier than the other. If I just put another sine wave of different frequency in between my normal sine samples to give an illusion of changing sound in one ear, I hear a click. I am playing a buffer of 1024 samples at a time containing looped sine wave samples. If I drop one sample it generates a click as well. Can someone suggest a way of speeding up the Sine wave without generating a click.
e.g loop the sine wave separately for both ears. Now advance the sine wave in one ear so that it feels like a frequency change and then play the normal sound again in both ears. I have fixed sine samples with me. (I work in java so can't do any heavy computations). I have tried to clarify but the question could still be confusing. Ask for specific details.

Thanks


texts: Implementing discrete Poisson equation wtih Neumann boundary condition

texts:
I am trying to reconstruct an image from gradients in an arbitrary shaped region of an image.  I understand how to implement a discrete 2D poisson solution with Dirchlet boundary conditions. Using http://en.wikipedia.org/wiki/Discrete_Poisson_equation#On_a_two-dimensional_rectangular_grid , you just replace any of the u_i,j that are on the source side of the boundary with the boundary values that you have. However, I don't understand how to implement the Neumann boundary condition. If you want to "match" the external derivative, wouldn't you have to just set the nodes that are on the target side of the boundary to a value that makes the derivative between the source boundary pixel and the target boundary pixel equal the derivative outside the boundary? If you do this, haven't you just simply "filled in" one node around the boundary and provided a slightly smaller version of the Dirchlet problem?

Can anyone explain this?


texts:
Having trouble finding the inverse DTFT of $\ X(\ e^{j \omega}) = \frac{3 - \frac{1}{4} e^{-j\omega}}{1 - \frac{1}{4} e^{-2j\omega}}  $

Given the IDFT of $Xe^{j \omega}$ as :

$x(n) = \frac{1}{2\pi} \int_{-\pi}^{\pi} X(\ e^{j \omega}) \cdot e^{j \omega n} d\omega$

Tried long division as an option and reduction to partial fractions but not to any good so far.

Not sure on how to proceed.


texts:
OK hive mind...

i have two identical fixed-size signal buffers, each containing 4 channels of audio.

I perform a 2d REAL to COMPLEX FFTW_ESTIMATE on both, resulting in two identical spectra of the same length.

I now perform division of the two complex spectra in order to retrieve the impulse response (this is for testing).

I assume that I would see an ideal impulse response (first sample 1.0, the remaining samples 0), but this is not what I see.

With identical spectra I am seeing an impulse response that really shouldn't be there.

Should I be using real to complex FFT's here or should I be using just Real to Real?

void
iconvo_divideFFTs(iConvo * handle) {

    assert(handle != NULL);

    fftw_complex *a,*b,*c;

    for (int i=0 ; i < handle->bufferSize * 4 ; i++) {
        a=&handle->fftw_input[i];
        b=&handle->fftw_output[i];
        c=&handle->fftw_filter[i];

        *c[0]=( (((*a[0])*(*b[0]))+((*b[1])*(*a[0])))/(((*a[0])*(*a[0]))+((*a[1])*(*a[1]))) );
        *c[1]=( (((*b[0])*(*a[0]))-((*b[0])*(*a[1])))/(((*a[0])*(*a[0]))+((*a[1])*(*a[1]))) );

    }
}


texts:
I struggle with two simple questions.

First. What is the distribution of the signal on the output of the lin-log amplifier if Rayleigh noise is driven to the input of it.

Using an approach with the inverse function it is possible to obtain the expression for the distribution of the output signal. It looks like the First Extreme Value Distribution (i.e. with $\exp(\exp(x))$ pattern).
In other words, if $f_{in}$ is the input of the lin-log amplifier:
$$
f_{in} = \frac{r}{D}e^{\frac{-r^{2}}{2D}}
$$
one can get $f_{out}$ - the  distribution of the output signal:
$$
f_{out} = \frac{e^{-\frac{e^{2x}}{2D}-2x}}{D}
$$

But I found a statement somewhere in engineers forums that a lin-log amplifier works more trickily and "takes a logarithm of an envelope" and "there were a lot of problems with erroneous simulations of lin-log signal transformation". It was just statements without explanations that gave me feed for thoughts.
I found experimental data. It looks more like:
$$
f_{out} = \frac{\log(x)}{K_{1}}e^{\frac{-\log(r)^{2}}{K_{2}}}
$$
I'm afraid that it is very similar to the First Extreme Value Distribution and they are indistinguishable in an experimental environment. For example, the additional logarithm of both of them results in Gaussian-like distributions and the difference between them are again almost completely indistinguishable.

Second. How to simulate the lin-log amplifier (detector) in R or MATLAB.
The problem is that taking the logarithm of a random variable with Rayleigh's distribution results in a distribution with a negative skewness which does absolutely not resemble the above-mentioned alternatives expected. The same distribution with a negative skewness one can get using normally distributed in-phase and quadrature components of the signal.

Is there anybody who understands the problem and could share the idea on how to represent the output of the lin-log detector mathematically and simulate it numerically?

Thanks!


texts:
Currently I have generated a ISDN 2B1Q signal and added a random signal to it,then I have designed a lowpass butterworth filter to remove the noise as much possible in MATLAB.

My next task is to add Intersymbol Interference to this 2B1Q signal and implement DFE using LMS algortihm to reduce this ISI.Can anybody help me as to how I can add ISI to this signal in MATLAB?


texts: The use of FDM for a single message signal

texts:
Suppose I have a single message signal, m(t), that is subjected to AWGN upon transmission.

Is there any way that FDM (or any multiplexing strategy) can be used to ultimately improve the SNR of the demodulated signal at the other end of the transmission line. I'm open to using any sort of modulation technique.

Thanks.


texts: Transport Block calculation in LTE Downlink

texts:
I would like to understand the relation between the TB size calculation in the TS36.213 document and in the simulator (https://www.nt.tuwien.ac.at/research/mobile-communications/vienna-lte-a-simulators/). I’m going to make an example so maybe you can help me to see this relation:

Method 1 (from the TS36.213)

Calculation Procedure for downlink(PDSCH) is as follows :

i) refer to TS36.213 Table 7.1.7.1-1

ii) get I_TBS for using MCS value (Let’s assume MCS is 1. in this
case, I_TBS is 1 )

iii) refer to TS36.213 Table7.1.7.2.1

iv) go to column header indicating the number of RB (Let’s assume
that RB is 50)

v) go to row header ‘1’ which is I_TBS

vi) we would get 1800 (if the number of RB is 50 and I_TBS is 9)

vii) (This is Transport Block Size per 1 ms for one Antenna)

And this is method 2 (from the Vienna LTE System Level simulator):

i) This is the formula:

TB_size_bits = max(8*round(1/8*(the_RB_grid.sym_per_RB_nosync .* num_assigned_RB .* modulation_order .* coding_rate * 2))-24,0);
ii) if the_RB_grid.sym_per_RB_nosyn= 80

iii) num_assigned_RB=50

iv) modulation_order = 2

v) coding_rate=0.0762

vi) That gives TB_size_bits = 1195 bits

Do you know how I can go from one method to another or if there is any relation?

Thank you. Best regards,

Natalia.


texts: Fourier transform of a damped cosine wave with a linear frequency chirp

texts:
I want to take the Fourier transform of the following transient signal,
$$f(t) = e^{-t/\tau} \cos((\omega_0 + m t)t)$$, where $m$ is some gradient parameter in units of $\rm{Hz}/s$.
I thought this would be quite straight forward -- although most of my approaches have been made using Mathematica -- which struggles to provide anything useful.

I would have assumed the resultant function would have a Lorentzian-like peak profilein a similar way to if one takes the trivial Fourier transform of
$$f(t) = e^{-t/\tau} \cos(\omega_0t)$$.
Does anyone have any ideas on how I can approach this, or, an alternative to Fourier transforming a damped sinusoidal with a linear (or even non linear) frequency, i.e. a chirp.


texts: Came across this example in class but I'm not sure how the expression $x(n)$ was derived.