texts: Taking the FFT of a sinusoidal signal and going back

texts:
I am a computer science student and want to do some stuff with audio data. I want to use the DFT to analyze and synthesize some sounds. Before going to the more complex stuff I experimented with basic tones and found some issues I do not understand - therefore I want to ask for help in this physics forum.

I created a single sinus wave function with an audioprogram of $440\textrm{ Hz}$. From this I take the DFT and want to recreate the original signal from this. While doing so, first I emit the negative frequencies, thus take only the first $n/2$ frequencies. $N$ is my blocksize (I divide the signal into blocks of length $n$). The sampling rate of my audio signal is $44100\textrm{ Hz}$.
So when I do this, and take the IFT from the resulting data, I can perfectly reconstruct my signal.

Now to my issues and questions:

When I set the phase to $0$ in the Fourier space (the imaginary part), with different $n$, I recover a sinus signal with some periodic noise.

I assume this is the phase difference which can be heard between the blocks?

When I set $n$ to $44100$ (the sampling frequency), I get complete noise.

Why is that?

Now I want to take only the strongest frequency amplitude wise (which in my opinion should perfectly work) - thus I set all other frequencies in the Fourier space to $0$ and then do the IFT. For different $n$ this kind of works, I get a sinus signal with some periodic noise.

Why the noise?
Moreover, the frequency of the resulting tone changes with $n$. Why is that?
With $n = 44100$ I get complete silence. Why?

When I set the phases to $0$ again I get the same results.

I hope it's somewhat interesting for you too. Could you explain to me these "phenomena"?


texts:
I am trying to create a program that can count the number of nuclei in such an image:

What I've already done is the following, step by step:

Apply an Alternating Sequential Filter (closing and opening the image with gradually bigger structuring elements)
Apply a distance transform
Apply watershed segmentation using the distance transformed image to detect minima

Which yields the following result (where each color represents a new nucleus counted):

As we can see, there are lots of imperfections, specifically, overcounted nuclei. I'd say that the reason for that problem is the way I imposed minima for the Watershed Transform (using the distance transform), but I really have no other ideas for imposing minima in that case.

As the Distance Transform generates minima based on the roundness of objects, I would like to know a better alternative to round up the nuclei than the Alternating Sequential Filter (looking at the image above, we can infer that most of the "overcounts" came from the less rounded nuclei). I would also like to know better ways to impose minima for the Watershed Transform.


texts: Why in formula of power of periodic signal is $2N+1$?

texts: Where does $1$ come from, like from $-N$ to $N$ is $2N$ so why is $2N+1$?


texts: MATLAB: Applying Inverse Fast Fourier Transform to an array of real numbers

texts:
I'm trying to understand the difference between applying the Discrete Cosine Transform (DCT) and the Inverse Discrete Fourier Transform (IDFT) to the log Mel-filterbank energies as explained in the answer here. So, I tried the following pretty simple example in MATLAB:

x1 = [1. 2. 3.];
X1 = fft(x1);
x2 = ifft(abs(X1));
x3 = ifft(x1);

The classes of the results are:

Why do x2 and x3 have two different classes?

Update:

Here is the file 'myVoice.wav' in the following test:

[signal, fs] = audioread('myVoice.wav');
segmentLength = 240;
x = signal(20490 : 20490 + segmentLength - 1);
x = x .* hamming(segmentLength);
res = ifft(abs(fft(x)) .^ 2);


texts: Why do I have a high peak at the beginning of my FFT (not DC)?

texts:
I am analyzing a recording from a microelectrode array on a neuronal cell culture and I found something that is disturbing me a lot. Through python, I have taken different chunks of the same signal profile from the original recording, calculated the FFT of each of them and then, the mean among them.
In theory, this makes sense since I am just amplifying common patterns on the wave, however, I am getting a huge peak at the 0 component but if you calculate the mean of the signal, they have zero DC component. I don't know if this issue might be a consequence of a bad use of the FFT on python or maybe I am missing something. Do any of you have any idea of what is going on?

The code is very long but the specific section of the chunks and the fft is here:
chunk = np.zeros((16, 300000))
chunk[0,:] = signal1[320000:620000]
chunk[1,:] = signal1[950000:1250000]
chunk[2,:] = signal1[1640000:1940000]
chunk[3,:] = signal1[2311000:2611000]
chunk[4,:] = signal2[320000:620000]
chunk[5,:] = signal2[950000:1250000]
chunk[6,:] = signal2[1640000:1940000]
chunk[7,:] = signal2[2311000:2611000]
chunk[8,:] = signal3[320000:620000]
chunk[9,:] = signal3[950000:1250000]
chunk[10,:] = signal3[1640000:1940000]
chunk[11,:] = signal3[2311000:2611000]
chunk[12,:] = signal4[320000:620000]
chunk[13,:] = signal4[950000:1250000]
chunk[14,:] = signal4[1640000:1940000]
chunk[15,:] = signal4[2340000:2640000]

myfftchunk0 = np.fft.fft(chunk[0,:])
myfftchunk1 = np.fft.fft(chunk[1,:])
myfftchunk2 = np.fft.fft(chunk[2,:])
myfftchunk3 = np.fft.fft(chunk[3,:])
myfftchunk4 = np.fft.fft(chunk[4,:])
myfftchunk5 = np.fft.fft(chunk[5,:])
myfftchunk6 = np.fft.fft(chunk[6,:])
myfftchunk7 = np.fft.fft(chunk[7,:])
myfftchunk8 = np.fft.fft(chunk[8,:])
myfftchunk9 = np.fft.fft(chunk[9,:])
myfftchunk10 = np.fft.fft(chunk[10,:])
myfftchunk11 = np.fft.fft(chunk[11,:])
myfftchunk12 = np.fft.fft(chunk[12,:])
myfftchunk13 = np.fft.fft(chunk[13,:])
myfftchunk14 = np.fft.fft(chunk[14,:])
myfftchunk15 = np.fft.fft(chunk[15,:])

Meansignal = np.zeros(len(chunk[1, :]))

for i in range(len(chunk[1, :])):
    Meansignal[i] = myfftchunk0[i] + myfftchunk1[i] + myfftchunk2[i] + myfftchunk3[i] + myfftchunk4[i] + myfftchunk5[i] + myfftchunk6[i] + myfftchunk7[i] + myfftchunk8[i] + myfftchunk9[i] + myfftchunk10[i] + myfftchunk11[i] + myfftchunk12[i] + myfftchunk13[i] + myfftchunk14[i] + myfftchunk15[i]
    Meansignal[i] = Meansignal[i] / 16

mynewffthalfMean = Meansignal[:len(Meansignal) // 2]
fnewHalfMean = np.linspace(0, fs / 2, len(mynewffthalfMean))

# Plot figure 2 - FFT
plt.figure(7)
plt.plot(fnewHalfMean, np.abs(abs(mynewffthalfMean))**2)
plt.xlabel('Frequency (Hz)')
plt.ylabel('Magnitude (dB)')


texts: Which antialiasing filter before equispaced sampling

texts:
I am using MIT-BIH arrhythmical database where I have a digital signal of 1200 Hz so 1200 samples per second.
This means that analog filters have already applied to remove the frequencies over Nyquist frequency, so no aliasing.

However, I want to take equispaced sampling, every two sample, simply by the following in Matlab

data([0:2:1200]);

I am reading Andre Quinquils' book Digital Signal Processing Using Matlab 2008:

  It is always necessary to use an anti-aliasing filter before the
  sampling stage in order to avoid any spectral aliasing risk and to set
  an appropriate sampling frequency. In practice, a causal approximation
  of this ideal filter is used. Thus, depending on the chosen filter
  synthesis method, some imperfections are introduced, such as a
  passband amplitude ripple, a transition band and a stopband finite
  attenuation.

Does this mean that I need to apply a new anti-aliasing filter before the sampling stage in oder to avoid aliasing?
I think the sampling stage here is the equalspaced sampling.
I have not applied any new special anti-aliasing filter.

Which antialiasing filter can you use before equalspaced sampling stage?


texts: Matched filter loss due to frequency offset

texts:
I'm working with a pulsed radar signal which uses linear chirp pulses. I perform pulse compression by applying a matched filter of the simulated chirp waveform and recording the location and power of the peak. Often times the recorded signal has a Doppler shift, so there is some inherent loss in the pulse compression process. This value is not large, but I need to quantify this expected loss so I can properly measure the actual received power of my signal.

How can I calculate the expected compression loss at the peak due to a frequency offset?

PS, I understand that the location of the peak will also move due to range-doppler coupling, but I understand that phenomenon already.


texts:
My IQ sampler is measuring a QPSK carrier at a set frequency/bandwidth (40MSamp/s), but shifts the signal spectrum to baseband. My signal is 1.5Msym/s, but sampling at 1.5Msym/s gives me a constellation of a circle due to the phase difference between the carrier and the IQ sampler clock.

I still need to synchronize to the carrier, but I now have a 0Hz carrier? Do I try a costas loop with a 0Hz center VCO? So far I haven't had much luck. Any ideas? Thanks everyone.


texts:
I have a signal that contains the speaking of three vowels. The signal is contaminated with dc offset and an interference at 60 Hz. I want to perform LPC for the synthesis of the spoken vowels. Do I have to remove the dc offset and the interference before performing LPC?

My initial signal looks like this:

There is also another question of mine about LPC here https://stackoverflow.com/questions/28909899/weird-output-of-lpc-algorithm


texts: Wavelet Filter Coefficients from Scaling Filter Coefficients

texts:
I am trying to develop a new type of wavelets and I found out a function that following a particular two scale relation. The function at a scale $t$ say $x(t)$ can be related in a finer scale $x(2t)$ by the following relation:

$$x(t)=0.1x\left(2t\right)+ 0.5x\left(2t-1\right)+0.8x\left(2t-2\right)+0.5x\left(2t-3\right)+0.1x\left(2t-4\right),$$

This is found out by trial and error method by simply changing the values. Now I know that the points $\begin{bmatrix}0.1&0.5&0.8&0.5&0.1\end{bmatrix}$ can be considered as  the scaling filter coefficients. Now the problem is finding the wavelet filter coefficients, I am not able to find out a particular relation connecting scaling filter coefficients and wavelet filter coefficients. Is there is a relation connecting the two ??


texts: At what time stretching ratio would an audiophile notice a wrong pitch

texts:
I have some low quality audio from my native tongue on a VHS. I am using this audio to dub HQ released of the same program (from another language source). The video frames/second ratio is 25:23.98 . I do not want to tamper with the fps ratio, since I am still using the other audio tracks as alternative languages in my video.

I can't notice a pitch difference from this conversion, I can only hear the pitch-changing VHS artefacts.

Is a 25/23.98 ratio enough to need pitch correction? What is the rule of thumb? Would the VHS artefacts hide the pitch difference (too much pitch-noise to actually matter) or would the average pitch difference drive an audiophile up the wall?


texts:
Let $x[n]$ be a real signal whose length $N$ is even. Let $y[n]=x[2n]+jx[2n+1]$ a signal whose length is $M=\frac{N}{2}$. $X[k]$ for $k=0,...,N-1$ and $Y[k]$ for $k=0,...,M-1$ are the respective DFTs of those signals. Find $Y[k]$ as a function of $X[k]$.

I haven't been able to find a scaling time property for the DFT. I read all the Oppenheim-Schafer's discrete signals book and found nothing about the subject. I tried doing it by definition but I just can't realize what the relationship between both DFTs is.


texts:
In GQRX (an GNURadio based RTL-SDR receiver) I have an FFT and waterfall display. When I tune to a local FM station (107.5MHz) I can hear strong, clear voice.

But on FFT and waterfall display I can see also a weaker signal at 107.9MHz:

Why I see this little signal of my receiver is tuned to other frequency? There is almost always such a weak signal in the center of a display no matter at which frequency I'm tuned.


texts: voice recognition vs speech recognition MFCC

texts:
I have a basic understanding of the acoustic preprocessing involved in speech recognition: divide the speech into frames, find the mel frequency cepstral coefficients of each frame, construct a feature vector from the MFCC's and signal energy, and compare the speech to several "prototype" speech samples to find the closest match.

When doing voice recognition (i.e. recognizing who said it, as opposed to what was said), I'm thinking that perhaps a different windowing function is used, or maybe a different type of filter bank is used to transform the spectrum to the mel scale, but I'm not entirely sure--perhaps it is a different process altogether. Does anyone know MFC analysis for speaker recognition differs from the analysis for speech recognition?


texts: Dealing with quantization level limiting dsp

texts:
There is a analog signal in the form as below:

$$ f(t)=A \sin(\omega(t) t+\phi)+B \sin(\omega(t-t_1) t+\phi_1) $$
Where $$B<<A$$

We are going to calculate $\phi, \phi_1, t_1 $,using dsp. But since $B<<A$ and due to quantization level limitation, we can not extract data precisely. Is there any suggetion how to deal with that?

Thank you for your kind replies


texts: Why does my signal magnitude increase after adaptive filtering?

texts:
I am using a series-cascade of multiple NLMS adaptive filters each with step size 0.0040, leakage factor 1.0, and 100 filter taps. My signal gains magnitude at each step of the filtering, say the peak magnitude increases from 0.2 originally to 2.5 after using the first adaptive filter to 12.5 after the using the second adaptive filter on the output of the first one and finally 30 after using the third adaptive filter on the output of the second one. Why is this happening?

I have tweaked the step size and leakage factor but that did not help. Isn't my filter supposed to reduce the magnitude of my signal?


texts: How to combine mutliple audio files with proper SNR

texts: I have thousands speech records (just human voice 5sec shoots)) and another hundreds but longer  environment sounds (street, restaurant etc) I would like to combine them in one track with natural SNR like so quiet background and voice on the first plan. Is there any good way to merge it? My idea is to merge all files (voices) and separately noise then normalize both and combine together with proper SNR. Tool that I have is Adobe Audition. Thank You in advance for any hint.


texts: Why does this FFT based signal deliver a sinusoidal result?

texts:
I have noticed that there is an identical pattern between two signals:

one is a signal of n identically spaced samples over a single period of a sinusoid

the other is a signal constructed of the real component of the second (i.e. first periodic) Fourier bin of n circular shifts of the signal, so pseudocode would be:

allocate a final result, size n
loop from 1 to n
    newSignal = circularly shift signal one step to the left
    newValue = take the FFT, second (first periodic) bin, real component
    finalResult(n) = newValue

The only difference between these two is the scaling. If one's input is known to be a single cycle of a sinusoid, this is a nice way to remove all noise without knowing the phase of the input. Obviously it works in part because the second Fourier bin corresponds to the frequency of the input. But that's as far as my intuition gets me. In terms of theory, I don't understand why a signal composed of the real component of the second Fourier bins of the circular shift of each step of the signal looks the same as the original signal. Can anyone shed insight?


texts: I recently read that with compressive Sensing it possible to sample the signal at a rate lesser than that suggested by Nyquist Criterion. However, I am still not getting how this is possible. Can someone suggest an intuitive way of understanding this concept of sampling at lower rates? And if this is possible, do modern communication techniques use this concept?


texts: Communicate to user that SNR is too low - Speech procesing

texts:
I am working in a project to estimate the signal to noise ratio (SNR) for an automatic speech recognition system in order to generate an alert to the user if the noise is too high in the place where he is speaking (SNR too low! Or something like that).
I'm having trouble finding relevant information about what kind of algorithms I should apply. If anyone could recommend papers, books or some kind of algorithm that I could use, I would be very grateful.


texts: How to use clustering file after training

texts:
I trained the data using BOG with SVM , i trained it , now i just want to open it through xml , i don't want to train it again and again on every run ,
I trained the svm and now loading it using its loading function

CvSVM svm;
svm.load( "trainsvm.xml" );

But how to do the same with vocabulary file which i use for clustering using BOG algorithm , below is my code , which is training the data , but i want to open it now like svm

for (i = all_names.begin(); i != all_names.end(); ++i)
{
    Dir=( (count < files.size() ) ? YourImagesDirectory : YourImagesDirectory_2);

    Mat row_img = cv::imread( Dir +*i, 0 );

    detector.detect( row_img, keypoints);

    RetainBestKeypoints(keypoints, 20);

    extractor->compute( row_img, keypoints, descriptors_1);

    descriptors_1.reshape(1,1);

    bow.add(descriptors_1);

    ++count;
}

vector<string>::const_iterator k;

cout<<"CLUSTERING"<<endl;
Mat vocabulary = bow.cluster();

dextract.setVocabulary(vocabulary);

cv::Mat training_mat(num_img , dictionarySize,CV_32FC1);
cv::Mat labels(num_img,1,CV_32FC1);

This is clustering the data , now i don't want to run it again and again because it takes too much time , when it trained once , i just want to use it , so that i can speed up my program


texts: Why is CDMA not enough for wireless communication?

texts:
I have a question about CDMA, FDMA and TDMA.

I don't understand why we suffer from limited capacity when we have CDMA.

I can understand the limitation in FDMA and TDMA, as time and frequency are limited. However, we can generate as many codes as we want. When the true receiver receives the signal and multiplies by the code, one should receive the original signal even if there is a lot of interference.

So where am I wrong? Why do we suffer from limited capacity when using CDMA?

Thank, I think I made mistake by saying capacity. I specifically meant high date rate.
However, I know multiple access mechanisms.

What I asked is a different question.

Let's say I am using TDMA for 10 users. Each user has to wait 9 users to transmit. If we had 100 users, then each user has to wait 99 users. Very high level of starvation. If you want to decrease starvation, you have to decrease time slot which means decreasing date rate.

Let's say I am using FDMA for 10 users with 100 MHz bandwidth, so each user will have 10 MHz bandwidth so equivalent capacity from Shannon law. If we had 100 users which means 1 MHz bandwidth and much lower date rate equivalently lower capacity. If you want higher date rate, you need to buy more bandwidth.

Let's say I am using CDMA for 10 users, I need 10 orthogonal codes. For 100 users, 100 orthogonal codes.

So, the case is frequency and time are exist in the nature and they are limited.

However, we can generate millions of orthogonal code for millions of user as it is human-invented thing.

Why do we live problem multiple access problems while we have CDMA?

In other words, is there a mathematical or practical limit of usable number of codes ?

If the number of the users in the network exceeds a threshold, Do the codes become to similar which undermines orthogonality?


texts: How can I generate a sine wave with time varying frequency that is continuous, in C?

texts:
How can I generate a sine wave with time varying frequency that is continuous? How can I resolve the following problem? I want a continuous graph.

I'm generating this simply like this:

for(int i = 0; i < pcm_buffer_size - 1; i += 2) {
    float sample = gain * sin(((float) t * M_PI * 2 * 500) / (float) (sample_rate));

    printf("%f\n", sample);

    t++;
}

for(int i = 0; i < pcm_buffer_size - 1; i += 2) {
    float sample = gain * sin(((float) t * M_PI * 2 * 1000) / (float) (sample_rate));

    printf("%f\n", sample);

    t++;
}

Where 500 and 1000 is the frequency.


texts:
I'm trying to design a FIR lowpass filter using Hann windowing in Python but I don't know where to start from... I have fc1,fc2, ft, rp and rs as parameters. This is my Python code:

            import myDSP
        import matplotlib.pyplot as plt
        import scipy.signal as signal
        import numpy as np

        def plotInTime(x,fs):
t=np.arange(0,np.size(x,0)/fs,1/fs)
plt.figure()
plt.plot(t,x)
plt.xlabel('Time (s)')
plt.ylabel('Amplitude')
plt.grid(True)

def plotInFrequency(x,fs):
N=int(np.size(x,0)/2)
if np.size(x,0)==1:
X=np.fft.fft(x,axis=1)
else:
X=np.fft.fft(x,axis=0)
X=np.abs(X)
X=X[:N]
f=np.arange(0,fs/2,fs/2/N)
plt.figure()
plt.plot(f,X)
plt.xlabel('Frequency (Hz)')
plt.ylabel('Magnitude')
plt.grid(True)
        fs, x = myDSP.readWav('Ring05c.wav') #is 22050
        myDSP.plotInTime(x,fs)
        plt.title('Original Signal')
        myDSP.plotInFrequency(x,fs)
        plt.title('Spectrum for the Original Signal')

        fc1=1200
        fc2=3000
        fc= np.arange(fc1,fc2+1)
        ft=150
        rp=0.1
        rs=40
        t = np.linspace(-1, 1, 201)
        #x = (np.sin(2*np.pi*0.75*t*(1-t) + 2.1)+0.1*np.sin(2*np.pi*1.25*t + 1) +0.18*np.cos(2*np.pi*3.85*t))
        wp=(fc-ft/2)/(fs/2)
        wp = wp[0]
        ws=(fc+ft/2)/(fs/2)
        ws = ws[0]
        L, Wn = signal.cheb1ord(wp,ws, rp, rs);
        b, a = signal.cheby1(L, rp, Wn,'low')
        f,H=signal.freqz(b,a,worN=256,plot=None,fs=fs)

        y=signal.lfilter(b,a,x,axis=0)
        myDSP.plotInTime(y,fs)
        plt.title('Filtered Cheby1 Signal')

        myDSP.plotInFrequency(y,fs)
        plt.title('Spectrum for the Filtered Cheby1 Signal')
        y=y.astype('int16')

        w_fir = signal.firwin(65, fc/(fs/2), window='hann')
    [w,h] = signal.freqz(w_fir)
    plt.plot(w, 20*np.log10(abs(h)))
    plt.plot(w, np.angle(h))


texts: Impulse response from Frequency response: why using $e^{j\omega}$ as an input?

texts:
Every resource that I can find uses this identity when deriving impulse response:

$h[n] = IDTFT \Big\{H(e^{j\omega}) \Big\}$

Suggesting that the input signal was $e^{j\omega}$. But by definition Impulse Response is the result of applying the filter to delta signal. Why then do we use $e^{j\omega}$ instead?


texts: Is there a generalized method to get the input with the given output and the impulse response?

texts:
$y(t)=y(t+12), y(t) = x(t) \ast h(t)$

The continuous time signal output $y(t)$ is a periodic square wave, 50% duty cycle pulse.

The impulse response is a box function.($A = 1, T = 2$)

By using Fourier series and Fourier transform, I thought I can guess the input $x(t)$, assuming the input is also periodic with the period 12 as well.

$$
w_0=\frac{2\pi}{12}\\
x(t) = x(t+12) = \sum_{k=-\infty}^{\infty} a_k e^{jkw_0t},
a_0 = \frac{1}{T} \int_{0}^{T} x(t)dt,
a_k = \frac{1}{T}\int_{-\frac{T}{2}}^{\frac{T}{2}} x(t) e^{-jkw_0t}dt \\
y(t) = y(t+12) = \sum_{k=-\infty}^{\infty} b_k e^{jkw_0t},
b_0 = \frac{1}{T} \int_{0}^{T} y(t)dt,
b_k = \frac{1}{T}\int_{-\frac{T}{2}}^{\frac{T}{2}} y(t) e^{-jkw_0t}dt \\
$$

By using the Fourier transform,
$$
X(jw) = 2\pi \sum_{k=-\infty}^{\infty} a_k \delta (w-kw_0)\\
Y(jw) = 2\pi \sum_{k=-\infty}^{\infty} b_k \delta (w-kw_0)\\
H(jw)=2sinc(w) \\
X(jw) = Y(jw)/H(jw)
$$

I was stuck at this point; I thought I can write an equation about these coefficients, but the sinc function was a hassle for me.

How should I write an equation which is related to $a_k, b_k$?
Also, in order to guess the input, do I have to use the Fourier Transform like this?
Or is there a characteristic of the convolution for periodic/box functions?

I wasn't sure whether my approach was correct to find inputs with the given output and the impulse response. Thanks for your time.


texts:
I have an algorithm that looks at an audio frame, calculates a threshold in db-rms, and decides to filter the frame whether or not the threshold is crossed. However, filtering each block is producing discontinuities at the ends of the block. How can I rectify this? Is this an issue for overlap-add processing, and if so how can I get started with that?
Thank you.

Spectrograph of audio clip (cropped poorly) before processing:

OLA Spectrograph of audio clip (cropped poorly) after processing:

Here is some MATLAB:

% file reading
filename = 'audio.wav';
[x,fs] = wavread(filename);
x = x(:,1);
xCopy = x;

% constant filter
biQ{1} = dsp.BiquadFilter();
biQ{1}.SOSMatrix = cookEQ(fs,1000,-60,2,'lp').*0.2;
Zi = zeros(2,3);

% window length and overlap
len = length(x);
blockLen = 256;          % window length
hop = floor((blockLen)/2);     % hop size
w = hamming(blockLen);  % window
output = zeros(len,1);

% starting at hop to avoid if statement for first block
for pos=hop:hop:len-blockLen-hop

    release(biQ{1});
    ndx = pos+1:pos+blockLen;      % current window location
    window1 = x(ndx-hop) .* w;
    [window1,Zi(:,1)] = filter(biQ{1}.SOSMatrix(1:3),biQ{1}.SOSMatrix(4:6),window1,Zi(:,1));
    window2 = x(ndx) .* w;
    [window2,Zi(:,2)] = filter(biQ{1}.SOSMatrix(1:3),biQ{1}.SOSMatrix(4:6),window2,Zi(:,2));
    window3 = x(ndx+hop) .* w;
    [window3,Zi(:,1)] = filter(biQ{1}.SOSMatrix(1:3),biQ{1}.SOSMatrix(4:6),window3,Zi(:,3));

    firstHalf = window1(floor(length(window1)/2)+1:length(window1));
    secondHalf =  window3(1:floor(length(window1)/2));
    overlapAdder = [firstHalf ; secondHalf];
    output(ndx) = window2 + overlapAdder;

end

audiowrite([filename(1:end-4) '_ola.wav'],output,fs);


texts: Underwater Acoustic channel simulation issue.Figure 3 Result of paper in comment are not matching. I don't know wy the values are comming half in dB

texts:
clc
clear all;

%----------Underwater Acoustic Communication Channels: Propagation Models and
%----------Statistical Characterization-------------------------------%
%------Milica Stojanovic, Northeastern University---------------
%------James Preisig, Woods Hole Oceanographic Institution--------------%

k=1.5; %pracitical spreading
s=0.5; %shipping
w=0;    %wind in m/s
%Attenuation_factor1=[];
%Attenuaton_Noise1=[];
SNR_Plot=[];
distance=5; %km
P_t= 2%watts
for f=0:0.1:20

   af4=((0.11*(f^2)/(1+f^2))+(44*(f^2)/(4100+f^2))+((2.75*10^(-4)*(f^2)))+0.003);
   aF=power(10,af4*0.1);
   AF=(distance^k)*(aF^distance);

        Turbulence=17-(30*log10(f));
        Noise_Turbulence=  power(10,(Turbulence*0.1));

        Shipping=40+(20*(s-0.5))+(26*log10(f))-(60*log10((f)+0.03));
        Noise_Shipping= power(10,(Shipping*0.1));

        Wind=50+(7.5*(power(w,0.5)))+(20*log10(f))-(40*log10((f)+0.4));
        Noise_Wind=power(10,(Wind*0.1));

        Thermal=-15+(20*log10(f));
        Noise_Thermal= power(10,(Thermal*0.1));

        Noise=Noise_Turbulence+Noise_Shipping+Noise_Wind+Noise_Thermal;

     SNR=1/(AF*Noise);
     %SNR=SNR*2;

     SNR1=10*log10(SNR);
      Intensity = (P_t/4*pi*1*(distance*1000));
    SL=10*log10(Intensity/(0.67*(10^(-18))));
   % SNR1=-SL-SNR1;
    SNR_Plot=[SNR_Plot SNR1];

end

figure;
f=0:0.1:20;
plot(f,SNR_Plot,'m');
grid on;
xlabel('frequency(KHz)')
ylabel('1/AN (db)')

```


texts: Why does numpy FFT only work for samples of 10,20,30 sec?

texts:
I'm using numpy FFT functions to find the amplitude, frequency and phase of low frequency signals. focusing between 0-10 hz.Part of my project is to vary the time over which the sample is taken and the sample frequency. To test the function im currently using unit amplitudes and set frequencies. At any sample size other then 10,20 sec .. ect the fft becomes rather inaccurate.
Since i am using unit amplitudes of 1, the outputs should all be 1, or at least the same number if my scaling is off. but i am getting aptitude outputs from 1 to 0.66 when not using a sample of a multiple of 10.
i have tried changing both the sample time and frequency to match the total sample size but this doesn't seem to have any effect.
Why does this happen? i can't find anything about why the FFT only works for these discrete time periods.
functions use:
z = Series(ampl_OR[i] * np.cos(2np.pifreq_OR[i]*t_OR + phase_OR[i]))
Ramp = np.fft.fft(z) #real amplitudes used to find phase
Rfeq = np.fft.fftfreq(z.shape[-1]) #real frequency domain to find phase


texts: Efficient implementation of filter with impulse response $h_n=\frac{1}{\sqrt{n}}$

texts:
I am studying computer science and come across the need to efficiently implement the filter with impulse response $h_n = \frac{1}{\sqrt{n}} (n > 0)$. In general, $h_n = \frac{1}{q(n)}$ with any nonexponential and sublinear $q(n)$ such as $q(n)=\ln x$ is fine.

Cutting off  $h_n$ using some window is a possible solution. However, I am looking for exact methods or other approximate methods (like approximating the z transfer functions). Efficient implementations are the ones which have fixed space complexity and linear time complexity.

Thanks in advance.


texts: How to detect offset that changes along time in a signal?

texts:
I have an issue that has to do with detrending a signal. First, it seems my signals behaves a little unusual (for me, I think). Some signals starts with a quite large offset, then it seems to disapears (or maybe not, it may hide in the signal) once the action of the system (human body) begins. So I want to see or observe how the offset behaves along time. I don't know if the polyfit function is adequate for it. I want to take a number N of samples of a section, then calculate with polyfit of first order, then plot it at an specified interval of time (regarding to the plotting, I can handle it).

My objective is when I know how behaves the offset, I can decide which part of the signal I have to detrend. As you can see the image below, there are many of comments that gives you better understanding. The three signals comes from an accelerometer. You can see the yellow line that mesure the gravity. The other two signals are supposed to mesure 0 m/s^2. The wanted slope is related to the red line, the bottom line. Another thing, the transitory behavior of the red line where I calculate the polynomial is usual, so the real issue is the offset (straight line) hided in the signal (if there is one).

That goal comes from the fact that in all three signals (x-axis, y-axis, and z-axis) all of them share to a greater or lesser degree the acceleration of gravity. That's good, but in the y, and x-axis, there are at the beginning some kind of offset that corrupt my signals. If I decide to eliminate the offsets, I will also be eliminating the shared gravity. That's is the question, I do not want to remove gravity.

PD: I use MATLAB


texts: Making a 3D point cloud from multiple RGB-D images

texts:
I have multiple (4 kinect) cameras that give RGB-D (color and depth) information of the same scene from different points of view. I want to make a 3D point cloud out of these depth maps. I can get a 3D point cloud for each camera using a function available via the SDK. but my question is how can I merge these points in the same coordinate system to get a single point cloud? what are the available methods? are there any libraries available that perform this in python ?
My best guess is to use one of the cameras' coordinate system as reference and transform every point into that coordinate system. but how can I figure out the representation of one camera's coordinate system in another camera's coordinates so I can perform the rotation and translation ?
I am new to computer vision so please give some references I can use for the methods you mention.thank you.


texts: What does it take to design a 4th order band-pass filter with -24dB/Octave?

texts:
I would like to implement in software the same isolators that the Pioneer EFX-500 features:

The manual says the following about the isolators:

High-performance 3-band Isolator Function
[Fourth-order filter (–24 dB/ oct.)]
Level control is possible between +6 dB to –inf. and a separation of up to –24 dB/oct. for each band ensure accurate sound reproduction.

The thing is, I can program in C# or C++ but I have no experience at all in audio processing so I am a bit at a loss on how to get started.

I have found the winfilter software which can generate C code I can reuse but I am not sure about what settings to choose:

Based on the specifications I've put above, can you suggest which settings should be used ?


texts: Identifying Bad Sectors on magnetic stripe, or noise in signal

texts:
I am starting with an audio signal picked up from the microphone jack of my iPhone, generated by running a standard magnetic strip ATM card through a sensor.

On an old card, there will be a few degenerate bits:

Now filtering out this damage is one issue, which I have asked here: Removing noise from F2F signal

But how to determine the integrity of a particular section of track?   How could I mark a particular area as being damaged?

I basically need some measure of smoothness for any given sample.  My gut feeling is to work with derivatives.  Taking the derivative amplifies noise.

But I can't see it clearly. Can anyone?


texts: what are resources you recommend to learn GPS signal processing?

texts:
I want to learn about GPS and other GNSS signal processing algorithms.
I have solid background in signal processing and some experience in OFDM.
Could you please recommend some books or online resource?


texts:
I have to come up with an upsampling algorithm for a project and cannot use Matlab's built in upsample function. I came up with the following function but it just runs forever when I use a 13 second, 16-bit song sampled at 44.1kHz. Please let me know how I can improve the efficiency of this algorithm:

    x = desired_Fs/original_Fs; %desired and original sampling frequencies
    len = x * length(y); %y is the input signal
    q = x - 1;

    for i = 1:x:len
       for j = length(y):-1:i+1
            y(j + q) = y(j);
       end
       for k = i+1:1:i+q
            y(k) = 0;
       end
    end `
    upsampled_audio = y;


texts: Does anybody know a good library that does pitch detection in the browser? Anything in Javascript or Webassembly would suffice. My target is mainly singing voices. I already tried pitchfinder, but for me it reports frequencies that are a half tone to low. Are there any alternatives other than implementing an alorithm your self?


texts: Determining the probability of two signals, with added independent noise, being the same?

texts:
I have the first 100ms of two signals, each with a noise independent to that signal. I want to compare the two signals and determine the probability that these two signals are (minus noise) the same, and therefore come from the same source, i.e. if whether they are unique or not.

I am hoping there is a standard approach to a problem of this sort, and any hint in the right direction would be greatly appreciated. I did have a hacky machine learning approach, involving feature extraction and Euclidean space, but being a signal novice, I thought I'd ask here first.


texts:
Is there a process to remove a watermark ever present across all frames of a video?
I was thinking that comparing frames and taking pairs poorly correlated, could give a clue about the watermark both share. Or perhaps merging or adding all the frames could reveal the strong watermark pattern. O maybe is a work for a neural network.
The presence of this fixed pattern between other variable information make me think is feasible. I will be glad to read your insights about this problem.


texts:
"Envelope methods" can be used to describe and predict the output characteristics of a highfrequency non-linear amplifier such as a travelling wave tube. Apparently one of these methods is known as IMAL.

There's several aspects to IMAL which I'd like to gain a better understanding of:

I consider an input signal, which is a superposition of sine-waves of different amplitudes, phases and frequencies. I think I know how to compute the complex envelope of this signal. Both the amplitude and the time of the complex envelope, however, are time-varying. The nonlinear characteristics of the amplifier give the output amplitude and output phase according to the input amplitude. But using matlab, I clearly cannot assign to every of my time-varying amplitudes a new amplitude - it's just too many. I assume this is where linear interpolation is needed?
Also apparently the signal is defined in frequency domain and then transformed to time domain. Why would I do that? I already know my signal is a superposition of sine-waves (which is time-domain, right?). I don't even know how to describe this signal in frequency domain.

IMAL is described in this article [1] as

  Basically, IMAL utilizes an input signal
  defined in the frequency domain. An initial random phase value is assigned to each spectral line and the spectrum is converted into the time
  domain using the inverse fast Fourier transform (IFFT). As we are interested in the intermodulation falling in the amplifier band, the band-pass input signal is then converted to a complex lowpass equivalent
  one (complex envelope) and this is distorted using the nonlinear characteristics of the microwave amplifier. A linear interpolation routine
  is used to distort the signal and it is then transformed back to the frequency domain (FFT) to obtain the desired characteristics.

[1] "Computer Simulation of Intermodulation Distortion in Traveling Wave Tube Amplifiers" by Richard G. Carter, Wolfgang Bösch, Vishnu Srivastava, and Giuliano Gatti, in: IEEE Transactions on Electron Devices, Vol. 48, No. 1, January 2001. Available online from the University of Lancaster.


texts:
$$x[n] = \big(A_1 r_1^n\cos(\omega_1 n) + A_2 r_2^n \cos(\omega_2 n) + A_3 \sin(\omega_3*n) \big)u[n],$$

where $\qquad \omega_1 \ne \omega_2 \ne \omega_3, \qquad   |r_1|,|r_2|<1 $

I need an linear prediction model that perfectly predicts the signal with zero error $\forall n \ge n_0 > 0$ and how to find the $n_0$

I am not sure how to proceed with this as my initial thought was to minimize the energy of the first two terms that include $\cos(\omega_1 n)$ and $\cos(\omega_2 n)$ but something seems off.


texts: Transfer function estimation from frequency response

texts:
Let's assume that we know that we are dealing with a SISO second order system for which we have the frequency response (magnitude and phase for a known frequency range ω). What methods would people use to fit the frequency response to a transfer function (i.e. transfer-function estimation)? How does this process look like?
Also, this looks like a one-liner in Matlab (see tfest). Is there a Python equivalent?


texts: Using fourier coefficients to reconstruct data in matlab

texts:
When doing a discrete fourier transform on some data using matlab's fft function, its output is a set of fourier coefficients but I was wondering how do I go about converting these into an and bn so I can reconstruct the signal using sines and cosines.

E.g. I'd have a for loop that continually adds up ai cos(ix) + bisin(ix), where i = 1:N


texts:
I have a movie projector which is projecting an image on a brown wall. The projector allows me to adjust 6 values. Red brightness, Green brightness, Blue brightness. Red contrast, Green contrast, Blue contrast.

Is it possible to "cancel out" the color of the brown wall by adjusting the RGB values of the projector? By cancel out, I mean so that the end result of the projected image is equivalent, as if the wall was a more neutral gray or white.

If this is possible, is there a way to do it without an expensive colorimeter? Maybe with some image processing from a phone camera?


texts: Motivation for using gabor transform instead of fourier transform

texts: I am trying to understand the motivation for the above question for signal processing and image processing? Can anyone answer this question, or provide me with resources for this?


texts: How do I implement the CDF wavelet inverse?

texts:
I understand and have implemented a 2D discrete wavelet transform that uses a Haar wavelet to process images.

Now I would like to implement a 2D Cohen-Daubechies-Feauveau wavelet transform, but I am uncertain about how to do the inverse transform.

The Haar transform uses a 2x2 kernel, so I have 4 coefficients for each 2x2 block of pixels, and it's obvious to me how to reverse transform to reconstruct my pixels.

The CDF wavelet uses odd tap filters, so at each image location (i,j), I have 4 coefficients.  It seems, therefore, that there is no need to downsample -- I can simply get 4 coefficient images, where each is the same size as the original image, and then run the reverse transform on those four images to reconstruct the original.  Is that correct?

This is the method I tried, but it does not restore the image -- it just gives me garbage.

If A is the low pass filter and B is the high pass filter, x is the image, and x(A,B) means apply filter A to x horizontally and B to x vertically:

x1 = x(A,A)
x2 = x(A,B)
x3 = x(B,A)
x4 = x(B,B)
y1 = x1(B,B)
y2 = x2(B,A)
y3 = x3(A,B)
y4 = x4(A,A)

Sum y1, y2, y3, y4 to get original image, x.

Does this method look correct?

I am certain that I am doing the forward transform correctly, but I am unsure about the reverse transform.  I have read the Wikipedia article on Fast Wavelet Transform, and I believe that I am implementing what this page states (without the downsampling).


texts: How exactly do I plot a constellation Diagram?

texts:
I am relatively new to signal processing and I would like to correctly draw a constellation diagram to check the results of a study. I need my signal processing to be as close as them to make sure I am doing it correctly.
I am trying to use constellation diagrams to fingerprint ADS-B signals which use a PPM (pulse position modulation) scheme. Considering I got some IQ data, it is sufficient to do a scatter plot of the IQ data to call it a constellation diagram ? Or do I need to collect only samples from IQ data that are in special positions(like the position of the pulses)? I am also asking this question because I do not get exactly the plot that the study shows for constellation diagram. I would be very thankful if someone can point why there is a difference or something I missed/misunderstood.
Here is the link of the study
You can find the plots on page 4, FIGURE 8. (What they call contour stellar image is just a constellation diagram but with colors based on density of points nearby from what I understood (FIGURE 7)).
And Using the following python code:
from scipy.stats import gaussian_kde
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)

xy = np.vstack([in_phase,quadrature])
z = gaussian_kde(xy)(xy) #This is just to get colors to see better

ax.set_xlabel("in_phase")
ax.set_ylabel("quadrature")

ax.scatter(in_phase, quadrature, c=z)

I get the following images (2 exemple):


texts: What's the impact of aliasing in the time domain?

texts:
I've been studying digital audio and come across something I can't understand. There appears to be something like a consensus (among those capable of understanding such things) that the impact of aliasing on reconstructed time-domain signals is to ... smear(?) the timing. (Is that the right way to put it?) Here's a quote from a paper by Bob Stuart and Peter Craven, two prominent, respected figures in the audio industry: "Aliasing in the frequency domain is equivalent to the time-domain phenomenon of an impulse response that depends on where, relative to the sampling instants, the original stimulus was presented: see footnote 8." Footnote 8, which refers to a different passage in the article, says, "The complication is that because of the sampling, the total system is not time-translation invariant and so does not have a unique ‘impulse response’ – the response is slightly different according to the position of an original impulse relative to the sampling points."

I did some thinking, and some simple modeling, and came to the conclusion that the effect of aliasing on the reconstructed time-domain signal is to alter the amplitude in a quasi-random way. At the actual sampling instants, the deviation of the reconstructed signal from the original signal resulting from aliasing is zero: At precise sampling instants, aliasing has no effect. But in between those instants there are amplitude errors in the reconstructed signal. This is my conclusion from my own analysis. This is broadly true; I did not do an analysis specifically to determine the effect of aliasing on impulse response.

I cannot see how my conclusion--that of added amplitude noise superimposed on the time-domain signal as a result of aliasing--is equivalent to "the time-domain phenomenon of an impulse response that depends on where, relative to the sampling instants, the original stimulus was presented."

Insights anyone?


texts: How to transform lowpass fir filter to bandpass fir filter without using a built in function in matlab

texts:
The FIR low-pass filter was designed in MATLAB which characteristics are listed below. Coefficient of this filter was written in variable h. Basis on this filter design a band-pass filter with central frequency 1/5(normalized to fs) keeping the same gain and bandwidth. Give the listing in MATLAB(no using buitl-in function) which allow to set down coefficients of designing filter hx.

Thanks in advance


texts:
I want to find the pre envelope of

$$x(t) = {\Pi}_{a}(t)\cos(2{\pi}f_{0}t)$$
where

I found the Fourier transform to be
$$  \begin{align} X(f) & \triangleq \mathfrak{F}[{\Pi}_{a}(t)\cos(2{\pi}f_{0}t)] \\ & = a\text{ sinc}(2a(f-f_{0})) + a\text{ sinc}(2a(f+f_{0})) \\ \end{align} $$
So $$X_{+}(f) = 2u(f)X(f)$$
But I don't know how to continue from here.
Is there an easier way to find the pre envelope with another method?


texts: Low-pass elliptic filter design: equation for calculating required minimum order

texts: In this paper on page 4 (or in slide page, 23), it describes the equation for calculating the minimum required order for elliptic filter for design specification. However, it says it is only the estimate, and I wonder how the equation is actually derived. Can I trust the equation in all applications, or should I give some doubts before using it?


texts: Given a filter (coefficients) how can I make it minimum phase?

texts:
Consider we have a low pass FIR filter (or other type of filter) that means the filter coefficients are given. Now we want to have the same (or almost) frequency response  but a minimum phase filter. Is there a method to derive the minumum phase filter from the given filter coefficients.

One can find the roots of the given filter, is there a way to bring the roots that are outside the unit circle into the unit circle so that the corresponding roots are minimum phase?


texts: Effect of redundant training data in HMM-based speech recognizer/synthesizer?

texts:
How are redundant training data handled during the training stage?

For example, assume we have one observation for phone $\theta$ in the training set.

Then the training (for a monophone) is done with:

$$\lambda_{max}^\theta = \text{arg} \max_\lambda p(\bf{O}|\lambda) $$

where $\bf{O}$ is the observation sequence and $\lambda$ is the HMM model.

This is straightforward when only a single observation is available from the training set. But what happens when there are multiple observations for phone $\theta$ in the training set? How is $\bf{O}$ adjusted?


texts: Sequentially get the outer contour of an Edge Image

texts:
Hi CV/Pattern Recognition Community,

because my last thread was concerning the segmentation as BLOB and started to getting too big, with no clear results.
I would like to reconcider the last step of that process regarding the sequential gaining of object contour points.

I need to extract the contour of an image from a defined starting point (left) to the right (endpoint).
As you can see in the next image, there are two yellow windows (left and right). These are the mentioned start- and endpoints.
And what I want to do: Starting from the left yellow window and moving to the right, saving (x,y) coords of the regarding points. This is what the red line (contour) does.
The sequence of the contour pixels does matter.

I am at the step where I've only got a binary image,
So far, so good.
In the worst case still with holes and possible noise in the rest of the image.

So, here are some images, which I want to extract.

For this example, I'd like to get the outer contour line of the object on the table/underground. As you can see in the right upper corner and in the left upper corner are fragments of the edge detection process, which should not be traversed.

Thank you in advance.
Matlab and/or OpenCV Hints are welcome!


texts: How to subtract echoed signal from mixture of voice and echo signal?

texts:
I am working on an echo removal project. So far, I have successfully identified the far-end signal of length 21 ms at a sampling rate of 48000Hz whose echo is present in my near-end signal of 21ms. I did it using Echo Detection and Delay Estimation using a Pattern Recognition Approach and Cepstral Correlation
.
Now, I want to remove that far-end echoed signal from my near-end signal which contains(echoed signal of farend and voice).
Things I tried:

Time-domain subtraction of PCM signals. i.e $y[n] = x_{ne}[n] - x_{fe}[n]$, where $x_{ne}[n]$ is the near-end signal and $x_{fe}[n]$ is the far-end echo signal.
Spectral Subtraction technique Eliminate Signal A from Signal B. Even Ephraim-Malah

In both, I am not getting the expected result as for spectral subtraction I read that It works well when there is static noise or one signal is stationary. For non-stationary signals, it doesn't work well.
What are the other techniques to remove the echo in my scenario? Since I have identified the far-end chunk whose echo is present in the near end chunk, I just want to remove it from near end chunk.


texts: Applications for the Maximum Phase Filter

texts:
A maximum phase digital filter has all zeros outside the unit circle, and has the maximum phase and therefore longest delay for a given magnitude response.

Besides the possibility of needing a filter with the longest delay possible, are there other practical applications and uses of the maximum phase filter?

I understand that we can deconvolve linear-phase filters into a minimum-phase filter and its reverse a maximum phase filter, but looking for further utility and interesting use cases for maximum-phase filters specifically.


texts: Lowpass filter impulse response in frequency domain

texts:
A Linear Time-Invariant system with impulse response $h_1[n]$ is an ideal lowpass filter with cutoff frequency $\omega_c =\pi/2$. The frequency response of the system is $H_1\left(e^{j\omega}\right)$. Suppose a new LTI system with impulse response $h_2[n]$ is obtained from $h_1[n]$ by $h_2[n] = (-1)^n\cdot h_1[n]$. Sketch the frequency response $H_2\left(e^{j\omega}\right)$.

In this problem I know what a lowpass filter looks like in frequency domain but I don't know what $(-1)^n$ is. If I could just get some help with that, I could then convolve the two to get the frequency response. Or should I find the lowpass filter in time domain multiply it by $(-1)^n$ and then find its frequency response? Either way I would still need to know what to do with the $(-1)^n$.

Ok, so now I know that $H_1\left(e^{j\omega}\right)$ has a magnitude of $1$ and $0$ phase when $\omega <\omega_c$ and $0$ when $\omega>\omega_c$ and that $(-1)^n$ has a DTFT of: $$\frac{2}{1-e^{-j\omega}}$$ because $(-1)^n$ is not causal.

I then multiply the two and I get the same system as $h_1[n]$ but shifted by $1$ radian and its magnitude doubled? I am not totally sure, can someone please help?


texts: How can a zero-padded length n signal be truncated to n coefficients from which a signal can be reconstructed?

texts:
A wavelet transform is defined for infinite length signals. Finite length signals must be extended in some way before they can be transformed. I know that periodic replication and zero padding are appropriate for signals that begin and end on the baseline, while mirror -image replication and linear extrapolation provide continuity at the boundaries for signals that do not begin or end on the baseline. Periodic replication either wraps around or reflect the signal detail in the region beyond the boundaries and this distorts the interpretation of the transform coefficients near the boundaries.

I have a time series of limited duration not extending beyond the signal range and that is not a power of two as required by the transform (using R package wavethresh, function wst(), packet-ordered non-decimated wavelet transform). Zero padding seems to be the only way forward for signals that begin and end on the baseline. Also, zero padding makes no assumptions of the signal after the boundaries describing only the signal, however zero padding results in a non length preserving transform (one in which the transform vector is longer than the signal vector) and large perturbations in the transform space are not reflected in the signal space.

By doing zero padding (added at the beginning and at the end of the series) my question is how can I truncate the zero-padded signal of n coefficients to obtain n coefficients as be able to reconstruct the signal exactly.


texts: How to get the volume level from PCM audio data?

texts:
I have a decoded PCM audio data obtained from the Web Audio API.

I'd like to generate a chart that represents the volume level (perceived by humans) over time.

volume|
 level|    ******
      |   *      *                           **
      |  *        *                         *  **
      |**          *      ***              *
      |             ** * *   *            *
      +---------------*-*-----************------+--- time
      0                                        30s
          audio is             and quiet
          loud here            here

Here is my current approach, given I have an audio composed of 6 channels.

To calculate the volume level at time T:

For every channel, calculate the RMS value of 200ms window (44100 * 0.2 = 8820 samples, in my case). Time T will be in the middle of the window (ignore the edges).
Calculate the average of the 6 values obtained in step #1.

I get something like this:

Is this a reasonable approach to get the volume level?

Would translating RMS to dB (step #3: Calculate 20*Log_10(step #2)) produce a more accurate chart?

What would be some appropriate methods for smoothing / noise removal?


texts: Spatial frequency and video frequency of an image

texts:
in my lecture notes about image sensors (CCD, precisely) I have read the following statement:

The transfer function $F(\omega)$ of the image sensor is related to its spatial resolution function $F(\omega)$: for the pixel scanning time $t_p =1/f_v$ (the pixel spaced by W and $f_v$ = video frequency) the scanning
speed $v = \omega/t_p$ and the angular frequency $\omega$ (rad/s) are related to the spatial pulse $k$ (rad/
mm) of the pixel by the equation $v = ω/k$. So, the frame scanning frequency $f_q$ for N pixel frame is: $f_q = f_v/N$, where $N$ is the number of pixels. Then $F(ω) =  F(kv) = MTF$ (Modulation transfer function).

Well, it seems quite obscure to me, and I have not found so much on the web about how to read it. Precisely, I have these doubts:

what does k represents? It is related to $1/W$, so I'd say it is the number of pixels per mm of length. But on the web I see it is sometimes expressed in line pairs per mm or cycles per pixel (but I do not understand these definitions in this situation).

what is the video frequency $f_v$? Why do we say "video" about an image?


texts: Difference between causality and memorylessness

texts:
I have found the particular definitions.

Causality means that the output of the system does not depend on future inputs, but only on past input.

Memory-less - does not depend on previous values of either input or output.

I am looking for example of systems which are either non-casual or memoryless but not both.

Also i want to check whether I understand it well.

  $ T(x[n]) = x[n − n_{0}] $

  $T(x[n]) = ax[n] + bx[n − 3]$

Are those an examples of non-casual and memory-less systems?


texts: Discrete Fourier Series of square of a signal

texts:
I am having trouble in deriving a result, which asks me to find a relation between $X_{1}(k)$ and $X_{2}(k)$ where $X_{1}(k)$ are the DFS coefficients of single period of signal $x(n)$ and $X_{2}(k)$ are the DFS coefficients of two periods of the same $x(n)$. My approach is this.

$$X_{1}(k) = \sum_{n=0}^{N-1}x(n)W_{N}^{-kn}$$
and $$X_{2}(k) = \sum_{n=0}^{2N-1}x(n)W_{2N}^{-kn}$$
Since we know that $W_{N} = W_{2N}^{2}$. That means that, if I square $X_{2}(k)$, then I get this
$$X_{2}^{2}(k)=\sum_{n=0}^{2N-1}x^{2}(n)W_{2N}^{-2kn}=\sum_{n=0}^{2N-1}x^{2}(n)W_{N}^{-kn}$$
Now this is where I can't move further. What should I do with the last expression. I mean what are the DFS coefficients of the square of a sequence? And also note that now we are over two periods ($2N-1$).


texts: How would a Linear Gray Level Transform affect an image?

texts:
There are three basic gray level transformation.

  Linear
  Logarithmic
  Power – law

  The overall graph of these transitions has been shown below.

I am assuming a Linear Gray Level Transform is somehow related to the Identity line from the graph.

  Identity transition is shown by a straight line. In this transition, each value of the input image is directly mapped to each other value of output image. That results in the same input image and output image. And hence is called identity transformation.

From this statement I understand that in order to convert a colored image to a gray scale one (which I think Linear Gray Level Transform should do - converting to gray scale) I have to take each value of the input image and make a function that does a kind of conversion for each value.

I surfed the internet, but didn't managed to find a Linear Gray Level Transform example.

My question is if this is the right way (some kind of a small algorithm, if these are the steps) for a Linear Gray Level Transformation or if there is an example of images or an explanation of how does this Linear Gray Level Transform works.


texts: Transfer function of a nonhomogeneous difference equation

texts:
Consider the following difference equation:

$y_k=\alpha y_{k-1}+\beta x_k$

The transfer function for this is given by:

$\displaystyle\frac{Y(z)}{X(z)}=\frac{\beta}{1-\alpha z^{-1}} = \frac{\beta}{z-\alpha}$

How does one calculate the transfer function for

$y_k=\alpha y_{k-1}+\beta x_k + \gamma$?


texts: Relationship between Nyquist and Shannon channel capacity

texts:
Nyquist channel capacity(Cn) used for theoretical noiseless channel $C_n=2B\log_2(M)$

Shannon channel capacity(Cs) for noisy channel $C_s=B\log_2(1+\text{SNR})$

So is there a relationship between Nyquist and Shannon channel capacity?
is Nyquist channel capacity($C_n$) the upper limit? so $C_s \le C_n$?


texts: I'm confused about the notion of frequency when it comes to arbitrary data

texts:
In signal processing class we keep learning about how it's so useful to bring things into the frequency domain instead of the time or space domain but I'm very confused about what the motivation is or what the frequency actually corresponds to when it comes to arbitrary data.

Let's say I have some plot of sin(1:100) in MATLAB

and then plot(1:100, fft(sin(1:100)))

What useful information do I get out of the FFT of this function or in general, any function? And for some arbitrary data set like this (not corresponding to sound, pixels, etc.) how should we interpret the frequency?


texts:
I am working on an Android application that slims or fatten faces by detecting face. Currently, I have achieved that by using Thin-plate spline algorithm. http://ipwithopencv.blogspot.com.tr/2010/01/thin-plate-spline-example.html

The problem is that the algorithm is not fast enough for me so I decided to change it to OpenGL. After some research, I see that the lookup table texture is the best option for this. I have a set of control points for source image and new positions of them for warp effect. How should I create lookup table texture to get warp effect?


texts:
According to many references [1,2], the time-varying "impulse response" can compute wireless channel output $y(t)$ at time $t$ using the following expression:
$$
y(t) = \int h(\tau, t) x(t - \tau) d\tau
$$

In both references, they state that this represents the response of the channel at time $t$ to an impulse applied at time $t-\tau$.

It seems reasonable to assume that there is some version of x(t) that involves a delta function that we can apply as an input that returns $h(\tau,t)$ as the output.

Trying:
$$x(t) = \delta(t)$$
$$\implies y(t) = \int h(\tau, t) \delta(t - \tau) d\tau = h(t,t) \qquad \text{nope}
$$

Trying:
$$x(t) = \delta(t-\tau')$$
$$\implies y(t) = \int h(\tau, t) \delta(t - \tau - \tau') d\tau = h(t-\tau',t) \qquad \text{nope, but closer}
$$

Is there a way to generate something resembling $h(\tau,t)$ as the output?

$$
$$

References:

[1] Proakis, Digital Communications, 5th ed, p.832

[2] Goldsmith, Wireless Communications, 1st ed, p.67


texts: Where can we find noises like Gaussian, Rayleigh, Gamma, exponential noises in real world images?

texts:
I know that while taking pictures from a camera, noise may appear in the image.
It is often described as  Gaussian, but what about the other noises, when do they occur in real world?

Please help!


texts:
I am a computer science student and didn't really have signal processing as a subject. Maybe I should be clear on the concepts of sampling rate and frequency of the signal but I am a little confused.
I was trying to code and understand the process of finding MFCC filter banks on audio files. One intermediate step is to find FFT. I computed and plot the fft results of my audio but wasn`t sure that I was doing things correct as I didnt know the component frequencies that may have been present on my audio.

So I decided to form a sample wave and find and plot the fft results of the test signal.(The np.fft.fftfreq functions return the frequencies corresponding to the fft computed by np.fft.fft()).So my questions are

1) I found out value of y for time at a separation of 1ms seconds( 0 to 1, 1000 values). So my sampling rate should be 1000 right?. Then according to the np.fft.fftfreq() function, the second parameter should be 1/sampling rate. Then it gives correct values for 1/1000. However if I give sampling rate as 100(T=1/100) and give the second parameter as 1/100. It gives wrong results. Why??

2) If I give the frequency of the sine wave as 1080 instead of 80 for T=1/1000. Then also it gives same results as for 80. Why is it so?

# EXAMPLE SIGNAL TAKEN TO VERIFY ABOVE FFT PROCEDURE IS RIGHT
NUM=1000
T=1/1000
tt=np.linspace(0,NUM*T,num=NUM)
#So I take readings every T seconds = 1ms

print(1/T)
y=np.sin(2*np.pi*1080*tt)#+np.sin(2*np.pi*90*tt)
#plt.plot(tt,y)
NFFT=1024
mag_frames = np.absolute(np.fft.rfft(y, NFFT))
xf = np.linspace(0.0, 1.0/(2.0*T), NUM/2)
freq=np.fft.rfftfreq(NFFT,1/1000)
plt.plot(freq,mag_frames)

3) What should be value for the second parameter when I perform fft on a audio data imported from a .wav file by librosa library with sampling rate = rate

I am sorry if the problem is very simple or basic. I am really a beginner in this area, and could not get much help from results in Google search


texts:
I am trying to create or find a sound that localises well.

I read that emergency vehicles are changing their sirens; people found it difficult to localise the sound of the old siren (a sinusoidal sweep), and apparently this led to a lot of accidents. Apparently a single frequency is difficult to localise.

I've experimented using harmonic tones — I found that my brain can resolve higher frequencies, say > 600Hz, much better than lower frequencies,  say < 150Hz.

Unfortunately this is no good to me — I'm building a musical trainer game, and it's important that I communicate a direction without suggesting a pitch, so I need something else, maybe something like the sound of glass breaking or a clap -- anything that doesn't suggest a pitch.

I've experimented with static bursts, and found they don't localise nearly as well as the tones.

Could anyone suggest a good sample sound source?

I wonder whether something like a twig snapping would trigger some sort of primal reflex :)


texts: Example image that is degraded by shot noise and easily misinterpreted?

texts:
For illustrating the effects of shot noise (more precisely, emitter failure in fluorescence imaging) I am looking for a good example image. The image should ideally be easily misinterpreted, especially by non-aided human analysts, when a fair amount of shot noise is applied to it.

Does anyone know of such an image?


texts: Bandpass filter that automatically adapts its bandwidth when a transient is detected (to avoid to smoothen the transient)

texts:
Let's say we want to isolate a band 1000 hz +/- 50 hz.

Obviously, limiting the bandwidth by applying a passband filter will always destroy a bit the sharp transients (a Dirac or a rectangular envelope / Heavyside step function requires all frequencies, so if limit the bandwidth, we lose a part of it, and it becomes smoother).

Question: are there some adaptative band-pass filters that would auto-extend their bandwidth for a short time when a transient is detected, in order to not lose the sharp transients?

In this example (1000 hz sinusoid modulated by a rectangle envelope, input in blue):

the filter would of course still focus on the 1000hz +/- 50hz band, but it would extend its bandwidth near the transient so that the transient is not smoothened like with a normal filter (signal in red).

Does such an adaptative bandpass exist, and is it available easily in most languages (Matlab, Python, etc.)?

NB: on this graph there is nothing else except the 1000hz sinusoid, so you may wonder "why bandpass filtering?", but it's just an example, in the general case, it would be a broadband signal.


texts: Why use a 1-bit ADC in a Sigma Delta Modulator?

texts:
When looking at the discrete model of a Sigma-Delta Modulator as shown below, we can see that the quantizer is modelled as a white-noise source $e[n]$. From this model, we can derive the noise shaping property of the modulator.

$$
Y(z) = X(z) + (1-z^{-1})E(z)
$$

In a typical Sigma-Delta Modulator, the quantizer is realized by a 1-bit ADC, i.e. a comparator. However, the discrete model does not require 1-bit. So why only use an ADC with a resolution of one bit, and not e.g. two or three bit? The noise is shaped to be mostly present at higher frequencies, yes, but reducing the noise even further by choosing an ADC with greater resolution is an advantage anyhow.


texts: Clarifying matrix notation from an ICA-CMN paper

texts:
In the paper I am referring (and here from citeseer), complex vectors $\mathbf{z}$ and matrix $\mathbf{M}$ were defined as follows

\begin{align}
{{\bf z}} &= \left[z_{1},z_{2},\ldots,z_{N}\right]^{T} \in {\mathbb{C}}^{N} \\
{\tilde{\bf z}} &= \left[z_{1},z^{*}_{1},\ldots, z_{N},z^{*}_{N}\right]^{T} \in {\mathbb{C}}^{2N} \\
{\hat{\bf z}} &= \left[z^{R}_{1},z^{I}_{1},\ldots, z^{R}_{N},z^{I}_{N}\right]^{T} \in {\mathbb{R}}^{2N}\\
{\bf M} &\in {\mathbb{C}}^{N \times N}\cr \tilde{{\bf M}} & \in {\mathbb{C}}^{2N \times 2N} \cr {\hat{\bf M}} & \in {\mathbb{R}}^{2N \times 2N}
\end{align}

However, I can't seem to figure out how $\tilde{\mathbf{M}}$ would look like.
I have\begin{equation}
\mathbf{M} =
    \begin{bmatrix}
    z_{11} & z_{12}   & \dots     & z_{1N}\\
    z_{21} & z_{22}   & \dots     & z_{2N}\\
    \vdots & \vdots     & \ddots    & \vdots\\
    z_{N1} & z_{N2} & \dots         & z_{NN}
    \end{bmatrix}
\end{equation}
and the paper later clarifies
\begin{equation}
\hat{\mathbf{M}} =
    \begin{bmatrix}
    z_{11}^R & -z_{11}^I & \dots    & z_{1N}^R & - z_{1N}^I\\
    z_{11}^I & z_{11}^R & \dots    & z_{1N}^I &  z_{1N}^R\\
    \vdots   & \vdots    & \ddots   & \vdots & \vdots\\
    z_{N1}^R & -z_{N1}^I & \dots    & z_{NN}^R & - z_{NN}^I\\
    z_{N1}^I & z_{N1}^R & \dots    & z_{NN}^I &  z_{NN}^R\\
    \end{bmatrix}
\end{equation}
but not for  $\tilde{\mathbf{M}}$.
Thank you very much!


texts: Measure how Straight/Smooth the Borders are Rendered in an Image

texts:
I have two images:

I want to measure how straight/smooth the text borders are rendered.

First image is rendered perfectly straight, so it deserves a quality measure 1. On the other hand, the second image is rendered with a lot of varied curves (rough in a way) that is why it deserves a quality measure less than 1. How will I measure it using image processing or any Python function or any function written in other languages?

Clarification :

There are font styles that are rendered originally with straight strokes but there are also font styles that are rendered smoothly just like the cursive font styles. What I'm really after is to differentiate the text border surface roughness of the characters by giving it a quality measure.

I want to measure how straight/smooth the text borders are rendered in an image. Inversely, it can also be said that I want to measure how rough the text borders are rendered in an image.


texts: Fun problem: Dividing a dataset into parts depending on mean value

texts:
Ok, so I have some recorded data over several hours that looks like this (values on y, time on x).
See this image http://imgur.com/fdakUlk
I need a way to use matlab to divide the data into sections depending on their mean value. The sections needs to be atleas a couple of hours. Just by looking at the data they can easily be spotted, see this image: http://imgur.com/svrP79h
Is there a good method of doing this? What do I need to research?

Thanks


texts:
I apologize if the post is incorrect.

I'm a sophomore student studying Electrical engineering. As a part of an introductory course on signal and linear systems, I'm required to learn Fourier and Laplace Transformation.

But the problem is  I don't understand the concept of 'convergence' and it's really bugging me. It pops up throught the text.

So I want the suggestion to understand convergence from the beginning.


texts: The Fourier transform of a triangular window function

texts:
Windowing functions are explained on Wikipedia and they include plots of the Fourier transform for several windowing functions. For the triangle window  they provide

The above Fourier transform plot has a horizontal axis that goes from -40 bins to +40 bins, so this seems to be a discrete Fourier transform. However, I don't get a plot like that when I apply an FFT to 80 samples of a triangular window. I am further confused in that the graphic of the Fourier transform looks like a continuous plot rather than 80 discrete samples.

My questions are:
How does one create the plot for the Fourier transform of a triangular window?
Is the plot for a continuous Fourier transform or discrete Fourier transform?


texts: What base image size to choose to assist easier downsizing?

texts:
Android applications need image at different resolutions to support different screen densities and pixel size.

I am planning to provide only one image with high pixel size and let the underlying platform do the resizing. When we shoot an image with a professional camera, let's say I get image size of $5000\times 4000$ pixels. Which is obviously too high for mobile devices. Now to reduce the size of the file (to be bundelled with namtive mobile application) I have two option:

Keep the original image pixel size and perform high compresson at jpeg level
Downsize the image to more reasonable mobile screen upper limits say $2000\times 1600$ and keep jpeg compression low?

Which option is better quality wise considering target file size to be same?


texts:
Signal Characteristics:
The IF (I/Q) signal consists of a DC component and an AC component.

DC Component: 2.52V;
AC Component: 1.72 – 2.04 V (V P-P);
BW: 20Hz - 500kHz;
Power: 20dB

Requirement: Now I want to digitize this signal for further processing. I prefer a sampling at 1 MSPS with ADC and then porting digital data to PC using a FPGA over SPI interface.

Problem: The problem is, the signal with DC and AC component ranges from 3.5V to -1.5V with 2.5V from DC and almost 1V from positive cycle or negative cycle of the AC signal. Now I can use a coupled capacitor to block the Dcand use the AC for processing. My choice of ADC reference voltage is almost 2V-2.5V (for good resolution usability of ADC) so the signal can be amplified. But this signal have a negative part which I think is not good for a linear behavious for the ADC, as it has no negative reference voltage level. ADC reference is from 1V-5V. Using a rectifier is not a good choice from my view.

Question: How can I digitize this signal? Also comment on my views if not correct  as I have only theoretical knowledge and never worked on a practical project.


texts: Analysis Received Signal at receiver side

texts:
I'm trying to understand something which is really confusing me and I made my best to understand it but still confused.
If I have transmitted and receiver. Assume I want to transmit S(t) data and there's two multipath ways L1 , L2 in order to arrive the receiver.
Why when I have constructive interference then it's good for me ? in the paths/multipath there's might be destructive interference or constructive interference...my question why constructive interference is good for me..assume I get 2S(t) -constructive interference- in the received signal on the receiver ..why it's good for me ? what does it mean that I have 2S(t) and not S(t) ?
Im confused on the term constructive interference and how it's related to my received signal ..?
My confusion exactly is that-
I received 2X although I transmitted X , so 2X isn't X ..and we say that we received a good signal? if we received 2X which isn't equal to transmitted Data X so it's not the same data so it's considered distortion and it's not a good received signal.
thanks alot


texts: Fourier Transforms, symmetry, real/imaginary

texts:
I was hoping to clarify if the following was correct:

A real function (neither even nor odd) in time exhibits conjugate symmetry in frequency, so the real part of the frequency response is even, and the imaginary portion is odd
A real, even function has a frequency response that is strictly real and even
An imaginary, odd function has a frequency response that is strictly imaginary and odd

-also: Can anything be said if the function were imaginary in time (neither odd nor even)? Would it be anti-conjugate symmetric, so the frequency response would be such that the real part is odd and the imaginary portion is even?


texts: PSNR and SSIM on non-rectangular image regions

texts:
My goal is to compare the quality of an image with its low-resolution versions using an object quality metric like PSNR. Since such metrics can only be applied on same-sized images, I first upscale the low-resolution images to the origina size before any metric computation.
However, the images I'm using contain a single object-of-interest in the middle, and the rest of the image is unimportant background. Fortunately, I have the alpha channel stored in the images (sample here) which makes it easy to extract an alpha-mask (sample here) from the image that can be used to distinguish the foreground from the background and calculate the metric only on the foreground pixels (red areas below). The Compare tool of ImageMagick has a nice feature called read-mask which allows doing this in a simple way:
compare -metric PSNR -read-mask mask.png full.png half_upscaled.png diff.png

where full.png is the full-size image (without the alpha channel), mask.png is the alpha mask extracted from the original image, half_upscaled.png is the x2 lower resolution image upscaled to full-size, and diff.png is the generated image after comparison which shows the different pixels between the compared images. An illustration of the image, mask and diff are given below:

I believe it is correct to compute MSE/PSNR on such a masked region because ultimately the computed result depends on the pixel differences between two images. My question would it be conceptually alright to apply another metric like SSIM]6 to such irregular (non-rectangular) regions obtained by masking. My concern is that, since SSIM works on rectangular windows sampled from two images, an irregular pattern like this might lead it to produce false results. Indeed, when I compute PSNR and SSIM between the full and half-res (upscaled to full) images, I get 28.857 and 0.981623, respectively. The SSIM value seems to be quite high although PSNR value is rather medium/low. A second experiment using a quarter-res image (upscaled to full) gave the following result: PSNR: 25.1046, SSIM: 0.957227.
Edit: I understand that the result will strongly depend on the performance of the algorithm used for upscaling the images. This is also another issue to investigate. However, downsampling shouldn't play a role here because in the actual use case, all resolutions are obtained from a 3D engine which renders them in different resolutions, i.e. the original image is not downscaled to obtain low-resolution versions.


texts:
As part of a duplex scanning pipeline I need to detect empty pages such that they can be excluded from the OCR and the resulting PDF document.

Currently, I'm using a 'blurry' trim which works pretty well. Example with ImageMagick:

convert image-0001.png -shave 300x0 -virtual-pixel White -blur 0x15 -fuzz \
   15% -trim info:

(if the resulting dimensions are below a threshold then the page is considered empty)

But this is slow.

What are faster alternative approaches for accurately detecting empty pages in scanned images?

Things that complicate the empty page detection:

the noise - i.e. scanned dust etc.
margins/punch-holes that may show up as black lines
almost empty pages (e.g. just 2 words in 12 pt on an otherwise blank pages) must not be detected as empty
pages without any text but with images must not be detected as empty


texts: Isolating Bat Species without prior training base

texts:
I am attempting a project and I have been given Bat calls (in .wav) which are not ultra-sound navigation calls and I'm looking to isolate the different species of bats and monitor their activity.

The problem I am having is that I do not have a prior training set to be able to feature matching on the samples to try and identify them. I have been doing part research and I have looked at the following Link which gives details of the species of bats, their rep rate, FM/CF and Peak power.

From the link above, I am assuming that I can have some kind of array which contains the species of the bats, as well as their frequency (range) or "Peak Power" and then using an FFT algorithm, convert the samples that I have obtained and then match the output of the FFT against the pre-set array and therefore enable a platform to monitor their activity.

Here are the 2 questions:

1) Based on the above, does would this be an ideal solution in order to isolate the bats and therefore monitor their activity or would I need to implement further algorithms in order to isolate the bats calls?

2) I have only ever had experience of using the Cooley-Tukey FFT algorithm, would this be sufficient enough for this type of project?

Thank you for taking time to read this.


texts: How to reverse the effect of analog RC filters on calibration pulse?

texts:
I have a low-voltage amplifier with an analog LPF of ~106 Hz and a HPF of 0.482 Hz (both first-order RC).  I can choose to apply a calibration pulse that will shut off the input and send a 500uV, 5Hz square wave across this analog filter band.  The amplifier is followed by an ADC and I'm receiving all values in code.

What's the best way to use this calibration signal?  Is it possible to "reverse" the effects of the analog filters if I know what the input signal is, so that I could then calculate gain values?

EDIT: I will add that I have the basic calibration idea down... I am averaging the top and bottom values of the square wave (ignoring the transition values) and scaling to the expected 500uV.  I am looking for a way to account for the settling of the square wave due to the HPF.


texts:
I am currently reading the 'Coding' chapter on Rabiner & Schafer's Book on speech processing.

In one of its exercises, the reader is given a simple A/D converter using 16-bit uniform quantization. The converter uses a sampling rate of $Fs = 8000 Hz$. Then it asks what is the effect on $SNR_Q$ (quantization signal-to-noise ration) if we double the sampling rate.

From what I understand, doubling the sampling rate has obviously no effect on the quantizer's range $X_{max}$ as well as the quantization step $\Delta$. Furthermore, the theoretical model for $SNR_Q$ on uniform quantizers is built on top of the hypothesis that the quantization error $e(n)$ follows a uniform probability density, so:

$$
SNR_Q = \frac{\mathcal{E}(\sum_n x^2(n))}{\mathcal{E}(\sum_n e^2(n))}
$$

should remain constant, since both its numerator and denominator are calculated off expected values.

Is my thinking correct or does the change of the sampling rate break any of my assumptions?


texts:
Here Its says Hilbert transform is a non-causal,linear,and time-invariant system

How can I prove it mathematically?

wikipedia says the input output relation like this $$\boxed{y(t)=\frac{1}{\pi}\int_{-\infty}^{+\infty}\frac{x(\tau)}{t-\tau}d\tau}$$

so from this relation it showing time varying nature because

for $X(t-t_o)$,$y(t)$ is $${y(t)=\frac{1}{\pi}\int_{-\infty}^{+\infty}\frac{x(\tau-t_o)}{t-\tau}d\tau}$$

and $${y(t-t_o)=\frac{1}{\pi}\int_{-\infty}^{+\infty}\frac{x(\tau)}{(t-t_o)-\tau}d\tau}$$

So both are not same so its Time variant


texts: Why does Fourier Series have $\sin$ and $\cos$ Components

texts:
While we look at Fourier Series there are both $\sin$ and $\cos$ components.But I think $\sin$ component is ony needed to describe wave.why there is also an $\cos$ component in Fourier Series?

$S_n(x)$=$A_0 + \sum_{n = 1}^{\infty} (A_n\cos(nx) + B_n\sin(nx))$


texts: How to filter signals with non-uniform sampling rate?

texts:
I have a digital signal that was made from analog one by staggering sampling rate:

$\tau_i = \begin{cases}\tau_{even}& \text{if } i = 2n\\
\tau_{odd} & \text{if } i = 2n+1\end{cases}$

And I have a simple correlative filter, for example, smoothing filter

[1, -2, 1]

How should I calculate frequency response of such a filter?


texts: Separating out a sequence of DFTs with overlapping windows

texts:
Suppose I have a time series partitioned into $N$ equally-sized sections. Choosing some $k<N$, for each of the sections $i \in[0, N-k]$, I concatenate that section with the $k-1$ sections to the right and perform an FFT over that window. Below is a graphical representation:

With the results from all of these FFTs, can I construct the set of DFTs over each of the $N$ original sections that partition the time series without inverting each of my results?

Motivation
My underlying use case is a bit more convoluted than the case in the question, but I figured it is too specific to pose as the central focus. I am trying to reconstruct a faithful audio signal from video of a visualizer (this Reddit post details more of my process for the curious). To construct the visualizer, a DFT of the audio with a few hundred bins is collapsed into into 31 by averaging within each new bin range, then smoothed over time by widening the time-window beyond the video frame length.
Thanks to the collapsing, I have no way to recover any amount of the true original signal. However, I was hoping that I could construct the unsmoothed collapsed DFT if the solution in the uncollapsed domain is nice enough.


texts: How to calculate critical damping of a system with two springs and a damper (or two springs and two dampers)?

texts:
Background
For a simple system where you have a mass attached to a spring and damper in parallel:

We can calculate the critical damping from the equation of motion:
$mx_{tt} + cx_t + kx = 0$
$ms^2 + cs + k = 0$
$s= \frac{-c ± \sqrt{c^2-4mk}}{2m}$
There are then three conditions:

$c^2 <4mk$ (under damping)
$c^2 >4mk$ (over damping)
$c^2 =4mk$ (critical damping)

The damping ratio is then expressed by $\frac{c}{\sqrt{4mk}}$.
Question
I'm wondering if or how this can be extended to more complex systems.
Let's say you add a second spring to the parallel system:

This is a viscoelastic model where the constitutive relationship is in terms of stress (σ) and strain (Ɛ):
$σ = E_1Ɛ + \frac{η(E_1+E_2)}{E_2}\dot{Ɛ} - \frac{η}{E_2}\dot{σ}$
Is it possible to calculate the critical damping or damping ratio in the same manner? If so how would it work?
What about with two springs and two dampers like this?

$σ = (η_1+η_2)\dot{ϵ} + \frac{η_1η_2(E_1+E_2)}{E_1E_2} - (\frac{η_1}{E_1} + \frac{η_2}{E_2})\dot{σ} - \frac{η_1η_2}{E_1E_2}\ddot{σ}$
Is it possible to do the same and if so how?
My Guess
My guess is strain is equivalent to $x$ and stress is equal to force, so we can reword the 3 element system:
$0 = E_1Ɛ + \frac{η(E_1+E_2)}{E_2}\dot{Ɛ} - \frac{η}{E_2}\dot{σ} - σ$
$0 = E_1x + \frac{η(E_1+E_2)}{E_2}\dot{x} - m\frac{η}{E_2}\dddot{x} - m\ddot{x}$
$0 = E_1 + \frac{η(E_1+E_2)}{E_2}s - ms^2 - m\frac{η}{E_2}s^3$
Which according to Wolfram gives the following roots:
$s = \frac{-E_1E_2}{η(E_1+E_2)}$
$s = ±\sqrt{\frac{E_1}{m}}$
But that is not useful for solving any critical damping scenario that I can figure out.
Is there some other approach or what did I screw up?
Any help or guidance is appreciated. Thanks.


texts:
Hi I am working on one project and I have some trouble with comparison audio files. I have read a lot of articles about this problem but I couldn't find a good one working.

In my project I need to compare two audio events like gun shot, explosion, crying, breaking of glass, ... These files have max 5sec duration but it can be different. I store these in database and there will be more examples from one audio event. Users will load his .wav file (max 5sec) into program, and program shows all files in database where is similar with the uploaded audio event. What I need is recognize which audio event is it. For example if an user uploads some explosions, program will return all files including some kind of explosion. So I am not looking for exact match. I just need find out how similar is this file with these in database. I need it in some numbers , maybe in percentage, so I can tell the files which match 90% or more.

So what is the best technique to find this kind of similarity, which way is best for my case?


texts: Image Compression (JPEG) - Show the Effect of Number of Coefficients on Quality

texts:
write an m-file that will take the"cameraman" and produce a image quality or difference matrix for spectral selection method.The image properties are a sfollowings:
For spectral selection:
image1:DC coefficiant only
Image 2:first A/2 coefficiant including DC,where is the number of coefficiants prior to the EOB symbol.
All non-zero(A) coefficients including DC

This is my homework.I do not want to give me the ecaxt answer,but please can u give me any idea or link where might be related and helpful in finding the answer.
sound really tough to me.
cheers


texts: Is it possible the difference between OFDM-CP and OFDM-ZP about 10dB

texts:
I'm building basic matlab code for ofdm, but when I change the CP OFDM into ZP-OFDM with sme parameters, I get the performance is worse by up to 10 dB!! Is that right ? or there is some thing wrong in the code !!

clear all; clc; clear;

N_sub = 64;   %Num of subcarriers
N_sym = 20;    %Number of symbols
Mod = 4;         %Modulation order
bi = log2(Mod);  %Number of bits
N_bits = N_sub*N_sym*log2(Mod);
CP = N_sub/4;  %CP length

%set channel parameters
h = randn(1,16);
h = [h zeros(1,N_sub-length(h))];
h = repmat(h,N_sym,1)';
ntap = size(h,1) - 1;

SNR_dB = 0:2:20;
errors = zeros(length(SNR_dB),1);

N_fram = 10^3;        %Number of frame
for snr = 1:length(SNR_dB)
    for i = 1 : N_fram
        bits = randi([0 1], 1 , N_bits);
        data_temp = bi2de(reshape(bits,N_bits/bi,bi));
        % Set modulation of data
        data_mod = (1/sqrt(2))*qammod(data_temp , Mod);

        data_fram = reshape(data_mod,N_sub,[]);    %% Serial to parallel conversion

        %FFt operation
        data_freq_total = sqrt(N_sub)*ifft(data_fram);

        %adding CP
        data_cp = [data_freq_total(end-CP+1:end,:); data_freq_total];  %Adding CP
%         data_cp = [zeros(CP,N_sym); data_freq_total];                  %Adding ZP

        %channel convolution
        for j_c = 1 : N_sym
            y(:,j_c) = conv(h(:,j_c),data_cp(:,j_c));                          % Linear convolution
        end
        y = awgn(y,SNR_dB(snr),'measured');                          % add noise

        %serial to parallel conversion
        y_s2p = reshape(y,N_sub+CP+ntap,[]);

        %remove cp
        y_cp2 = y_s2p(CP+1:end-ntap,:);

        %FFT operation
        data_freq_total_r = (1/sqrt(N_sub))*fft(y_cp2,N_sub);

        %Channel recovery
        y_fft_total = [];
        for j_r = 1 : N_sym
            y_fft_c = data_freq_total_r(:,j_r);
            y_fft_l = y_fft_c ./ fft(h(:,1),N_sub);
        y_fft_total = [y_fft_total y_fft_l];
        end

        %set demodulation
        data_rec = reshape(y_fft_total, N_sub*N_sym,1);
        data_demod = qamdemod(data_rec, Mod);
        bits_r = reshape(de2bi(data_demod,bi),1,[]);

        %calculate the errors
        errors_ofdm = sum(xor(bits,bits_r));
        errors(snr) = errors_ofdm + errors(snr);
    end
    snr
end
err_ber_fram_ofdm = errors/N_bits./N_fram;
figure (1)
semilogy(SNR_dB,err_ber_fram_ofdm)
grid on
legend('OFDM');

The difference I perform when modifying the CP-OFDM into ZP-OFDM is as below:

%adding CP
            data_cp = [data_freq_total(end-CP+1:end,:); data_freq_total];  %Adding CP
    %         data_cp = [zeros(CP,N_sym); data_freq_total];                  %Adding ZP

What's the issue of that degradation of performance ?

thank you


texts: Detection complex vectors by using correlation

texts:
I sent out a complex vector $x_i \in \{x_1,...x_n \}$ and receive a vector $y$.

I use correlation $y^Hx_i$ to detect which $i$ was sent.

If $y$ is corrupted by AWGN channel, the optimum rule should be
$$\hat{i} = \text{argmin}_i |y-x_i|^2 = \text{argmax}_i \text{Re}\{y^H x_i\}$$
we compare the real part of correlation results.

But many applications and texts use the absolute value of correlation results, for example
Primary Synchronization Signal
Detection Algorithm in LTE-A  and Cross_Correlation_between_different_PSS.

Why should we use absolute value? Maybe because of fading that rotates the receive vector?

Could you give me some resources that explain this convention in detail?


texts:
I am currently trying to demodulate an Offset QPSK signal coming from a satellite using GNURadio.
If I understood correctly, an OQPSK is a QPSK with one of the two bits per symbol delayed by half a symbol duration to prevent 180° phase changes.
When trying to demodulate the signal, I tried two different approaches.
The first option is to delay the imaginary or real part of the signal by half a symbol duration before further processing it as seen in the first screenshot.
This should restore the original QPSK signal which can then be further demodulated.
This results in a constellation diagram, where you can see the QPSK constellation but with a lot of artefacts.
Both the graph and the resulting constellation diagram are shown in the first screenshot.
The second option is to treat the OQPSK signal like a QPSK signal at twice the symbol rate.
This should work since the additional phase changes are happening exactly at the middle of each symbol.
However, this method results in a way worse constellation diagram than the first option, as seen in the second screenshot.
Has anyone already managed to demodulate an OQPSK signal with GNURadio and can help me out
here?
Thank you and kind regards
valkyrie


texts: Sine-weighted moving average on non-periodic, stationary signal

texts:
I am looking for -or trying to create- a filter with a piece-wise monotonic second derivative in such a way that when placed on a non-periodic input signal, changes in sign of the second derivative happen as soon as possible and piece-wise monotonicity of the second derivative (so also of the first derivative and the filter itself) is kept intact at all time.

Let me explain:
I have a non-periodic, stationary signal. On this signal, I calculate a Triangular Weighted Moving Average (SWMA): the impulse response vector looks like the positive part of a sinusoid, the weights of the moving average add up to 1. It's a FIR filter, I think a low-pass filter. What I like about this filter is that its changes in sign of its second derivative ("bending points") coincide roughly with the local extrema of my signal (like it's switching from "convex" to "concave"): if I would place a spline on it, the spline's stationary points would more or less coincide with these "second derivative sign switching points" or bending points of the filter.

I am trying to predict up/down segments using the 1st and 2nd derivative of the filter: if the SWMA was declining and the second derivative is also negative, I wait for the second derivative to turn positive and that is where my predictor turns positive for the signal, then later, when the SWMA is going up, I wait for a deceleration: for the second derivative of the SWMA to go from positive to negative: that is when my prediction turns negative for the signal. It is a causal / real-time system.

This filter (SWMA) has a lag, but because its second derivative is either going up for a while, or going down for some time (=piece-wise monotonic) I can use the bending points: look at a change in the sign of the second derivative, instead of simply looking at the slope.

The issue with my SWMA is that its second derivative is not exactly piece-wise monotonic: there's a bit of noise around turning points. Instead of filtering this second derivative with a low-pass filter, do you know any other filters that score better on this property? Or how would you construct a filter with the desired behavior?

Take a look at this image.

The purple line in the upper panel is a smoothing spline, the thin gray line is my signal, and the yellow line is a sine-weighted moving average (window length 14). The red circles on the yellow line are where the momentum starts to slow: if the filter is rising, then that's where the acceleration stops and the rising starts to slow, if the filter is decreasing, the red circle is where the acceleration in the decline stops and the decrease starts to go slower. You see that these points coincide with the turning points of the smoothing spline. Now this is a hand-picked example, showing ideal behavior of what I want to achieve. In reality, the transition between an increasing momentum and a decreasing momentum section of the filter is not so abrupt: it is noisier. If you looked at a sinusoid with period 2pi, these transitions would also be very strict (at pi/4, 3pi/4, 5pi/4 and 7pi/4). Is there a causal filter that also has this property?

Thank you for any feedback.


texts: Optimal amplitude of an $m$-bit sinusoid

texts:
A continuous-time sinusoid of zero-to-peak real amplitude $A \le 2^{m-1}-0.5$ (e.g., for $m=16$, $A \le 32767.5$) is quantized to $m$-bit resolution by rounding it to the nearest integer (Fig. 1). What is the optimal amplitude for different $m \le 24$?

Figure 1. For $m = 4$, a sinusoid of the maximum allowed amplitude $A = 7.5$ (blue solid line), its quantization (orange dashed line), and the most negative and positive 4-bit two's complement signed integers -8 and 7 (yellow).

An answer is desired for each of two alternative definitions of optimality:

maximize signal-to-noise ratio (SNR), where the signal is the original sinusoid and noise is the quantization error, and
minimize total harmonic distortion (THD), which is normalized against the amplitude of the fundamental frequency in the Fourier series of the quantized sinusoid.


texts: Can I see from the PSD if a system is a LTI system?

texts: I am studying the meaning of the power spectral density (PSD) and I am wondering whether I can see from the PSD of the input signal and output signal if a system is a LTI system?


texts: Does the DTFT of $\frac{u[n-1]}{n}$ exist?

texts: I have started learning DSP on my own and I have this doubt. I have done some googling but haven't found an answer. I hope that someone here would give the answer. It will be of great help.


texts: GCC-PHAT (Generalized cross correlation) always peak at delay=0 on real audio signal

texts:
I have studied the GCC-PHAT algorithm to estimate TDOA on audio signals at 2 mics.

Here is my MATLAB implementation:

function cc = freq_xcorr_phat(x,y)
  n = length(x)+length(y)-1;
  X = fft(x,n);
  Y = fft(y,n);
  R = X.*conj(Y);
  R = exp(1i*angle(R));
  cc = ifft(R);
endfunction

I use a SIMULATED stereo audio signal (where channel 1 is an real audio recording and channel 2 is channel 1 with a specific sample delay, 7 samples in this case) to test this function. The result GCC-PHAT cc is plotted below, where we can see that it shows the expected result, a peak at -7:

BUT, when I use a REAL stereo audio signal(channel 2 delay 15 samples) to test this function, the result GCC-PHAT plot goes weird. We can see that it has a peak at -15, but the peak at 0 is more stronger:

THE QUESTION IS:

Why the second plot peakd at 0 and stronger than peak at -15? It doesn't make sense to me.

p.s.

The plot is actually the middle part of fftshift(cc).
My question might be relevant to this question.
The real stereo audio signal is recorded from an embedded system(MCU).