Login / Register 0 items | $0.00 New @ KVR
Kylotan
KVRist
 
34 posts since 11 Apr, 2009, from Nottingham, UK

Postby Kylotan; Sun Jul 30, 2017 2:35 am Help identifying/naming a distortion pattern?

Hey everyone. I'm pretty new to DSP stuff so I'm not sure whether this question is trivial or the opposite.

Basically I have a tone from existing software/samples that I'm hoping to replicate as an effect (not as an oscillator/generator), but I'm not sure how to do it.

I measured it with an oscilliscope to get an idea of what's going on. The top wave here is a middle C, pretty close to a pure sine wave, and the lower wave is what I want to get out, another middle C with the distortion added.

Since the positive and negative zero crossings on the pure wave have different results on the output I'm guessing that a simple waveshaper function won't cut it here. Maybe some combination of a waveshaper and a rectifier would work? Or perhaps there's something more complex there which I'd have to model?
You do not have the required permissions to view the files attached to this post.
mystran
KVRAF
 
4927 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Sun Jul 30, 2017 2:46 am Re: Help identifying/naming a distortion pattern?

Kylotan wrote:Since the positive and negative zero crossings on the pure wave have different results on the output I'm guessing that a simple waveshaper function won't cut it here. Maybe some combination of a waveshaper and a rectifier would work? Or perhaps there's something more complex there which I'd have to model?


You are over-thinking it, I think. There's no reason your wave-shaper has to be symmetric and in fact a "rectifier" is just another type of a wave-shaper too.
Image <- plugins | forum
Kylotan
KVRist
 
34 posts since 11 Apr, 2009, from Nottingham, UK

Postby Kylotan; Sun Jul 30, 2017 3:24 am Re: Help identifying/naming a distortion pattern?

Ok, let me see if I have this right - a waveshaper is just basically
Code: Select all
x' = f(x)
, where f is some arbitrary function and x is the sample/time domain value, correct? If so, I don't see how I can apply that to the above, because the above function seems to have 2 different output values where x=0 - it's roughly zero on the positive crossing, but significantly below zero on the negative crossing, because the sine-like crests on the second graph are narrower.

But, perhaps I'm just wrongly assuming there's some sort of phase shift here (as these were 2 arbitrary captures), and sliding the second pattern over so that it's in phase with the first would let me do it with just a single waveshaper. Hmm...
User avatar
antto
KVRAF
 
2496 posts since 4 Sep, 2006, from 127.0.0.1

Postby antto; Sun Jul 30, 2017 3:34 am Re: Help identifying/naming a distortion pattern?

from the pic, it looks like a foldback distortion
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.freenode.net >>> #kvr
mystran
KVRAF
 
4927 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Sun Jul 30, 2017 3:49 am Re: Help identifying/naming a distortion pattern?

Kylotan wrote:Ok, let me see if I have this right - a waveshaper is just basically
Code: Select all
x' = f(x)
, where f is some arbitrary function and x is the sample/time domain value, correct? If so, I don't see how I can apply that to the above, because the above function seems to have 2 different output values where x=0 - it's roughly zero on the positive crossing, but significantly below zero on the negative crossing, because the sine-like crests on the second graph are narrower.


There is probably some filtering in addition to wave-shaping that is messing with the zero-crossings. It's also not entirely uncommon to have some feedback around a wave-shaper to essentially turn it into a non-linear filter. In general though, sine waves are not terribly helpful as test signals, because you don't really see what happens with regards to filtering. I'd probably try a saw-wave (use the cleanest band-limited source you can get your hands on) at very low amplitude (to avoid the non-linear behaviour as much as possible) to get an idea of what type of filtering might be going on (plot the spectrum and compare with reference).
Image <- plugins | forum
camsr
KVRAF
 
6820 posts since 16 Feb, 2005

Postby camsr; Sun Jul 30, 2017 5:05 am Re: Help identifying/naming a distortion pattern?

So much about this sound is unknown, so we can really only speculate. Share the source if you can.
Image
User avatar
nonnaci
KVRist
 
248 posts since 7 Feb, 2017

Postby nonnaci; Sun Jul 30, 2017 7:12 am Re: Help identifying/naming a distortion pattern?

Maybe do a sine sweep and plot a 3D waveform or spectrogram. Should give you more info on the type of harmonic distortion it's doing.
JCJR
KVRAF
 
2257 posts since 17 Apr, 2005, from S.E. TN

Postby JCJR; Mon Jul 31, 2017 7:26 am Re: Help identifying/naming a distortion pattern?

There may be some kind of foldback going on, dunno. But in addition to assymetrical waveshaping, applying different distortion to positive and negative excursions-- You can also get assymetrical results by adding some dc to the input before symmetrical waveshaping.

Adding DC offset before distortion might be more successful on a steady-amplitude synth oscillator output, and maybe less successful on a "real world" signal which has greater variability in amplitude, such as guitar or bass.

Or you could use symmetrical waveshaping but apply different amounts of pre-gain to positive vs negative excursions.

If you add DC blocking, highpass after assymetrical waveshaping-- The assymetrical waveshaping changes the duty cycle of the wave and so after the highpass to remove DC the wave can have odd dynamic behaviors because the zero-points of the distorted wave are dynamically changing according to the envelope and amplitude of the input signal.

Allpass filters can make a waveform look odder than it might sound to the ear. Assymetrical waveshaping followed by one of more midrange allpass filters could move the distorted peaks around relative to the input peaks, so that a "dual trace" comparison of input vs output might look strange indeed.

Or you could put allpass filters in front of the waveshaping. Or both front and back. Frequency contouring filters would do it as well. Anything with phase shift, including the DC blocking stage.
User avatar
antto
KVRAF
 
2496 posts since 4 Sep, 2006, from 127.0.0.1

Postby antto; Mon Jul 31, 2017 9:05 am Re: Help identifying/naming a distortion pattern?

Image
foldback, and a high-pass filter at the end
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.freenode.net >>> #kvr
Kylotan
KVRist
 
34 posts since 11 Apr, 2009, from Nottingham, UK

Postby Kylotan; Fri Aug 04, 2017 12:18 am Re: Help identifying/naming a distortion pattern?

Hello all,

Thanks to your help and the ideas above, I managed to replicate the pattern in the initial post in an analytic form. The basic approach was:

1. amplify and DC offset/bias the signal, so it ranges from [-X, +1]
2. soft-clip the negative signal below some negative threshold to bring it back inside [-1, 1]
3. fold that area below the threshold back above the threshold.

I may need to add an extra high-pass to smooth off the corners of the fold as well, but we'll see.

Thanks!
Oden
KVRist
 
219 posts since 30 Oct, 2010

Postby Oden; Sun Aug 06, 2017 10:08 am Re: Help identifying/naming a distortion pattern?

Here is how I would solve this:

1. Feed a 1-unit impulse into the "black box".
2. Reverse the resulting impulse response on the output, or if this is not possible, set all the phases to zero (or whatever the input) and reverse the frequency content as best you can. (The assumption here is that there is an EQ after the shaper).
3. Plot X and Y to visualize the waveshaper function.
4. Estimate parameters of some suitable function / set them by hand to fit the curve. Or if you can't find the right function/parameters, use the result as a table.
Last edited by Oden on Sun Aug 06, 2017 10:25 am, edited 3 times in total.
Oden
KVRist
 
219 posts since 30 Oct, 2010

Postby Oden; Sun Aug 06, 2017 10:22 am Re: Help identifying/naming a distortion pattern?

dp.
Kylotan
KVRist
 
34 posts since 11 Apr, 2009, from Nottingham, UK

Postby Kylotan; Sun Apr 01, 2018 4:02 am Re: Help identifying/naming a distortion pattern?

Hello all, I'm working on this again after a delay of many months and I'm not happy with the solution I came up with. Mostly this is because I studied it a bit closer and the waveshape I want is a bit more complex than a simple foldback distortion.

I'm happy with the starting point of amplifying and biasing the signal - that part ppears to be correct. But looking at the waveform more closely, high signal levels seem to cancel out the foldback, and I can't work out how to replicate this shape.

Perhaps more importantly, it's clear that the waveform has an upwards slant on the distorted section. To me, this looks like the high-pass filter acting on a square wave as shown here - https://en.wikipedia.org/wiki/Distortio ... ic_signals - but I'm not sure how I would apply that here. Firstly, I'm starting with an arbitrary audio source (though obviously I test with a sine wave), and secondly the tones I'm modelling don't lose bottom end, they just gain harmonics from the distortion, so I'm pretty sure I don't just want a high pass filter.

Any suggestions, and/or C++/numpy code to get me on the right track?
You do not have the required permissions to view the files attached to this post.

Moderator: Moderators (Main)

Return to DSP and Plug-in Development