How do i create second harmonic distortion?

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
udok said:
Use Octave or Matlab:
This adds -46 dB 2nd order distortion:

x = wavread('input.wav');
y = x + 0.01*x.*x;
wavwrite(y, 48e3, 16, 'output.wav');
Only on a full-scale signal. As others have said, you cannot create a given level of 2nd on its own from an arbitrary signal. You basically have two choices:
1. use a quadratic term (as above) which gives you level-dependent 2nd and nothing else
2. use some version of half-wave rectification to generate a fixed proportion of 2nd together with fixed proportions of higher orders too.
 
Founder of XSA-Labs
Joined 2012
Paid Member
A simple circuit like what I use for a headphone amp makes nice circa 0.06% H2. It works with any SS low THD amp to give music some euphonic H2.

xrk971 Pocket Class A Headamp GB

591187d1483977924-bf862-based-se-class-headamp-heat-pocket-class-bf862-zvn5306-ha-v1-png


591189d1483977924-bf862-based-se-class-headamp-without-heat-pocket-class-bf862-zvn5306-ha-v1-fft-1khz.png


There is also a variant where you can adjust relative H2 and H3. In above circuit varying R4 changes relative H2 to certain extent by changing bias current.
 
Last edited:
Member
Joined 2011
Paid Member
The H2 generator PCBoards given out at Burning Amp 2018, and discussed in Nelson Pass's article on firstwatt.com, have about 1% H2 (-40 dB). The circuit simulation in #43 has about 0.01% H2 (-80 dB), which is not nearly enough to achieve Pass's objectives.

_
 

Attachments

  • np.png
    np.png
    126.3 KB · Views: 264
Only on a full-scale signal. As others have said, you cannot create a given level of 2nd on its own from an arbitrary signal. You basically have two choices:
1. use a quadratic term (as above) which gives you level-dependent 2nd and nothing else
2. use some version of half-wave rectification to generate a fixed proportion of 2nd together with fixed proportions of higher orders too.

It's not perfect and it rather complicates things, but you could make a compressor with (near-)infinite compression ratio and multiply the original signal with the sum of a constant and the compressed signal.
 
Yes, that would work for a constant signal. As soon as it varies (music varies!) you need to think about compression time constants.

People often talk about distortion as though it is just something added to the signal, like noise. It is not; it is something generated from the signal so it varies as the signal varies. How it varies depends on the type of distortion and how it is generated. Adding 0.5% 2nd to a music signal is not easy, yet people often ask for something like this.
 
Yes, that would work for a constant signal. As soon as it varies (music varies!) you need to think about compression time constants.

Indeed, that's why it is not perfect. The shorter the time constants, the better it follows the envelope of the signal, but the more higher-order distortion you get because the compressor itself will distort. You can use higher-order compressor loop filtering and/or dead zones to reduce that. But that's all pretty standard in compressor design.

Since the 2nd H is double the frequency ie one octave up couldn't you just run the signal through a side chain pitch shifter set to +1oct and then mix it back in with the original at any level you want?

Yes, that should work as well. How do these pitch shifters work? Are there any non-idealities?
 
Founder of XSA-Labs
Joined 2012
Paid Member
The H2 generator PCBoards given out at Burning Amp 2018, and discussed in Nelson Pass's article on firstwatt.com, have about 1% H2 (-40 dB). The circuit simulation in #43 has about 0.01% H2 (-80 dB), which is not nearly enough to achieve Pass's objectives.

_

In practice, with some tweaks to setpoints or because two 9v Li-ion batteries run closer to 15.5v, the H2 is closer to -60dB, which IMO, is the ideal value as -40dB is a bit too much for my taste. The -60dB is not something that gets in the way of the music, but simply makes it sound better, more “musical” and exciting.

609163d1491148224-xrk971-pocket-class-headamp-gb-nhb2-fft.png
 
Yes, that should work as well. How do these pitch shifters work? Are there any non-idealities?

I was thinking digitally there wouldn't/shouldn't be too many irregularities.
Might even be possible in audacity which I think was mentioned earlier.

Octave guitar pedals do it as well and are analogue but I have no real idea of how they work beyond the wiki page where it says they use a full wave rectifier and diodes.

The idea was that this way you get nothing but 2nd harmonic and you can dial in how much.
 
With a full-wave rectifier you get all even harmonics, not just the second.

A digital version probably does a running DFT, doubles all frequencies and transforms it back. The trick is to get the results of the inverse DFTs to combine into one smooth waveform without weird echoes.

At least GoldWave has a pitch shifter that works like that. I haven't used it for a couple of years, but if I remember well, you always have to experiment with the DFT size and overlap until you get the best sound.
 
I have harmonizer with adjustable harmonics. Works great.
While adjusting bias, harmonics spectrum change. I have a hifi version( rca) and a pro version(XLR).
 

Attachments

  • IMG_1744.PNG
    IMG_1744.PNG
    747.8 KB · Views: 314
  • IMG_1745.JPG
    IMG_1745.JPG
    454 KB · Views: 275
  • IMG_1746.JPG
    IMG_1746.JPG
    440.3 KB · Views: 291
  • IMG_1747.JPG
    IMG_1747.JPG
    218.5 KB · Views: 339
Last edited:
  • Like
Reactions: 1 users
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.