Adding even harmonics to a stereo signal

Hi my project consists of adding 2nd order harmonics to a stereo signal to achieve a more tube like sound.
I would like to use two RCA inputs and two RCA outputs for the signals and a DSP that has enough memory and calc. power to allow me more complex operations.
I am planning to use SigmaStudio from Analog Devices as a graphical platform.

My questions:
  • has anybody experience, suggestions which operations (in SigmaStudio) would likely achieve desired result of a more tube like sound ?
  • I am thinking of finding a proper board based on the ADAU1466/1467 to have more memory available, has anybody a suggestion where to get a less expensive board inluding of the programmer and the RCA adapter ? AliExpress is pretty confusing, I would like to find someone who actually has experience.

Thanks
Bjoern, Singapore
 
Would you think that measuring the fundamental frequency of the music at a given time-frame and then adding a sine-wave with a lower amplitude and double frequency could sound decent ?
Did you look at the second-order polynomial I linked? That's what filters adding H2 to general music use. If you have a fixed-frequencies signal, you can add the artificially generated sine/sines, but that is suitable mostly for measurement purposes only.
 
I would like to use two RCA inputs and two RCA outputs for the signals and a DSP that has enough memory and calc. power to allow me more complex operations.
Be careful with that approach for music, as both A/D and D/A converters - that which gets the signal into and out of the DSP - has to be of better quality than "usual". Of course you're aware of all the thrash in Audio around this DAC, that DAC and the never ending race toward perfection in conversion back to a set of RCA outs.

Keeping within the analog domain eliminates that, with trade off for other "problems".

One example would be the so-called 2nd harmonic generator which is simply two triode stages strapped together. I know that an analog multiplier can square an input, such that you get twice the frequency out - for a sine wave input - which I assume one could mix to a level back with the original signal. Would that work for music? Dont know.

One would think the manufacturers of these high end DACs would realize some customers actually want a little THD of a specific kind and engineer that into their product as an option. I.E. you can have the perfectly linear transfer function, where the voltage out is exactly proportional to the digital word value, or, you could put that word into a lookup table that has data with a little bend in it - take the output of that as the new word, then convert it to analog.

I'm not sure exactly what the inflection of that bend - little concave going up, little convex going up - does; change the phase of the harmonic? Anyway, you could do stuff like that with the lookup table. If the bit width is so big that the look up table is this gigantic data structure, I'm sure someone would figure out a way around that, to get to have the effect economically in 24 bits.

When a couple paralled 12AX7s would do. Or some analog function that raises an input to the power of another analog voltage, that can be anywhere between 0 and 2. Does such a thing exist? I dont know, or cant remember. Sounds like something RCA or Motorola would have made - at one time.
 

Attachments

  • 20231110_105119.jpg
    20231110_105119.jpg
    356.4 KB · Views: 89
If you don't mind the additional AD/DA conversions and therefore still want to go with a DSP solution then you can do it in a very simple fashion by squaring the input signal. I.e. you have to multiply it with itself, which is easily done in sigma studio. This will add some offset to the generated signal which you would have to get rid off by subtraction and/or higpass filtering. I guess you want to add just a little h2 so you would have to scale the thing down before you add it to the input signal.

Regards

Charles
 
That's what the chebyshev polynomial does. It's not plain squaring x^2, because (sin(y))^2 = 0.5(1-cos(2y)) which introduces a DC offset. That's why the second order polynomial is 2x^2 - 1 which for x = sin(y) yields -cos(2y), i.e. -90 degrees phase-shifted H2, no DC offset https://www.wolframalpha.com/input?i=2sin^2(x)+-1

So simply adding to each sample x the second harmonic of k * (2 x^2 - 1), where k determines how much is added. If the signal is a single sine tone of amplitude 1, the k coeff is directly the ratio of the added harmonic. For weaker signal the k must be lowered accordingly.

It's trivial in a DSP.

EDIT: I see, for signal amplitude < 1 even the chebyshev introduces the DC offset, i.e. https://www.wolframalpha.com/input?i=2(0.5sin(x))^2+-1 . IIUC the subtracted constant should be square of the momentary amplitude level https://www.wolframalpha.com/input?i=2(0.5sin(x))^2+-0.25 . So the HP filter is probably the way.
 
Last edited:
Be careful with that approach for music, as both A/D and D/A converters - that which gets the signal into and out of the DSP - has to be of better quality than "usual". Of course you're aware of all the thrash in Audio around this DAC, that DAC and the never ending race toward perfection in conversion back to a set of RCA outs.

Keeping within the analog domain eliminates that, with trade off for other "problems".

One example would be the so-called 2nd harmonic generator which is simply two triode stages strapped together. I know that an analog multiplier can square an input, such that you get twice the frequency out - for a sine wave input - which I assume one could mix to a level back with the original signal. Would that work for music? Dont know.

One would think the manufacturers of these high end DACs would realize some customers actually want a little THD of a specific kind and engineer that into their product as an option. I.E. you can have the perfectly linear transfer function, where the voltage out is exactly proportional to the digital word value, or, you could put that word into a lookup table that has data with a little bend in it - take the output of that as the new word, then convert it to analog.

I'm not sure exactly what the inflection of that bend - little concave going up, little convex going up - does; change the phase of the harmonic? Anyway, you could do stuff like that with the lookup table. If the bit width is so big that the look up table is this gigantic data structure, I'm sure someone would figure out a way around that, to get to have the effect economically in 24 bits.

When a couple paralled 12AX7s would do. Or some analog function that raises an input to the power of another analog voltage, that can be anywhere between 0 and 2. Does such a thing exist? I dont know, or cant remember. Sounds like something RCA or Motorola would have made - at one time.
I have actually built two prototypes using FETs and I can generate the desired sound. However the none-linear behavier that I use for that changes from transistor to transistor and requires excessiv time to adjust. Also those FETs are not cheap. I hope to find a cleaner solution using math instead.
I have now ordered a Development Board based on the ADAU1463 which I can program using SigmaStudio.
If anybody has suggestions how to implement this in Sigma Studio would be super helpful.
 
  • Like
Reactions: jjasniew
It's a bonkers idea and using DSP to achieve it even more bonkers.

Just build a tube amp.
Not bonkers at all, its a whole industry of emulated guitar amps - cheaper, more reliably, configurable, flexable, etc etc.

2nd order distortion is easy, use a transfer function like f(x) = x + k *x^2, where k selects how much 2nd order to add.

In the analog domain a single-stage transistor amplifier without emitter degeneration produces lots of distortion, although is not limited to 2nd-order.
 
  • Like
Reactions: newvirus2008
Not bonkers at all, its a whole industry of emulated guitar amps - cheaper, more reliably, configurable, flexable, etc etc.

2nd order distortion is easy, use a transfer function like f(x) = x + k *x^2, where k selects how much 2nd order to add.

In the analog domain a single-stage transistor amplifier without emitter degeneration produces lots of distortion, although is not limited to 2nd-order.
I was commenting in terms of HIFI audio.
 
Second harmonic is the difference in gain between the positive and negative phases of the signal. Shouldn't be too complicated to implement, I would think.
Not exactly, but close. An asymmetric transfer characteristic would generate even order harmonics. However, it'd be difficult to predict/control their weightages.
Hi my project consists of adding 2nd order harmonics to a stereo signal to achieve a more tube like sound.
You simply need to add a tube-like transfer characteristic (Vout vs. Vin) to the linear one that you have now, in order to get a tube-like sound. As others have already mentioned above, a DSP may not be necessary for this.