Effects processor/instrument/sampler looper thing
yop,
I made a distortion (and an overdrive) two years ago, if interested. Here is the topic I opened at the time : http://puredata.hurleur.com/sujet-5775-better-sounding-guitar-distortion-beyond-clip-tanh
It follows an D.T.Yeh and Al.article that exposes two algorithms for emultating the Boss DS-1 and Ibanez TubeScreamer. I did my best to stick at the models, but I can't certify it is 100% the same. It could be interesting to make a real life test to compare a real DS-1 and the patch, but I were too lazy to do it
Here are the files, I named the DS-1 virtual clone "Akuf-een" but it entirely relies on DS1 model as its "guts" immediately show. Main patch is DistOdrive.pd : http://www.sendspace.com/file/phvsjt
Nau
Better sounding guitar distortion ... beyond \[clip~\] and \[tanh~\]
Trash has been around for several years. I doubt BT had much to do with it. Anyway, the only part of that link that says anything about "non-standard" distortion is the multi-band distortion part. That could be done with just band-pass filtering different frequencies into different types of distortion.
Better sounding guitar distortion ... beyond \[clip~\] and \[tanh~\]
I fairly often use some distortion like [tanh~] with a slow random offset signal added to the audio, for continuously varying distortion effects. I follow this with a [hip~] to avoid DC or very low frequency output (choosing the cutoff frequency based on the characteristics of the audio and random signals). You can even use it as a sort of distorting amplitude control, as a small signal added to a large offset will be effectively muted (like the cut-off region of a bipolar transistor). This was sometimes used in analog drum machines to gate white noise, for example (swing VCA).
Better sounding guitar distortion ... beyond \[clip~\] and \[tanh~\]
Hi there,
thank you for your feedback !
@mod said:
wow, nice to finally see this!
why are highs contrary to what you'd expect? at a low sample rate, the highs are folded back into low frequencies, but when you upsample, the highs are preserved as true highs. i think it works just how it should. The upsampled version is certainly much clearer and brighter to my ears. Particularly with a high distortion level.
That makes sense. The upsampling workaround officially wins (I'll try x16)! I think I focus too much on highs, as I tend to find this disto patch rather 'acid'; the original sample sounds much darker than the distorted sound. I don't owe the actual pedal so I only rely on my 'feeling', which is far from reliable Of course it's logical to add highs with such a nonlinearity, and lows are filtered several times.
Anyway I still find the heavily distorted sounds have a strong 'schh schh schh component' in the highs, and I can't remember having heard that as strong in actual analogic effects. Would you agree with that? Of course I know this is a rather basic 'physically-informed' design, and that analog will always sound better
@mod said:
actually, this patch really demonstrates the effect of aliasing. if you turn the tone knob down as far as it will go, and also turn the distortion down to zero, and turn aliasing off, you can clearly hear the rustling noise caused caused by those wrapping frequencies.
turn aliasing back on again, and the noise is gone.
Very strange, when I do what you say, the upsampled version sounds like the 'not upsampled one', with a 'sch sch' noise added !
@Maelstorm said:
@nau said:
The BJT gains are bound to my 'signal amplitude policy' : input file or audio source and output should never clip. These gains can be seen as follows : the first one (before the clipper) adjust 'how early' distortion occurs, and the second one gives the distorted signal a boost in order to give similar subjective level than dry signal.
The values were found empirically.This might be where I have the biggest issue, though the article doesn't make it so clear, either. [...] the DS-1 isn't a baby's distortion pedal.
[...] Also, you don't need to calculate the boost into the filter coefficients. That's only useful for plotting. You can just use [*~] before or after the filter do accomplish it.
I understand all these arguments. I'll modify the patch. At the beginning I was using this kind of reasoning, but as the 'nominal input level' is -20dbu (http://www.bossus.com/gear/productdetails.php?ProductId=127&ParentId=254#), and the dbu definition I found seemed difficult to bind to 'our' db, I just dared to make the basic (36db-20db=16db~6.3 times in amplitude) operation... not far from the 6 in my patch Not very scientific, though.
Anyway I understood another reason why my 'subjective hearing' failed: feedind my patch with a 0db normalised sample maximizes input level, and the result will always be 'over the top' compared to non-active guitar pickups with a volume knob not always pushed to max. In other words, if I look at demos on youtube the result heard will be less distorted than my patch's. Anyway this can always be seen as an additional parameter for a 'parametric DS1 deluxe edition patch'
@Maelstorm said:
As mod said, it's not so much more highs as less lows, and those lows are a result of aliasing. To my ears, the upsampled version sounds less muddy. (By the way, in your upsampled portion, you have a different argument for the second [DS1-bjt_stage~]. Making them equal makes the difference even less noticeable, and draws more attention to the mud than the highs.)
Ok, upsampling wins !
@Maelstorm said:
Yes, there is a difference, but it's not a Matlab thing. It's the choice of the logarithmic scaling in the x-axis. The article uses powers-of-ten as equal distances. Mine uses [mtof] for the scaling, so that a semitone, octave, or whatever musical interval is the same distance. Also, I made an adjustment so that everything between 0 and about 20 Hz (at 44.1k) gets squashed in the leftmost 10% of the graph. If I didn't to that, then about half the plot would be taken up with frequencies below the audible range.
Ok, perfect ! Everything's cool now.
@Maelstorm said:
(commenting peaking after ToneStage)
This has nothing to do with your tone stage. It's because of the passband ripple in the Chebychev filters. The IEM Chebychev filters have a 1 dB ripple, though I don't actually know if that means +/- 1 dB or +/- .5 dB. Either way, it's creating a boost at some frequencies, and pushing the output down by 1 dB should keep it below [-1, 1]. This could also be contributing to the highs, as the ripple is typically more pronounced near the cutoff frequency.
Mmh, I thought the same, but then I decided to check the plots taken out of the 'not upsampling' part, and the peaking is still there ! The Chebyshev filters can be the source, then ...
@Maelstorm said:
The output from [tanh~] will never clip, so as long as you make up for the ripple and don't boost the second BJT stage, you should be fine.
[...]
Just one more thing to add for now, and that is you're doing too much in the upsampled portion. The only thing that needs to be in there is the non-linear function ([tanh~]) and the anti-aliasing filters. Everything else is linear and doesn't benefit from upsampling, so it's just creating more computational load.
Of course I precisely want to get rid of this peaking to be able to fully rely on [tanh~] to 'master' my output gain. I'll try the FIR instead of cheby (as proposed by acreil) some day. (I don't even know yet how they work and how I'll have to implement it).
I left the 'full upsampled chain' in this patch only to see if someone would have commented it, and we totally agree. But this 'playing the noob' attitude of mine is a rather raw 'fishing method' for getting stimulating information ... sorry this lead you to lay down the whole picture BUT nothing wasted, as your final 'delicate' -1db cut surprises me and I'll use it (when I'll get rid of peaking) and moreover, as you are reminding me that you use a 18000 cutoff freq, I'll give a look again at it, just trying to find a good criterion to pick one
Thank you everybody,
See you,
Nau
P.S. : sorry for those very long sentences ... not very clear
Better sounding guitar distortion ... beyond \[clip~\] and \[tanh~\]
Also quite glad to see this! This has become one of my favorite threads of the forum. It covers a lot of ground, and it's great to see your hard work and perseverance payoff here. Cheers too you, nau!
@nau said:
The BJT gains are bound to my 'signal amplitude policy' : input file or audio source and output should never clip. These gains can be seen as follows : the first one (before the clipper) adjust 'how early' distortion occurs, and the second one gives the distorted signal a boost in order to give similar subjective level than dry signal.
The values were found empirically.
This might be where I have the biggest issue, though the article doesn't make it so clear, either. In the article, it shows the frequency response of the BJT stage as having about a 36 dB boost in the pass band. That amounts to multiplying the signal by about 63. And, if you want to get really technical, the waveshaper in the article clips at +/- .6, so you'd have to add about another 4.5 dB to make up for that. You're using much lower values. This is what I was talking about earlier when I said you should really crank the input to [tanh~] to get some serious distortion, and the DS-1 isn't a baby's distortion pedal.
Now, the article also says that the second BJT stage is really to boost the signal back up for the subsequent load. Since we're not sending this into other circuits here, I think the dB boost of the second BJT should be ignored. Also, you don't need to calculate the boost into the filter coefficients. That's only useful for plotting. You can just use [*~] before or after the filter do accomplish it.
So basically what I'm saying is, there should be a boost of about 40 dB ([*~ 100]) as part of the first BJT stage, and no boost for the last one. Then you can really break some teeth with this distortion.
- when switching between upsampled or not upsampled processing, the difference is barely noticeable (maybe the upsampled one has more highs, but that is the exact contrary of what I would expect). Does someone see what I am doing wrong, if this is the cause of this perceptual draw ?
As mod said, it's not so much more highs as less lows, and those lows are a result of aliasing. To my ears, the upsampled version sounds less muddy. (By the way, in your upsampled portion, you have a different argument for the second [DS1-bjt_stage~]. Making them equal makes the difference even less noticeable, and draws more attention to the mud than the highs.)
- the transfer curves can be seen in the patches, but are always slightly different than the one showed in the article. But I have been very careful when calculating coefficients and I don't really think they are wrong. Would there persist a difference between [filterplot.mmb] and traditional Matlab-like graphs ?
Yes, there is a difference, but it's not a Matlab thing. It's the choice of the logarithmic scaling in the x-axis. The article uses powers-of-ten as equal distances. Mine uses [mtof] for the scaling, so that a semitone, octave, or whatever musical interval is the same distance. Also, I made an adjustment so that everything between 0 and about 20 Hz (at 44.1k) gets squashed in the leftmost 10% of the graph. If I didn't to that, then about half the plot would be taken up with frequencies below the audible range.
- The DS1-tone_stage helpfile has been written by Maelstorm, and the response curve shows no gain value above 0db. Nevertheless the tone knob, when pushed, can lead to signal amplitude beyond [-1 1]... I can't figure out how a signal can have all its discretised frequencies pulled down and still exhibit peaking. Should I read more about the subject (is there a name for this symptom ?), or is there an error in my patch ?
This has nothing to do with your tone stage. It's because of the passband ripple in the Chebychev filters. The IEM Chebychev filters have a 1 dB ripple, though I don't actually know if that means +/- 1 dB or +/- .5 dB. Either way, it's creating a boost at some frequencies, and pushing the output down by 1 dB should keep it below [-1, 1]. This could also be contributing to the highs, as the ripple is typically more pronounced near the cutoff frequency.
- is my 'signal policy' perfectible ? I want the output signal never to clip, so I multiply the output by 0.4 in such a way that when Tone and Dist are full right but Level is medium the signal never clips.
The output from [tanh~] will never clip, so as long as you make up for the ripple and don't boost the second BJT stage, you should be fine.
Just one more thing to add for now, and that is you're doing too much in the upsampled portion. The only thing that needs to be in there is the non-linear function ([tanh~]) and the anti-aliasing filters. Everything else is linear and doesn't benefit from upsampling, so it's just creating more computational load. So it should look more like this:
[*~ 100]
|
[DS1-bjt_stage~ 1]
|
[DS1-opamp_gain~]
|
[*~ 8]
|
[pd upsample]
|
[DS1-tone_stage~]
|
[DS1-bjt_stage~ 1]
|
[*~ .891] <-- 1 dB cut
And [pd upsample] should look like this:
[inlet~]
|
[lp10_cheb~ 18000] [block~ 64 1 8]
|
[tanh~]
|
[lp10_cheb~ 18000]
|
[outlet~]
Okay, that turned out to be more words than I expected. But we're getting into DETAILS here! Again, nice work, nau.
Better sounding guitar distortion ... beyond \[clip~\] and \[tanh~\]
Hi there,
here it is... a handy workbench to emulate a distorsion pedal following the article https://ccrma.stanford.edu/~dtyeh/papers/yeh07_dafx_distortion.pdf and Maelstorm's best support and advices.
A free of rights soundfile is joined, in such a way that if we want to interact everyone has the same workbench basis.
The file to be opened is DS1-workbench.pd. Some abstractions (several made by Maelstorm) are joined. It should work on extended.
Link : http://www.sendspace.com/file/2stec8
The BJT gains are bound to my 'signal amplitude policy' : input file or audio source and output should never clip. These gains can be seen as follows : the first one (before the clipper) adjust 'how early' distortion occurs, and the second one gives the distorted signal a boost in order to give similar subjective level than dry signal.
The values were found empirically.
I have several interrogations:
-
when switching between upsampled or not upsampled processing, the difference is barely noticeable (maybe the upsampled one has more highs, but that is the exact contrary of what I would expect). Does someone see what I am doing wrong, if this is the cause of this perceptual draw ?
-
the transfer curves can be seen in the patches, but are always slightly different than the one showed in the article. But I have been very careful when calculating coefficients and I don't really think they are wrong. Would there persist a difference between [filterplot.mmb] and traditional Matlab-like graphs ?
-
The DS1-tone_stage helpfile has been written by Maelstorm, and the response curve shows no gain value above 0db. Nevertheless the tone knob, when pushed, can lead to signal amplitude beyond [-1 1]... I can't figure out how a signal can have all its discretised frequencies pulled down and still exhibit peaking. Should I read more about the subject (is there a name for this symptom ?), or is there an error in my patch ?
-
is my 'signal policy' perfectible ? I want the output signal never to clip, so I multiply the output by 0.4 in such a way that when Tone and Dist are full right but Level is medium the signal never clips. Pushing further Level will cause 'unwanted output distortion'. Of course I'm thinking about modifying this final output gain in such a way that it is bound to Level or anything else. This is away from the original circuit, but is legitimated by numerical audio considerations.
Thank you,
Nau
Better sounding guitar distortion ... beyond \[clip~\] and \[tanh~\]
I personally find [tanh~] to be very reasonable for distortion. Many of the papers I've read on emulating distortion pedals show that the waveshaping curve is quite similar to tanh, enough that they use it in their models. You do have to seriously crank the signal going in, though. Even boosting it 30 dB gives a pretty light distortion. Crank it!
Also, distortion is highly nonlinear, meaning it will produce many more partials than what is already present in the signal. These partials will alias, which can alter the sound of the distortion in a way that you might not want. So it's a good idea to have the distortion in an upsampled patch. Filter the input at below the parent's Nyquist frequency (because upsampling causes the spectrum to repeat), apply the distortion, and filter again before the output to minimize aliasing. I should also mention that upsampling causes the energy of the original signal to be spread out, and the filter will get rid of most of it. So you will need to make up for the lost energy by multiplying the input by the upsampling factor.
I highly recommend this paper:
https://ccrma.stanford.edu/~dtyeh/papers/yeh07_dafx_distortion.pdf
It dissects and explains models for the Boss DS-1 and Ibanez Tube Screamer. Even if you don't understand all the math (I don't), there are some nice block diagrams to ease the pain. I've made an emulation of the DS-1 in Pd based on this paper (though I need to clean it up as it's doing more work in the upsampled part than it needs to), and it sounds pretty close to the Distortion unit in Guitar Rig, which has the same parameters. There's also a unit in Guitar Rig called Screamer, also with the same controls. I'm interested in how similar that turns out to be, too.
Better sounding guitar distortion ... beyond \[clip~\] and \[tanh~\]
Hi there,
I am trying to reasonably emulate a bitcrushing/downsampling/waveshaping guitar pedal. After having put together those three functions, I realised (looking at videos on the net - I don't actually owe the pedal) that when bit depth/samplerate are set to maximum (best sound 'quality') and a 'unitary' wavetable is used (doesn't modify anything in the sound), the actual pedal still provides a broad "distortion/fuzz" sound. (of course the video provides clean and effected sound, ensuring comprehension)
As the sound I actually get with my patch is deceiving yet logical, I came to the conclusion that the clipping stage has to be 'upgraded'. I replaced the previous [clip~ -1 1] with a [tanh~], and I found it interesting but still far from satisfactory.
Googling about analog fuzz/distortion/overdrive gave some hints, but I'm still far from being able to put together a 'simplified physical model' of such a fuzz/distortion.
So I will try to start with a good transistor electronics book, to see what is the difference between germanium and silicium devices, and see if I could use some caracteristic curves to build a [diode~] and a [transitor_amplifier~] objects.
Any help appreciated !
Thanks,
Nau
Yet another distortion/overdrive patch
Hi, I made a distortion/overdrive patch. I've included the "cubic-soft-clip" (http://puredata.hurleur.com/sujet-2453-cubic-soft-clip-distortion) in my patch. The distortion patch is called od-dist2. I'm quite new to Pd, so I appreciate all kinds of feedback:)
Noisy sound output + midi tech issues
@toxonic said:
if you get a distorted sound also when you don't use the adc~ audio in (for example an osc~ object has a distorted sound too), i think that's not a problem of the latency. what kind of soundchip is used? do these problems occur in other audio software too?
the path you found on youtube: i guess this is a patch of diplipito here in the forum. if i am right, he posted it here:
http://puredata.hurleur.com/sujet-2990-drum-bass-machine
I use FL Studio v4, Mu-Lab & a lot of plugins & other soft synthesizer apps & I never had any problems... On YouTube I didn't use any patche, I just followed the turorial... I have a distorted sounds on some patches & others are fine, I guess that must be a object or module that is causing the problem?