[ADC17] Fifty Shades of Distortion (extra files + homework part 1)

Hello everybody !

As I promised during my talk, that you can see on Youtube again (or for the first time), I’m going to share some extra contents in the JUCE forum here ! So, you can download all the code samples, and a fully working JUCE plug-in doing static waveshaping + filtering here : http://www.dropbox.com/s/cjq4t08u6pqkaas/ADC17FiftyShadesDistortion.zip?dl=0

The plug-in is here to allow you to experiment with the idea of several blocks containing a waveshaper and two filters before and after, so don’t hesitate to cascade several of them within a DAW environment, to see what happens. And you’ll be able to tweak it as you wish to include other kinds of distortion algorithms inspired by the other code samples and all the stuff I talked about during my talk.

I recommend that you do all your prototyping and experimentation using the DAW Cockos Reaper, which is my opinion the best one for audio developers since it is one the most stable and probably the fastest to load when you click on the executable ! Moreover, you should create a “plug-in test” project inside, with different audio files being loaded there such as dry guitar recordings, drum loops, bass guitar sounds, some singing voice samples, and maybe a MIDI clip playing a few notes to be trigged by any optional virtual instrument. And in Reaper, you can send all the outputs of these tracks to a new one, which will be the only one where you should put the plug-ins that are in test, with the “master send” of all these tracks being disabled. This way you can have the window where you need to put your plug-in opened at project start-up, and you can choose the audio source for the testing by soloing it or muting the other ones.

By the way, I didn’t have the time to say my conclusion during the talk :slight_smile: I just wanted to say that it’s quite interesting to compare all the distortion audio effects methods, and to display how they work with processing block schemes. This way, it will be possible to improve algorithms designed from the digital world, by adding them extra “warmth”, and to make algorithms designed from the analog world more interesting and less the “copy and paste” of an analog electronic circuit into code without caring about what makes it great and how it could be even better.

Now, I did say that I had two DSP exercises to give you after you have seen the talk, so you can better understand all the basics of the talk and experiment on everything on your own. I will provide some information about them, and the solutions later, with the PDF file I used to compile all the information for my talk preparation. I recommend also that you have a look for the talk about nonlinear oscillators from the day before since it gives some useful definitions, and that you do the same with the links in the bibliography :

I’ll start with exercise 1, and you give the second one later.

Exercise 1 : create a static waveshaper with a customizable shape.

I want you to create a static waveshaper, basically a function which could take as arguments some extra information related with its shape, in order to be able to automate it in a given distortion audio effect algorithm. To do so, here is a list of guidelines :

  • You’ll probably want a sigmoid like shape knowing the application of this, so you might want your function to return zero if the input is zero, and you might want it to be continuous
  • It can be bounded whatever the input or not
  • The extra controls might help you control the slope of the function when the output is very high or close to zero (in this case it is easy to do so with just the drive control)
  • It might be branch-less or not
  • It can be a single function with a few arguments, or functions of functions, or anything related with the branches
  • It can be made using polynomials, with one polynomial for each part of the branch algorithm, or fractions of polynomials
  • You can use Bezier curves to set the different sections of the waveshaper shape
  • You can use a look-up table, and play with its content. For example, you could put a hard clipper inside, and filter the shape with a simple low-pass IIR filter to smoothen the shape of the filter
  • And you should definitely use MATLAB / Octave or the website MadTeaLab to experiment with different curves and see what happens (see this link for example).
  • See what happens with the parametric waveshapers on music-dsp with MadTeaLab as well

So tell me your remarks, your questions about that research. You should really try to create your own, don’t simply copy and paste the code from someone else ! And then, you will be able to play with the modulation idea, do what I suggested in the dynamics processors part of my talk with your new waveshaper !

The exercise 2 got its own topic :


Thank you for the great talk Ivan! :+1: It was one of my favourites.


Hi Ivan, the talk was super interesting!
What is the license of the code samples you provide for download ?

Well, you can use them for whatever you want if you don’t say you did them, and if you let all the comments inside so we can see who is the author :wink:

1 Like