Online Sequencer Forums

Full Version: Crowd Sourced Distortion Curves
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi all. I'm working on adding a distortion filter to OS, but I'm having some trouble getting distortion curves that sound cool. So I need your help.

Distortion curves take sound input in the range -1 to 1, and map it to some output based on the curve:
[Image: unknown.png]

Some other examples of distortion curves I'm playing with:
[Image: unknown.png]



These curves are described by a list of numbers, eg [-1, 0.5, 0, 0.5, 1] would be a straight line (and so wouldn't do anything Tounge). The first number in the list controls where -1 is mapped to, the last number says where 1 is mapped to, and the middle number is where 0 is mapped to.

If you want to help invent some wave shaping curves, open a new OS tab, and before you do anything, run this code in the JS console (ctrl+shift+J to open the console). This code replaces the reverb effect, so you can test it by enabling reverb on an instrument. If you want to change the curve, don't rerun the whole chunk of JS, just the last line where the curve is defined. You can have an many or as few numbers in the list as you want. A good way of generating numbers for the curve is to use a Google Sheets.

Code:
audioSystem.convolver = audioSystem.audioContext.createWaveShaper();
audioSystem.convolver.oversample = '4x';
audioSystem.convolver.connect(audioSystem.destination);
audioSystem.convolver.curve = Float32Array.of(-1, -1, -1, 0, 1, 1, 1);

If you invent anything cool, post the list of numbers here, and tell me what it sounds like. Your curve might end up in OS Wink
how would i go about creating an array out of a graph in google sheets
i'm assuming you meant "eg [-1, -0.5, 0, 0.5, 1]" is a straight line, that first 0.5 being negative :}
Ooh this looks like a good idea! I also would look for asymmetrical or tube emulating distortion

I would check out Airwindows, who does a bunch of open source distprtions and other effects
(06-19-2021, 09:19 PM)Firebolt391d Wrote: [ -> ]i'm assuming you meant "eg [-1, -0.5, 0, 0.5, 1]" is a straight line, that first 0.5 being negative :}

Oh yeah  Upside_down
(06-19-2021, 07:51 PM)pseudoname Wrote: [ -> ]how would i go about creating an array out of a graph in google sheets

Google sheets is just to help design the curves. You can take a look at my spreadsheet for ideas. I basically just have one column that goes from -1 to 1 (I'm using 0.02 step size, but you can do whatever), and a second column that calculates the value based on whatever formula I want. I make a graph to make sure it looks right, then the second column becomes my array for the wave shaper.

https://docs.google.com/spreadsheets/d/1...sp=sharing

The main hassle of this approach is that when you copy the numbers from the second column, each number is on its own line. But you have to change it so it's all 1 line and has commas in between the numbers, so you can paste it in that code. I have a text editor that makes this easy. If you're having trouble with that bit I can probably write a bit of JS to do it.
Hey Liam, did you create these in Sheets or Excel?
I'm sure you know more about this than I do, but my understanding is that software distortion modules, at least the ones that emulate a real guitar amp or similar technology, usually use an impulse response file from the amp (just a sound recording of an impulse played through the amp), then do a convolution of the sound you want to distort with the impulse response, which maps the sound characteristics of the amp onto your sound. There are free-to-use IR files for all kinds of amps. Not sure if that's a way to accomplish this in OS though.

It also occurs to me that if OS can separate its sounds into frequency bands (which I assume it can, since EQ is possible) then if distortion can be applied selectively to only high frequencies, say, you could emulate an Exciter plugin, and that might also make a distortion effect more useful if you want to distort bass (since you often only want to distort the mid+higher frequencies of a bass sound to avoid sonic chaos).

I'll try to play around with some curves anyway if I can figure out how this stuff works.
(06-20-2021, 05:31 AM)The Institute Wrote: [ -> ]I'm sure you know more about this than I do, but my understanding is that software distortion modules, at least the ones that emulate a real guitar amp or similar technology, usually use an impulse response file from the amp (just a sound recording of an impulse played through the amp), then do a convolution of the sound you want to distort with the impulse response, which maps the sound characteristics of the amp onto your sound. There are free-to-use IR files for all kinds of amps. Not sure if that's a way to accomplish this in OS though.

It also occurs to me that if OS can separate its sounds into frequency bands (which I assume it can, since EQ is possible) then if distortion can be applied selectively to only high frequencies, say, you could emulate an Exciter plugin, and that might also make a distortion effect more useful if you want to distort bass (since you often only want to distort the mid+higher frequencies of a bass sound to avoid sonic chaos).

I'll try to play around with some curves anyway if I can figure out how this stuff works.


Amp simulations use a distortion for the head, and an IR for a cab. They DO use a distortion though. I am pretty sure this is a parallel distortion or something though

There is an open source guitar amp sim I been using called Guitarix that may be worth looking at the source code or something for
A samplerate reducer distortion maybe desireable, especially for 8bit style songs
Pages: 1 2