8

if the two audio signals are totally uncorrelated, the the squares of the two crossfade gains should add to 1. so, to prevent that dip, your crossfade function will look more like $\sqrt{\frac{1}{2}(1+t)}$ and $\sqrt{\frac{1}{2}(1-t)}$ rather than $\frac{1}{2}(1+t)$ and $\frac{1}{2}(1-t)$ for $-1 \le t \le +1$. note, for constant power crossfades, at the ...


5

This is a continuation of the (music-dsp) thread started by Element Green titled: "Algorithms for finding seamless loops in audio" As far as I know, it is not published anywhere, although I have recently been informed that a similarly-themed paper by Marco Fink, Martin Holters, and Udo Zölzer has been presented at the 2016 DAFx conference, which is a while ...


3

Hm well, technically it is some kind of envelope: it oscillates between hilbert(x) and -hilbert(x). Your examples (dashed lines are $\pm$hilbert(x)): I'm assuming you're looking for something smoother. Matlab has a function called envelope where you have various ways of controlling how the envelope is extracted. Not sure if there is a Python equivalent. ...


3

$\DeclareMathOperator{\sgn}{sgn}$ The modulating signal in AM is $$s(t) = C + a(t)\text,$$ where $a(t)$ is the (audio) amplitude, and $C$ is a constant so that $s(t) \ge 0 \;\forall t$. (Otherwise, your audio amplitude would just frequently "switch" the wave's sign, not really modulate the envelope.) That means, $C > - \min_t(s(t))$. Therefore, the ...


3

As mentioned in the comments, an impulse response with the shape shown in your question can only be obtained by a system with two real-valued poles. In continuous time, with two distinct poles, the total impulse response is $$h(t)=\frac{e^{-\alpha_1t}-e^{-\alpha_2t}}{\alpha_2-\alpha_1}u(t)\tag{1}$$ It's a basic exercise to determine the location of the ...


3

That is because envelope centers the signal before computing the standard deviation and afterwards corrects for the mean. Try this instead: x = randn(50, 1); xRMS = sqrt(movmean(x.^2, 21)); xRMS_centered = sqrt(movmean((x-mean(x)).^2, 21)) + mean(x); xRMSref = envelope(x, 21, 'rms'); plot(xRMSref,'x-','DisplayName','xRMSref');hold on;plot(xRMS,'o-','...


3

As people in the other answer have been asking for a code snippet (and as I don't have enough reputation to comment on answers), here's the other answer implemented in C# (which should be easy enough to convert to other languages) /* returns a float array with two indexes representing the volumes of the left (index 0) and right (index 1) channels when t is -...


3

You've pointed out a very important distinction between theory and practice. In theory, as suggested by your book and in Fat32's answer, modulation schemes where all information resides in the phase of the signal, not in the amplitude, are called "constant envelope modulation". However, in practice our systems have finite bandwidth and instantaneous phase ...


2

Getting the envelope of a signal requires more than a simple band-pass filter. However, you could rectify the signal and bandpass-filter the rectified signal to get the enveloppe. That's how I used to do it with ultrasound signals. https://en.wikipedia.org/wiki/Envelope_detector You could also use more elaborate techniques, like the Hilbert transform (or ...


2

Computing the envelope of a signal via the Hilbert transform only works well for bandpass signals. But apart from that, you're not taking into account the delay of the Hilbert transformer when creating the analytic signal. It would be easier to choose an odd filter length $N$, because then you get an integer delay: $$d=\frac{N-1}{2}$$ Also note that there'...


2

Additional resource: this is JFonseca's code translated in Python: import numpy as np import matplotlib.pyplot as plt import scipy, scipy.stats, scipy.signal def adaptiveResonatorFilter(x,w0): X = np.fft.fft(x) mX = abs(X) mX = mX / max(mX) sf = scipy.stats.gmean(mX) / np.mean(mX) l = 0.99 if 0.5<1-sf else 0.0 B = [(1-l)*np.sqrt(...


2

Ok, I think I got your point. You want a BPF, $H(z)$, that auto extends its bandwidth accordingly to the energy distribution in the magnitude spectrum. If you have a pure 1k Hz sinusoidal tone (that corresponds, in the frequency domain, to a dirac delta located at $\omega_0=\pm2\pi 1$k rad/s), you want to pass only frequencies in the 1k$\pm 50$ Hz range, and ...


2

The notion of envelope is an ill-defined concept that describes the smooth upper and lower boundaries of more or less oscillating signals. The most classical technique rectifies the signal (take the absolute value) and low-pass filters the result. Of course, results are not unique. Other techniques identify local extrema and fit them with low-order ...


2

There are many good answers here. Additional information can be found in this paper: SIGNAL-MATCHED POWER-COMPLEMENTARY CROSS-FADING AND DRY-WET MIXING This is a rather math heavy paper that employs statistical signal processing methods. However, it will give you a more rigorous understanding if you are up to the task. Good Luck!


2

An ADSR has exactly five parameters, and you need these five to characterize it - every set of parameters yields a different envelope. And frankly, the ADSR envelope is pretty easy to visualize, and to understand: So, calculate the envelope of your signal, find the peak amplitude, the time it takes to reach that peak the plateau level the time it takes to ...


2

sampled at 25.6 Hz, 25.6 kHz is much more likely. Your signal contains a strong fundamental (probably the turbine itself) plus some "fuzzy" stuff on top which is the vibration signal the author is apparently after. You see this clearly in the spectrum: a strong peak at low frequency and a bit of fuzz between 4k and 8k Apply a high pass filter to get rid ...


2

A high-pass filtered signal has lost its low frequencies, so you can refocus the spectrum on a higher frequency range. When you rectify it, the first phenomenon is that the signal becomes positive. Hence, it is not zero-mean anymore, and thus recovers low-frequencies that were attenuated in the high-pass filtered signal. A second is the presence of higher ...


2

From the mathworks documentation of the function envelope(): The filter is created by windowing an ideal brick-wall filter with a Kaiser window of length fl and shape parameter $\beta = 8$. So without hacking the function you can't directly get the filter coefficients, but you can easily find them yourself by just doing what they do, i.e., windowing the ...


2

Your code does what you ask it do and the result look fine to me. It would be helpful to state why you think this is wrong and what you did expect instead. Envelope detection using Hilbert Transform works well for narrow band signals, (Amplitude modulation for example), but it typically does not do well for broad band signals as you do have here. You ...


2

@bjornhartmann. The material at the following web page explains, and demonstrates using MATLAB, how beat notes are generated when we sum two sine wave sequences: dsprelated.com/showarticle/189.php


2

If you add two cosines you simply get the product of the sum and difference frequencies. $$cos(x) + cos(y) = 2\cdot cos \left( \frac{x+y}{2} \right) \cdot cos \left( \frac{x-y}{2} \right)$$ If the frequencies are very close together, than the difference frequency is close to zero and that's what creates the "beat". The exact definition of what ...


1

'Imaginary' is a misnomer; they 'exist' as much as reals do. As for the envelope: it provides a meaningful representation of phase and amplitude over time, not otherwise doable with reals alone. To illustrate, consider a real $x(t) = a(t)\cos(\phi(t))$, where $a(t)$ is amplitude and $\phi(t)$ is phase at time $t$. Suppose we observe $x(t)$, but don't know ...


1

In music, we would call this "wavetable synthesis", but most electrical engineers would call this Direct Digital Synthesis (DDS) or a Numerically Controlled Oscillator (NCO). You need a phase accumulator, a sufficient number of points in your wavetable and a means to interpolate between points (if there are many points in the wavetable, linear interpolation ...


1

Another trick: Use linear cross-fade if two signals are identical and cosine-sine cross-fade for 90° of similarity. Cossine-sine function: $$ a(t) = \begin{cases} 0 & \quad \text{if } t \text{ < 0}\\ \cos \frac {πt}{2} & \quad \text{if } 0 \leq t \leq 1\\\ 1 & \quad \text{if } t > 1\\ \end{cases} $$ $$ b(t) = \...


1

You can represent any bandpass signal by its complex envelope. You must, however, pick a frequency for which you do that. In your first example, that frequency is $f_c$; in your second example, you need to pick $f_1$, $f_2$ or any other frequency as $f_c$ – and then represent your cosines into products of $e^{j2\pi (f_1-f_c) t}$ and $e^{j2\pi f_c t}$. Any ...


1

According to the usual definition, if you have a complex low pass signal (complex enevelope) $u(t)$ and a reference frequency $f_c$, then the corresponding pass band signal is $$u_p(t)=\text{Re}\{u(t)e^{j2\pi f_ct}\}\tag{1}$$ So if $u(t)$ is given by $$u(t)=A(t)e^{j\phi(t)}\tag{2}$$ the real-valued pass band signal would be $$u_p(t)=\text{Re}\{A(t)e^{j\...


1

In order to plot the amplitude of a spectrum in matlab, here's what you can do. Where y is the signal fs is the samplig frquency Code: spectrum = 10*log(abs(fftshift(fft(y))) / length(y)); %compute the FFT precision = fs/length(y); f = linspace(-fs/2+precision/2, fs/2-precision/2, length(y)); % Create the frequency axis and put the measure in the ...


1

One way is simply to plot the absolute value: X_total = fft(x_total); figure; plot(10*log10(abs(X_total).^2)); Note that if your signal is real, you can plot only the first part of the vector. Another option is to use the Welch Periodogram figure; pwelch(x_total);


1

Let's start with the easy one: Also apparently the signal is defined in frequency domain and then transformed to time domain. Why would I do that? Because it's easy and intuitive to do that. Say you want to test with oscillations of frequencies $\mathbf{f}=\left\{f_0,\ldots,f_n\right\}\subset \mathbb R$ with (randomly chosen) phases $\mathbf{\Phi}=\left\...


1

The sum of two sinosoids with different frequencies $f_{c1}, f_{c2}$ does not add up to a single sinosoid. Only, if both sinosoids have the same frequency, you can combine them into a single sinosoid using the equation you state at the end of your post. See also for example this post.


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