Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
17

What your distortion box does is apply a non-linear transfer function to the signal: output = function(input) or y = f(x). You're just applying the same function to every individual input sample to get the corresponding output sample. When your input signal is a sine wave, a specific type of distortion is produced called harmonic distortion. All of the ...


15

The physically "correct" way to do this is summing the samples. However when you add two arbitrary samples, the resulting value could be up to twice the maximum value. ... The naive solution here is to divide by N, where N is the number of channels being mixed. That's not the "naive" solution, its the only solution. That's what every analog and digital ...


14

It's very hard to point you to relevant techniques without knowing any context for your problem. The obvious answer would be to tell you to adjust the gain of each sample so that clipping rarely occurs. It is not that unrealistic to assume that musicians would play softer in an ensemble than when asked to play solo. The distortion introduced by A + B - AB ...


8

What you trying to achieve is called distortion. This techniques used when you want to add some harmonics to given signal. You have 2 basic methods to do this: waveshaping and ring modulation.I'll try to explain first one. Waveshaping Waveshaping allows you to make distortion via use of specially selected function. One of useful methods is Chebyshev ...


8

Thanks to the plot in Olli Niemitalo's answer I got convinced that the formula given in the book has a sign error. The non-linearity used for fuzz or distortion is always some type of smoothed clipping function, which compresses the input signal. So small input amplitudes experience little change whereas high input amplitudes are (more or less) softly ...


7

This answer discusses the harmonic spectra of the quantized sequence in five cases: limit $f/f_s \to 0$, synchronous sampling of a cosine with rational $f/f_s$, synchronous sampling of a sinusoid of arbitrary phase with rational $f/f_s$, asynchronous sampling of a sinusoid with rational $f/f_s$, and asynchronous sampling of a sinusoid with rational $f/f_s$ ...


5

One way this can be done for non-real-time mixing to use a look-ahead AGC, where the gain of one or both channels is lowered at a hard-to-perceive rate before the sum amplitude exceeds the clipping limit. The less look-ahead available, either the the AGC gain adjustment will become more audible, or the max gain for for a softer gain adjust ramp will get ...


5

the formula $$\text{result} = A + B - AB$$ doesn't make any sense, even if you mean something other than $AB = A*B$. One thing you need to think about is that sound varies above and below zero. A better way to think about it is like this: $$\text{result} = g( A + B )$$ where $g\le 1$. The most simple approach is to say $g = 0.5$, which is conservative, ...


5

|x| denotes the absolute value - the x / |x| bit of the formula is there to make sure that the sign of the input is preserved in the output. Regarding the implementation, yes, the steps you have listed are correct.


5

Applying a non-linear function will always introduce harmonics, and mixing non-linear functions with sampled versions of continuous signals does add the wrinkle you note above (where high-frequency harmonics are aliased to low frequencies.) I can think of a few ways to proceed: You can use an oversampling factor high enough to capture the extra harmonics (...


5

One possible tool is Wave Digital Filter analysis which is a type of physical modeling that represents signals as travelling waves. It can also be extended to non-linear elements such as diodes. However, for distortion unit, you could instead of trying to digitalize the analog circuit try to extract a waveshaper from its behaviour. Common waveshapers are ...


4

A few approaches to alias-free nonlinear distortion (in increasing order of difficulty): Subband distortion: Use a low pass filter to extract the lower end of the signal. If you choose a cutoff frequency of $\frac{f_s}{2N}$ you can apply any non-linear transfer function $f$ with derivatives starting at $f^{N+1}$ vanishing to avoid aliasing. Add just the ...


4

In the audio domain, waveshaping is simply applying a memoryless nonlinear function to an input signal. $$ y(t) = g\big( x(t) \big) $$ The waveshaping function, $g(x)$, is most often a continuous function that goes through the origin: $g(0)=0$. Sometimes $g(x)$ is an odd-symmetry function: $g(-x)=-g(x)$, but it doesn't have to be. Sometimes you want 2nd ...


3

I think your question comes from several misunderstandings. The fact that the phase lag of a system becomes more negative for large frequencies does not mean that there's more distortion of larger frequencies. Neither does it mean that high frequency signal components experience more delay when passing through the filter. Imagine an ideal system that simply ...


3

Using those four basic elements will allow you to implement linear systems, which can change the magnitude and phase of the input signal, but which will not add the harmonics that are expected from a distortion effect. In order to create distortion in that sense (i.e., non-linear distortion) you will need some non-linear element. The most basic ...


3

if you treat the diodes as having memoryless non-linear volt-amp characteristics and treat the capacitor as linear and having memory, you can use Euler's backward method to represent the capacitors and everything else are static Kirchoff equations (with some nonlinearity, you need to represent the back-to-back diodes accurately - the standard diode equation ...


3

The harmonics will be in the range of -150dB to -170dB. The exact value will depend on exact frequency, phase relationship to sampling frequency, phase locked or unlocked, rate of phase drift, integration interval, index of harmonics, etc. You need to specify this all in excruciating detail to get anywhere near the resolution that you are asking for. I ...


2

Lower the global volume. Impulse tracker classically outputs channels at about 33% volume max by default. That seems to be both loud enough for music with few channels (4 channel Amiga MODs) and soft enough for songs with 50 channels (since channel contents are typically not correlated so volume doesn't add up that fast past a certain level... plus few ...


2

I had talked with a mixer designer of the late 1990's and first 2000's that was going on the digital wave (after having tiptoed). I think the guy was a designer for SPL, but maybe not that big, I absolutely don't remember neither the name neither the brand, I just remember how really really big and expensive the machine was. We spoke long, and finally spoke ...


2

One algorithm that qualifies as bandlimited distortion is the use of Chebyshev polynomials with sinusoidal inputs for waveshaping synthesis. The Chebyshev polynomials [of the first kind] can be defined as $$ T_n(x) = \mathrm{cos}(n \, \mathrm{arccos}(x)). $$ I won't go into details here, but there's a relatively simple derivation using De Moivre's Theorem ...


2

Saturation can be modeled to first order as a symmetrical distortion of the signal, but it also has history dependence--hence the term hysteresis in describing magnetic response to a field that is applied. Bias (an AC field applied to the tape at the same time as the signal to be recorded) linearizes the curve and reduces hysteresis effects by eradicating ...


2

I agree with Jim Clay's answer, but I think it is important to point out two things. First of all, there are no phase distortions due to the hold operation, just a simple delay of half a sampling interval. So nothing needs (and can) be done about the phase. Second, it is important to realize that the gain roll-off due to the sinc shape is relatively mild. ...


2

What you are describing is the distortion introduced by an ideal digital-to-analog converter (DAC) in the analog domain. Two things are typically done to reduce this distortion: Analog filtering Oversampling As you note in your question, the distortion is modeled, in the frequency domain, by a sinc rolloff. Increasing the sample rate before converting ...


2

You can create non-linear digital systems (an example would be a system that finds the absolute value of the input). You can also simulate an analog non-linear system using DSP. The easiest way is to use a power series. Assuming that the non-linear system you're modeling is time-invariant and memoryless, you can approximate it as follows: y(t) = a0 + a1*x(t)...


2

You are apparently in the context of no-reference, reference-free or blind image quality assessment. The topic is quite active, and I am not sure people have already a completely accepted framework for that. Multiple distortions may affect images: random noise, compression artifact, static blur, motion blur, etc. They require different metrics (benchmark ...


2

Well, you can have an approximation. Due to the forms in the image are non regular, completely plain, its hard if not impossible to know the camera distortion. But if you know the size of the wheels and also you have the measures of the stones you can approximate the distance of the cart to the stones by using this equation: $$ D_w = \frac{S_w * f}{P_w}, $$ ...


2

Short answer: No. Long answer: you can of course create shadowing that way, and that would disturb operation. And of course, a glass wall will refract infrared just as it refracts any other light. But glass is usually IR-transparent, just as it is transparent visible light, and an IR remote isn't exactly a source of a focused beam, so chances are that, no, ...


2

Note that with the definition of generalized linear phase $\phi(\omega)$ according to $$H(e^{j\omega})=|H(e^{j\omega})|e^{j\phi(\omega)}\tag{1}$$ and $$\phi(\omega)=\alpha\omega+\beta\tag{2}$$ the restriction that the impulse response $h[n]=\text{IDTFT}\{H(e^{j\omega})\}$ be real-valued only allows two possible values for $\beta$: $$\beta\in\{0,\pi\}\...


2

I have tested your code. There are problems with the decimation and upsample stages. When you run the analysis and synthesis filters at the undecimated rate, then you get the perfect reconstruction (plus a filter shift) First of all in case of applications which are sensitive to group delay, you should better use the conv / filter function and then ...


2

Blur If you want to reverse Blur applied on an image (Using Convolution, namely Linear Spatial Invariant Blur) you should use Deconvolution which, as name suggests, the inverse operation of Convolution. Have a look at What Are the Types of Deconvolution, Sharpen Defocused Image (Deconvolution / Image Restoration), Deconvolution by Convolution and 1D ...


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