Mixing white and pink noise

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,274
I'd like to make a noise generator that creates white noise and pink noise, and allows you to mix to taste, basically choosing anywhere you want in between the two.

I've started simulating the basics for this. My circuit is based on ideas from these three sources:

https://www.edn.com/design/analog/4420926/White-noise-source-flat-from-1Hz-to-100kHz

https://www.maximintegrated.com/en/app-notes/index.mvp/id/3469

http://www.electronicdesign.com/analog/build-simple-precision-pink-noise-generator

In my simulation, the white noise is faked with an AC voltage source, and the pink noise filter looks beautiful. I thought I could just use a pot to passively mix the two, but I don't get the expected result. I assumed that since white noise is "flat" and pink noise has a straight line frequency plot (-3dB/octave slope,) that mixing the two would yield a straight line frequency plot as well, but the simulation output is noticeably curvy.

Is this not a valid way to mix these signals? Do I need a different approach? Or did I just have misguided expectations in terms of the frequency plot of the mixed signals?
IMG_3917.PNG
 

MrAl

Joined Jun 17, 2014
7,659
Hi,

Just a quick note, you should probably set that last op amp up as a true adder/mixer.
Make sure they can handle the power bandwidth also.
 

OBW0549

Joined Mar 2, 2015
3,442
I thought I could just use a pot to passively mix the two, but I don't get the expected result. I assumed that since white noise is "flat" and pink noise has a straight line frequency plot (-3dB/octave slope,) that mixing the two would yield a straight line frequency plot as well, but the simulation output is noticeably curvy.
If you simply mix white noise and pink noise (aka "1/f noise") the result is going to be exactly what you observed: at high frequencies, where the amplitude of the white component is larger than the amplitude of the pink component, the combined noise will have a flat spectrum; at low frequencies, where the pink amplitude is greater than the white amplitude, the combined noise will be pink. Changing the relative contributions of the two sources will only move the pink-to-white transition point (the corner frequency) up or down. We see the same thing in plots of op amp input noise voltage density, such as this one from the LT1792 data sheet:

Untitled.png

Below the 1/f corner frequency, the slope becomes -3dB/octave; above it, it flattens out. And in the vicinity of the corner frequency, there is a smooth, curved transition between the two regions.

If what you're after is an output with an adjustable -dB/octave slope, you won't get it using the mixing method, and I doubt there's any practical way to do it other than with DSP.

I've made multi-section analog filters with other -dB/octave characteristics (-1dB/octave, -2 dB/octave, etc.), but they're not adjustable.

Sorry to say, but I don't think there's any easy way to get what you're trying to achieve.
 

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,274
I do not know enough about noise generator theory to advise on the actual function.

But the non-inverting input of the U3 lacks a DC path to Ground.
Thanks! I'm super-sloppy when it comes to ac signals, coupling, and biasing. It's largely copying other circuits and guesswork at the moment, while I slowly try to make sense of it all.

I'll add a dc ground path for U3, similar to what R2 does for U1.

The other big question is this: how do you know when you need ac coupling at the input to an op amp stage? When I look at other ac circuits (mostly audio ones,) the pattern isn't obvious to me. Sometimes it seems almost every op amp has an input cap and biasing. Other times it seems to happen only once, at the first input to the first op amp. I assume it has to do with introduction of unwanted dc bias, but I'm not sure when there's risk of that and when there isn't.

So, I'm confident that ac coupling was needed at U1, but I'm not sure if I should also add it for U2, or if I can safely remove it from U3? Any advice, both general rules and specifics for U2 and U3, would be appreciated. Thanks!
 

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,274
If you simply mix white noise and pink noise (aka "1/f noise") the result is going to be exactly what you observed: at high frequencies, where the amplitude of the white component is larger than the amplitude of the pink component, the combined noise will have a flat spectrum; at low frequencies, where the pink amplitude is greater than the white amplitude, the combined noise will be pink. Changing the relative contributions of the two sources will only move the pink-to-white transition point (the corner frequency) up or down. We see the same thing in plots of op amp input noise voltage density, such as this one from the LT1792 data sheet:

View attachment 142248

Below the 1/f corner frequency, the slope becomes -3dB/octave; above it, it flattens out. And in the vicinity of the corner frequency, there is a smooth, curved transition between the two regions.

If what you're after is an output with an adjustable -dB/octave slope, you won't get it using the mixing method, and I doubt there's any practical way to do it other than with DSP.

I've made multi-section analog filters with other -dB/octave characteristics (-1dB/octave, -2 dB/octave, etc.), but they're not adjustable.

Sorry to say, but I don't think there's any easy way to get what you're trying to achieve.
Thanks! That may not be a big deal. The purpose of this circuit is partially just a fun, silly learning project, and partially an adjustable noise source for sleeping. My wife leaves a fan on every night because the noise helps her sleep, but there are many nights when she'd rather not have a fan running.

I figured I'd get this circuit mostly working in sim first, then make a rough copy that I feed into audio amps I've already got for testing, then build a "real" version with a small audio amp IC and little speaker to have a complete, self contained solution with two knobs: one for "tone" and the other for volume.

I guess I won't know till I hear it, but I'm guessing the mixing of white and pink may be acceptable for this application, even though it doesn't have the response I originally imagined.

Either way, thanks for the great explanation of why it's behaving the way it is.
 

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,274
Hi,

Just a quick note, you should probably set that last op amp up as a true adder/mixer.
Make sure they can handle the power bandwidth also.
Thanks! I have no idea how to do that, but I'll do some googling as soon as I have a moment and see what I can find. I'll post back later, either with my updates, or begging for help if I can't make sense of it!
 

Kjeldgaard

Joined Apr 7, 2016
398
If I'm going to try to say something about operating amplifiers and DC paths in general:

Both inputs should see a resistor to a "fixed voltage" - and this voltage may, for example, be a power supply, ground or output from an operational amplifier.
 

OBW0549

Joined Mar 2, 2015
3,442
The other big question is this: how do you know when you need ac coupling at the input to an op amp stage?
I think in general it's fairly straightforward: if the driving stage's output has a significant DC offset, and the driven stage's operation (or the operation of any stage further downstream) would be upset by that bias, then use AC coupling to remove it.

When I look at other ac circuits (mostly audio ones,) the pattern isn't obvious to me. Sometimes it seems almost every op amp has an input cap and biasing. Other times it seems to happen only once, at the first input to the first op amp. I assume it has to do with introduction of unwanted dc bias, but I'm not sure when there's risk of that and when there isn't.
I think you have to look at the amount of DC bias, the voltage gains of subsequent stages and their linearity/clipping characteristics, and then make a judgement call using the general principle I described above.

Also, keep in mind that different people have different ways of doing things: some will strive mightily to use DC coupling throughout a design all the way from input to output, while others will AC couple between stages even if they don't really need to. Different strokes for different folks, more than one way to skin a cat, and all that...
 

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,274
All right, I don't know if I'm making things better or worse, but here's my latest update.

I've added gain to U2 in order to make white noise and pink noise have similar levels at 1kHz so that turning the "tone" pot doesn't change volume as drastically. I'm not sure how much gain is right for this - I'll have to experiment.

I've also removed the coupling cap on the input to U3, so it should have a DC path now. I could be wrong, but I believe this also addresses the question of setting U3 up in a standard summing arrangement. Power from U3 isn't an issue - I intend to use U3 for summing and buffering and use an audio amp IC (LM386???) of some sort for power once I've gotten the signal part of the circuit working properly.

I've plotted the frequency response of the output with the pot in the following positions:
Code:
 0.1%
10.0%
25.0%
50.0%
75.0%
90.0%
99.9%
I'd appreciate any comments or criticism.
white-noise_05.png
 

Audioguru

Joined Dec 20, 2007
11,249
You mentioned playing the noise signal on a "little" speaker. Then maybe you want to add a highpass filter at the input of U3 to reduce the "boomy" resonance sound of a small speaker. The highpass filter is a coupling capacitor feeding a bias resistor. To reduce frequencies less than 160Hz use 0.01uF (10nF) and a 100k resistor.
The 1uF input capacitor C1 feeding the 1M of R2 passes frequencies down to 0.16Hz so the small speaker will certainly be driven with frequencies causing boomy sounds. To reduce frequencies less than 160Hz use 0.01uF (10nF) and a 100k resistor.
 

MrAl

Joined Jun 17, 2014
7,659
All right, I don't know if I'm making things better or worse, but here's my latest update.

I've added gain to U2 in order to make white noise and pink noise have similar levels at 1kHz so that turning the "tone" pot doesn't change volume as drastically. I'm not sure how much gain is right for this - I'll have to experiment.

I've also removed the coupling cap on the input to U3, so it should have a DC path now. I could be wrong, but I believe this also addresses the question of setting U3 up in a standard summing arrangement. Power from U3 isn't an issue - I intend to use U3 for summing and buffering and use an audio amp IC (LM386???) of some sort for power once I've gotten the signal part of the circuit working properly.

I've plotted the frequency response of the output with the pot in the following positions:
Code:
 0.1%
10.0%
25.0%
50.0%
75.0%
90.0%
99.9%
I'd appreciate any comments or criticism.
View attachment 142252
Hi,

Just to note, a true adder has the two resistors on the inverting terminal. Then you can run the non inverting terminal to ground too.
 

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,274
Hi,

Just to note, a true adder has the two resistors on the inverting terminal. Then you can run the non inverting terminal to ground too.
Are you talking about configuring it as an inverting instead of non-inverting amp, feeding the signal into the inverting input?

When I read up on audio summing and mixing amps, I found numerous examples of both inverting and non-inverting styles. There seem to be pros and cons to each method, but I didn't get the impression either one was true-er than the other.

If you get a chance, could you share an image of what you have in mind? Maybe I'm just misunderstanding you.
 

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,274
You mentioned playing the noise signal on a "little" speaker. Then maybe you want to add a highpass filter at the input of U3 to reduce the "boomy" resonance sound of a small speaker. The highpass filter is a coupling capacitor feeding a bias resistor. To reduce frequencies less than 160Hz use 0.01uF (10nF) and a 100k resistor.
The 1uF input capacitor C1 feeding the 1M of R2 passes frequencies down to 0.16Hz so the small speaker will certainly be driven with frequencies causing boomy sounds. To reduce frequencies less than 160Hz use 0.01uF (10nF) and a 100k resistor.
Yeah, I had wondered about sending 20Hz or less into a tiny speaker. Even in the best case scenario it's a waste of electrical power. I'll incorporate a HPF like you've suggested. Thanks!
 

OBW0549

Joined Mar 2, 2015
3,442
Just to note, a true adder has the two resistors on the inverting terminal. Then you can run the non inverting terminal to ground too.
The circuit he has will work just fine, as-is. With the pot at one end, all of the signal will come from the pink source and none from the white source; with the pot at the other end, all of the signal will come from the white source and none from the pink source. And with the pot in the middle, 50% will come from each.
 

Audioguru

Joined Dec 20, 2007
11,249
We do not know the size and resonant frequency of the little speaker. If it resonates at 150Hz then it will sound "boomy" like a bongo drum and the response drops -12dB per octave below it then at 75Hz it will be -12dB, 38Hz will be -24dB, 19Hz will be -36dB and 10Hz will not be heard but might cause its cone to bang against its structure.

I don't know why you are mixing white noise with pink noise. I betcha pink noise sounds best but why didn't you use white noise with an adjustable lowpass filter treble tone control to cut its tone to any "color" you want?
 

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,274
We do not know the size and resonant frequency of the little speaker. If it resonates at 150Hz then it will sound "boomy" like a bongo drum and the response drops -12dB per octave below it then at 75Hz it will be -12dB, 38Hz will be -24dB, 19Hz will be -36dB and 10Hz will not be heard but might cause its cone to bang against its structure.

I don't know why you are mixing white noise with pink noise. I betcha pink noise sounds best but why didn't you use white noise with an adjustable lowpass filter treble tone control to cut its tone to any "color" you want?
I haven't chosen a speaker or enclosure yet. Just toying with ideas right now. I appreciate your insights on boominess and high pass filtering. When I get closer to making a final version I'll try to make sure I get it right. For now, I'll start with the values you originally mentioned and just see how it sounds.

As for white vs pink vs filtering other ways, it was kind of an arbitrary choice. I'm interested in seeing what this concept can do, so I'm going to try this idea out pretty much as it currently stands, but I'll be the first to admit it may not be the best way. Thankfully, it's just a for-fun project idea, so it doesn't really matter if I get it right on the first try or do things the most efficient way. If I make mistakes, I can learn from them! ...although I prefer to limit my mistakes to ones that don't waste heaping piles of money, so I'll try not to let any magic smoke out!
 

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,274
I'm usually more patient, but I got excited today and just bought piles of parts at Fry's to play with right away. I couldn't match some of the filter component values, but I got close enough to get in the ballpark. The results are all really promising, even with less than ideal part values. I've attached the latest updated schematic (moved HP filter to after buffer amp, but before final gain stage, and updated values to reflect what I actually purchased and used.)

I've also recorded snippets at several settings and done FFT plots for them. I'm pleasantly surprised with how well this has all worked. The trim pot does a nice, gradual transition from white to pink, with minimal change in overall volume (pink does sound a little quieter - I could tweak gain values for pink, but it's already pretty close.) My wife and I are both happy with the sound options, so next I'll tackle the LM386/speaker portion, as well as looking for a suitable power supply so I don't have to run on batteries forever.
white-noise_07B.png FFT_noise-comparisons.png white-pink-mix.png IMG_3957.jpg IMG_3958.jpg
 
Top