HardwareHeaven.com

HardwareHeaven.com

Looking for the skin chooser?
 
 
  • Home

  • Hardware reviews

  • Articles

  • News

  • Tools

  • Gaming at HardwareHeaven

  • Forums

 

Go Back   HardwareHeaven.com > Forums > Hardware and Related Topics > kX Project Audio Driver Support Forum > Effects and the DSP


Reply
 
Thread Tools
Old Jun 7, 2006, 03:22 PM   #1
kX user
 
Join Date: Apr 2004
Posts: 851
Rep Power: 0
Tiger M is on a distinguished road

waveshaper - for tube overdrive or whatever...

Here's some code of a waveshaper which is good for tube distortion. It's a one dimensional Bezier curve, which is basicaly a polynomial with it's parameters calculated in a special way to form the curve. Notice the extensive use of the accumulator in the code - this way you can calculate any type of polynomials which exceed the -1 1 range.

There are tons of variations based on higher order polynomials - for instance you could use a Hermite curve, splines etc.

If anyone is interested in developing a complete tube plugin feel free to use the code.

For the non-coders: this is only an overdrive unit, so it will not sound like a tube amp without filters.

Code:
; Generated by kX DSP Editor - microcode dump
name "WSHP";
copyright "Copyright Tiger M (c) 2004.";
; NOTE The present DSP microcode dump is protected by the 
; license agreement bundled with the appropriate software 
; package containing this microcode,
; regardless the particular copyright notice is present in the dump.

engine "kX";
created "05/25/2005";
guid "0290826f-c5ea-4af6-9f3f-f94921dc49a5";
; Registers
	input in;
	output out;
	control p0=0x0, p1=0x7fffffff, p2=0x7fffffff;
	control p3=0x7fffffff
	temp tmp, tmp2, tmp3;
	temp tmp_in

; Code
	 macints 	 tmp_in,  0x0,  in,  0x4;
	 tstneg 	 tmp,  tmp_in,  tmp_in,  0x0;
	 macs 	 tmp2,  0x0,  tmp,  tmp;
	 macs 	 tmp3,  0x0,  tmp2,  tmp;
	 macs 	 0x0,  0x0,  p1,  tmp3;
	 macsn 	 0x0,  accum,  p2,  tmp3;
	 macs 	 0x0,  accum,  p2,  tmp2;
	 macsn 	 0x0,  accum,  p1,  tmp2;
	 macsn 	 0x0,  accum,  p1,  tmp2;
	 macs 	 0x0,  accum,  p0,  tmp2;
	 macs 	 0x0,  accum,  p1,  tmp;
	 ;
	 macsn 	 tmp,  accum,  p0,  tmp;
	 macs 	 0x0,  accum,  tmp,  0x7fffffff;
	 macs 	 0x0,  accum,  tmp,  0x7fffffff;
	 macs 	 0x0,  accum,  p3,  tmp3;
	 macsn 	 tmp,  accum,  p0,  tmp3;
	 macs 	 tmp,  tmp,  p0,  0x7fffffff;
	 limitn 	 tmp_in,  0x0,  tmp,  tmp_in;
	 macsn 	 tmp,  0x0,  0x7fffffff,  tmp;
	 limit 	 tmp,  0x0,  tmp,  tmp_in;
	 macs 	 out,  0x0,  tmp,  0x20000000;

end
Tiger M is offline   Reply With Quote


Old Jun 7, 2006, 06:34 PM   #2
Alternative Audioproductions
 
TravelRec.'s Avatar
 
Join Date: Sep 2003
Location: Germany / Sachsen-Anhalt
Posts: 1,710
Rep Power: 0
TravelRec. will become famous soon enoughTravelRec. will become famous soon enough

Hi Tiger!

Thank you for sharing.

Best regards
TravelRec.
__________________
Always take a look behind.

TravelRec. is offline   Reply With Quote
Old Jun 8, 2006, 12:23 PM   #3
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

Quote:
Originally Posted by TravelRec.
Hi Tiger!

Thank you for sharing.

Ditto
I will have to check it out a little later (to early now ), and see what it does.
Russ is offline   Reply With Quote
Old Jun 11, 2006, 04:26 PM   #4
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

Tiger, it sounds nice. You can get a really hot distortion (good for screaming artificial harmonics, etc), but I am still playing around with it, trying to find the best way to filter it, as it does produce a lot of noise. A noise gate works good to eliminate the noise when not playing, but there is still a little unwanted noise when playing, and it is hard to eliminate that without killing the sound. Any tips? (BTW: Is it this noisy for you (with p0 around 10% to 20%)? i.e. I want to be sure there are no strange 10k1 microcode issues coming into play here).
Russ is offline   Reply With Quote
Old Jun 11, 2006, 05:28 PM Threadstarter Thread Starter   #5
kX user
 
Join Date: Apr 2004
Posts: 851
Rep Power: 0
Tiger M is on a distinguished road

I suggest you test the shape with a saw wave (from Wave Generator) set to 0dB and 1Hz and record to see how it looks in reality (take note that Wave Gen produces a decreasing saw and the function curve will actually be inverted) . P0 does something very interesting - imagine if you have a sample at 0 and it will lift it the amout you set it straight up. If you set it to 1 you practically get a square wave out of any signal, so if you want a tube sound forget about p0.

Btw recently I experimented again and found an ideal function for tube overdrive, which is many times better than this thing and sounds so real, I can't describe it...
That's why I posted this code - just for future reference and to show how you can do polynomials, which could clip in the middle stages, but it's also interesting for waveshaping... but rather obsolete.

Again, test to actually see the curve of the function you created with tweaking the parameters and then you'll understand what's actually happening.

I'll release the new plugin in the near future, since it should definitely be tried by all guitar fans using kX.
Tiger M is offline   Reply With Quote
Old Jun 11, 2006, 05:31 PM Threadstarter Thread Starter   #6
kX user
 
Join Date: Apr 2004
Posts: 851
Rep Power: 0
Tiger M is on a distinguished road

I forgot to mention that to get tube distortion you should overdrive the default shape
Tiger M is offline   Reply With Quote
Old Jun 11, 2006, 05:51 PM   #7
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

Yeah, I did play around with it using the wavegen (although using a sine wav), and watched the output on a soft-scope and got the basic idea of what the parameters were doing. Without using p0, you do get a nice sound, like maybe some presence added to the signal (mostly from p1), but not really overdrive (and I did not know that you meant we should overdrive the default shape at the time). I also tried removing the last 3 instructions of code, such that it does not restore the sign, and you can get a kind of tube distortion overdrive sound that way, which isn't bad, but I actually like the sound produced with p0 (although only with real electric guitar.. it sounds terrible with midi).

What method do you suggest to overdrive the default shape? I assume you mean using another plugin on the output? I actually did connect it together with the tubedrive (tried on the input side and output), and did get some interestng results, but again, it seemed more like it was adding a kind a presence to the tubedrive, more than anything else (without using p0).

Your new plugin sounds great. Glad to hear that you are going to release it. I look forward to trying it out
Russ is offline   Reply With Quote
Old Jun 11, 2006, 06:03 PM Threadstarter Thread Starter   #8
kX user
 
Join Date: Apr 2004
Posts: 851
Rep Power: 0
Tiger M is on a distinguished road

You should overdrive it with a gain plugin (Gain HQ for more gain) on the input. Overdrive it and check the shape again - you'll see that the curve is retained. The more you overdrive it the closer you get to hard clipping - exactly what happens with real tube overdrive.

I see that you've figured out another interesting point in the code - the sign. You see, if you check the function on some function plot prog you'll see that the negative side is something we really want to avoid. Actually most good curves you could get with fixed point math without having real division at hand are good at one side only, so first we get the absolute value of the signal, shape it and then invert to negative again.
Tiger M is offline   Reply With Quote
Old Jun 11, 2006, 06:11 PM   #9
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

I see, thanks for the tips
I will play around with it some more, this time overdriving the input, and see what type of sounds I can get.
Russ is offline   Reply With Quote
Old Jun 11, 2006, 06:31 PM   #10
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

lol, so that is how it is supposed to work. Pretty cool idea using the bezier curve. I could picture it as part of EFX Tubedrive 2 or something, with a graph showing the shape (based on the settings), etc. Makes me wonder about what you are doing with your new plugin.
Russ is offline   Reply With Quote
Old Jun 13, 2006, 05:47 PM   #11
DriverHeaven Senior Member
 
ROBSCIX's Avatar
 
Join Date: Mar 2004
Posts: 1,732
Rep Power: 0
ROBSCIX is on a distinguished road

Tiger is this the type of thing you used with that distortion and waceshaper you showed a few of us a while ago? I can't remeber the name of it. The plugin shows a curve and you said it makes the strings feel like butter!! any plans on posting that effect? So Tiger already has a effect showing the curve shape and such, then there was a bunch on knobs for driver etc. You posted some audio sample and it sounded very nice..
ROBSCIX is offline   Reply With Quote
Old Jun 13, 2006, 06:10 PM Threadstarter Thread Starter   #12
kX user
 
Join Date: Apr 2004
Posts: 851
Rep Power: 0
Tiger M is on a distinguished road

That was a while ago, but yes it uses the algoritm posted above but with a few more tricks and if I decide to include a curve in the new plugin it will be a similar curve
Tiger M is offline   Reply With Quote
Old Jun 13, 2006, 07:08 PM   #13
DriverHeaven Senior Member
 
ROBSCIX's Avatar
 
Join Date: Mar 2004
Posts: 1,732
Rep Power: 0
ROBSCIX is on a distinguished road

So does that mean your considering releasing that plugin? -or a refined version of it? I am a guitarist so I love when new guitar oriented plugins come out..any plans for that?
ROBSCIX is offline   Reply With Quote
Old Jun 13, 2006, 07:22 PM   #14
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

@ROBSCIX,
Maybe you missed this part of his post above?

Quote:
Originally Posted by Tiger M
Btw recently I experimented again and found an ideal function for tube overdrive, which is many times better than this thing and sounds so real, I can't describe it...

I'll release the new plugin in the near future, since it should definitely be tried by all guitar fans using kX.
Russ is offline   Reply With Quote
Old Jun 13, 2006, 07:32 PM   #15
DriverHeaven Senior Member
 
ROBSCIX's Avatar
 
Join Date: Mar 2004
Posts: 1,732
Rep Power: 0
ROBSCIX is on a distinguished road

NO,NO WHat I mean is in relation to that specific plugin. Kinda confusing..anyway I can't wait and will be glad to test it out thx for your efforts tiger..
ROBSCIX is offline   Reply With Quote
Old Jun 13, 2006, 08:23 PM Threadstarter Thread Starter   #16
kX user
 
Join Date: Apr 2004
Posts: 851
Rep Power: 0
Tiger M is on a distinguished road

ROBSCIX, now I remember that what you wanted back then was a heavy sound, right?

When soft clipping is pushed to the limits it becomes practically hard clipping, so you can get heavy distortion with hard clipping. The thing you must do to get a 'real' sound is mimic the frequency response of a big guitar cabinet by proper filtering. A bit of experimentation might get you there. My tips:

before clipping
+cut below 300Hz

after clipping
+boost 100-300Hz with 10 band EQ
+reduce mids with 10 band EQ
+boost a bit the highs with 10 band EQ
+cut over 6000-8000Hz with two phat EQs both set at the same frequency and q

Everything else is up to your taste.
Tiger M is offline   Reply With Quote
Old Jun 13, 2006, 09:05 PM   #17
DriverHeaven Senior Member
 
ROBSCIX's Avatar
 
Join Date: Mar 2004
Posts: 1,732
Rep Power: 0
ROBSCIX is on a distinguished road

That's why I was so interested in your guitar suita Plugin. I am gonna play around tonight with your code and see what I can come with. What I was after would be similar towell yeah a hard saturayed distortion similar to the metal zone or the DOD death meatl, where the sound is drenched in harmonics and very easy to play..like you said string made of butter..lol I will be messing around later and see what I come up with..thx for your help and info
ROBSCIX is offline   Reply With Quote
Old Jun 14, 2006, 04:17 PM   #18
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

It might be good to add the gain stage to the plugin, so that the GainHQ is not needed (for anyone that wants to use the code as a semi stand-alone distortion/overdrive plugin).

i.e.
add the following control:
control drive=0x0;
change first line to:
interp tmp, 0x4, drive, 0x3ec;
macints tmp_in, 0x0, in, tmp;
(and as Tiger indictated, p0 is not all that useful here, so you may want to change p0 from a control, to a constant register (const) with a value of 0.).

Last edited by Russ; Jun 14, 2006 at 04:25 PM.
Russ is offline   Reply With Quote
Reply

Thread Tools