How did you maximize randomness in a S&H?

Started by Mark Hammer, January 27, 2018, 01:18:13 PM

Previous topic - Next topic

Mark Hammer

I'm trying to get a clone of a Maestro FSH-1 sample-and-hold off the ground.  I've added a couple of things to it, like variable decay for the envelope-controlled part, variable resonance, andsomething I like to call "droop" that lets the sampled noise voltage bleed off quickly before the next clock pulse, to get a quick downward filter sweep at each sample step.  And, of course, I ended up using a charge pump to allow operation from a 9V supply.

Everything is working fine, but I find the randomness of the S&H part not particularly satisfying, largely becauwe it is not particularly random.  I've installed sockets for the noise transistor, and tried out various ones, with slightly greater success.  But between twiddling the trimmer and swapping transistors, it still ends up sounding too predictable, as if I'm using a 4-step sequencer that cycles through a fdew fixed settings instead of the randomness I was expecting.

So what do you folks do to maximize the randomness of the sample?  Is it purely a matter of transistor selection or is there something else you do to the noise-generating/sampling circuit itself to get you the optimal sound?  I'm wondering if I should increase the feedback resistor in the op-amp that initially gooses the noise-transistor signal.

YellowBoy

I've come up against this before.  When I built mine following the schematic with the noise transistor collector tied to -9V and the Base left floating...I had a horrible experience trying to tune the Sample Hold range/depth.  Trying various transistors gave wildy varying results.

But I found some reading that suggested the original schematic had a typo error that has been proliferated ever since.  Instead of floating the base...try connecting it to -9V and float the collector.  This made tuning practically any BJT really easy.

I was very satisfied with my own build after this...except for the constant ticking in this mode...but I did build it on vero.

Maybe this will help?

YellowBoy

Can't find the article but if you google "transistor noise generator" you will find plenty of schematics with a floating Collector and a Base to ground (Vcc-)

ElectricDruid

Personally, I gave up on transistor noise sources and go for a nice clean digital solution instead. Produces much more reliable noise at a much better level, doesn't need any selection, and always works straight out of the box.

Digital noise sources got a bad name because of the (frankly shocking) MM5837 which sounded terrible, but there's no intrinsic reason why they need to. Indeed, these days it's easy to design one which is *way* too good for audio work! I've done some on dsPIC that produce white noise at 16-bit/96KHz quality and which don't repeat for ten million years!

Example with code:

https://electricdruid.net/white-noise-source/

However, I have to say, that if you're going that route, you might as well generate the S&H waveform itself, rather than generate some noise and then sample it. That's why I included the "Rand" S&H waveform on my TapLFO chip. Incidentally, I'm working on a new version of that which adds a "random slopes" waveform  (like a triangle, but random) to the S&H random levels that it already has. Should be done in February.

https://electricdruid.net/tap-tempo-lfo-taplfo-v2d/

HTH,
Tom

Mark Hammer

#4
Quote from: YellowBoy on January 27, 2018, 02:00:13 PM
I've come up against this before.  When I built mine following the schematic with the noise transistor collector tied to -9V and the Base left floating...I had a horrible experience trying to tune the Sample Hold range/depth.  Trying various transistors gave wildy varying results.

But I found some reading that suggested the original schematic had a typo error that has been proliferated ever since.  Instead of floating the base...try connecting it to -9V and float the collector.  This made tuning practically any BJT really easy.

I was very satisfied with my own build after this...except for the constant ticking in this mode...but I did build it on vero.

Maybe this will help?
I've found errors in a number of Maestro schematics over the years, so yet another error in this one would not surprise me in the least.

Just swapped the C and B leads on a 3904, and while not fabulously random, is a helluva lot better.  Thanks for the tip.

ADDENDUM:  Stuck in a 2N2222 instead of the 3904, making sure to exchange the B and C leads, and it was EXACTLY what I was looking for.  Success!!  Thank you Yellowboy.  I owe you one.

nocentelli

Quote from: YellowBoy on January 27, 2018, 02:00:13 PM
I've come up against this before.  When I built mine following the schematic with the noise transistor collector tied to -9V and the Base left floating...I had a horrible experience trying to tune the Sample Hold range/depth.  Trying various transistors gave wildy varying results.

But I found some reading that suggested the original schematic had a typo error that has been proliferated ever since.  Instead of floating the base...try connecting it to -9V and float the collector.  This made tuning practically any BJT really easy...

Quote from: aquatuar
According to plenty of internet´s stomp box builder´s experiences the noise generator part is seemingly notoriously vulnerable.  It is not known, what their problem was, presumably too little noise from the noise generation transistor Q4,
which leads to a lot of mojo regarding transistor choice.

The original circuit uses a reverse biased transistor with the base open, which is very strange. It is not easily explainable, how this is supposed to work, no reference could be found that supports that wiring, however it is easily comprehensible that this does not work in many cases.

In contrast, a better known circuit is to use the base-emitter junction of a transistor in reverse, which exhibits an excellent zener diode breakthrough at about 6 Volts. Zener junctions are known to be noisy. Naturally, a 6V (or thereabouts) zener diode will work too.

http://aquataur.hilpold.net/aquataur/musicstuff/fsh-1.html
Quote from: kayceesqueeze on the back and never open it up again

YellowBoy

Glad to help Mark.

Thats the article I read nocentelli!  That and his posts on the other forum fill out what I said earlier.

Cheers lad

blackieNYC

#7
Mark! Are you still socketed?  I'd love to see some working hfe numbers, and maybe the resistance (in-circuit or out) of the pots!  Mine is still in the Drawer of Shame, with a really annoying "peep pop pop puh pop peep..." sound.
In giving up on it, I built an Escobedo PWM with RG's pseudo random LFO.  A handful of hex inverter oscillators mixed together, and i must say that being able to shape your own "randomness" is pretty cool.

Nice article.
  • SUPPORTER
http://29hourmusicpeople.bandcamp.com/
Tapflo filter, Gator, Magnus Modulus +,Meathead, 4049er,Great Destroyer,Scrambler+, para EQ, Azabache, two-loop mix/blend, Slow Gear, Phase Royal, Escobedo PWM, Uglyface, Jawari,Corruptor,Tri-Vibe,Battery Warmers

Mark Hammer

#8
I see that the Aquataur document/page and accompanying noise generator schematic show a 2M7 feedback resistor for the op-amp, instead of the 1M shown in the (supposed) stock FSH-1 schematic.

The hfe of the transistor I ended up using is 160, and the Vf between the emitter and base is 650mv.  Hope that helps.  I think I may up the value of the feedback resistor and see where that takes me.  My working hypothesis is that it will increase the potential contrast across sampled voltages.

ADDENDUM:  Nah.  1M was the ticket.  If I was using a 10-turn trimmer, maybe 2M7 would have been serviceable, but with that much op-amp gain, I had to turn the trimmer down to where it was too twitchy.  1M put the trimmer in the sweet spot of adjustability.  I suppose it may depend on the particular transistor used.

R.G.

I'm with E.D. on this one. A $0.50 eight pin controller can make wide bandwidth, really decent sounding noise reliably, with full power supply amplitude. The "power supply" can be anything from about 2V to 5.5V, easy enough to set up.

Once you get over the (admittedly big!) hump of programming the chips, you start regarding them as just tools. And like tools, you wonder how you ever got along without that tool.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Mark Hammer

If memory serves, my very best prof, as an undergrad, had done some development for then fledgling Digital Equipment Corporation in the late 60's or early 70's.  As I recall from the stuff we were given to read, a noisy zener diode was used as the source for the random number generator.

R.G.

Yes, and for a good reason. There is a difference between things that are random, pseudo-random, and noisy. The ear perceives sounds that are not autocorrelated over the period of audible memory to be noisy. "Autocorrelated" in this context means "hey! that just repeated". It's what is wrong with the MM5437. The sequence length on the chip was about a second. It produced a noise spectrum that was mostly flat across the audio spectrum, but the pattern repeat at about a second produced a notable thump sound if you listened to it.

The MM5437 is/was a digital pseudorandom sequence generator. These things have the characteristic that if properly set up, they have two-to-the-N minus one states, where N is the number of shift register stages used. the MM5347 used 23 stages and an oscillator that clocked them all around in about a second. I can't recall the math without looking it up, but the speed of the oscillator needed to produce good sound at the high end of the spectrum is a multiple of the highest frequency you want to be part of the flat noise spectrum. So you eat a lot of states, quickly.

All of the pseudorandom generators use something similar. They share the characteristic that they repeat after some time. What varies is the length of time before repeating. This can be very long, if you just keep adding stages. This is pretty simple in microcontrollers and you can make sequences that will never repeat in human memory time, so have no apparent repeat noise or thump.

Then we get down to real randomness. The noise generated by a broken junction is IIRC a statistically generated quantum function, where charge carriers leak over the boundary at intervals that are as nearly random as anything else we know of. That's why the minicomputers used a broken zener junction. It was really random, not apparently random. Modern computers have various solutions to the need for real as opposed to apparently random sources. There is a small niche of study in computing devoted to how to make random functions, not pseudorandom ones.

Pseudorandom has some advantages too. The sequence appears to be random, but if you start the sequence with the same seed, it repeats exactly the same sequence every time from the start. This is really useful for testing things like microphones and speakers and such.

My approach in all the PR generators I did where this mattered was to every so often tuck away part of the sequence to seed the next start. Most of the chips have some non-volatile storage, so this is feasible.

But I'm rambling. Yes, computers did use zeners for real randomness.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Mark Hammer

Just for the record, and so that people don't start searching for datasheets that don't exist, it's MM5837.  I happened to have one, and made a small noise generator for the modular synth I'm slowly building.  Sounds noisy enough for me.  Whether what sounds noisy also yields acceptable randomness when sampled in a discrete step-wise fashion is an entirely different thing. 

I think it is also fair to consider that part of what makes a chip like that sound white-noisey is the very fact that the pseudo-random sequence spooled out IS in steps.  Folks may remember that when we want our guitars to have a mountain of harmonic content, we do our best to square the waveform.  So when what a chip does is spool out a succession of brief square/stairstep waves, there is going to be a lot of harmonic content there.  It may not be truly random, but it sure as heck sounds like everything from 20hz up to dog and dolphin frequencies.

For something like a S&H unit, what one strives for is something different between the previous center-frequency and current one.  Part of that involves the degree of contrast in the random/noise source, which is why there is a trimmer.  The zener-based RNG I alluded to earlier was often used to generate unpredictable sequences for rats being trained in some task.  So, given a 2-choice task, the food reward might be found LLRLRRRLRLRLLLR over 15 trials.  The rat learned the food was likely somewhere, but couldn't tell in advance whether it would be there, or there.  That's "random" enough, but very limited insomuch as it is a binary choice.  For something like the FSH-1, what we are really looking for is a degree of contrast beyond mere left vs right, and more along the lines of now it's in Madagascar, now it's in Moldova, now in Uruguay, now in Cambodia, etc.  In other words, the degree of randomness aimed at needs to be a complement to the purpose.  If unpredictable alternation between 2 states is enough, then its enough.    If something that isn't the same as the last 3 states is enough, then it's enough.  If the rate at which state-changes occur is slow enough that one has a harder time "autocorrelating" across  them, then randomness needs are reduced.

amptramp

I have a General Radio 1390-B Random Noise Generator that uses a 6D4 gas triode (thyratron) as a noise source.  Gas diodes and triodes have been used since before the transistor to generate random noise from the ionization of gas. Maybe not useful in your case but there are a number of methods of generating random analog signals.

PRR

Pseudo-random is also handy for transmitting secrets. At least when computers were expensive, you could gate your plaintext with the pseudo and get "noise". At the other end, the same pseudo started on the same count could un-do the "noise" and recover the plaintext. Even today a non-trivial pseudo could take a lot of computer to crack.

However once the pseudo is known the secret is out. If those rats could suss-out the pattern and repetition, on the second cycle they would be on the food every time. Breakdown noise is not predictable.

For your musical sample/hold, one consideration may be low-pass on the noise. As you say it extends far past the audio band. For many purposes you do not want huge jumps. Early ARP synths had a "slow" random just for such purposes. You actually may not want "maximum random". And for music, you may want random choice of very specific values (the 12-note scale over a small number of octaves, or Gamelan or microtonal).
  • SUPPORTER

amz-fx

Quote from: Mark Hammer on January 28, 2018, 02:32:00 PM
Just for the record, and so that people don't start searching for datasheets that don't exist, it's MM5837.

The MM5837 was a 17-bit shift register and was sold at Radio Shack back in the day. I think I have a couple in the old IC drawer.

Datasheet:  http://www.dutchsynth.nl/images/mm5837.pdf

regards, Jack

Rob Strand

#16
IMHO for non-statistical stuff the Linear Feedback Shift Register (LFSR) types like the MM5837 are fine. 
The main issue with the MM5837 is the short cycle time (since it's only 17 bits).    It means you can hear the cycles repeat on a human scale.   31-bit is a vast improvement.  The more bits the better.

Not all pseudo random number generators are the same.   There's many *types*.   There's also a difference between generating bit sequences and sequences of numbers (by taking the output of the whole register).  LFSR's are OK generating bit sequences.

One of the boss pedals or drum machines used a transistor as a noise source.  However it didn't use the common reverse biased BE junction.  IIRC it was a high gain amp which amplifies thermal noise.   Can't remember which unit it was now.

[EDIT;  it was the Dr Rhythm DR55,  Q8, R50, Q9 etc.]


Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

PRR

#17
> MM5837 ...short cycle time...the cycles repeat on a human scale.

2.4 seconds. And whatever the "random" is, there's an excess of bass at one point. So it "thumps" every 2.4 seconds. Listened to that for hours room-tuning (and allowing for the thump-- low-tech days).

I did not realize the MM5837 starts on a random bit-load at each power-up. However it clearly repeated the same pattern every couple seconds.

> IIRC it was a high gain amp and the amplifiers thermal noise

I have proposed a TL072 just that way. Hiss is low and consistent, and will run on 7V where the back-breakdown tricks often crap out.

One thing about all the breakdown hiss sources: 1/f noise. Rising bass/sub-bass rumble. Tubes and many MOSFETs start to rise well up the audio band. Modern TL072 rise below 100Hz. I remember having trouble with a BJT phono preamp making enough sub-sonic rumble to trip-out an over-protective power amplifier. While 1/f rise is perfectly normal (and appears to be inevitable at all scales of the universe), it would have audible effect on the spread/rate of random through an S/H working at note-rate.

  • SUPPORTER

Rob Strand

Quote2.4 seconds. And whatever the "random" is, there's an excess of bass at one point. So it "thumps" every 2.4 seconds. Listened to that for hours room-tuning (and allowing for the thump-- low-tech days).

LOL, yeah, anyone that's done enough audio testing will certainly know what a short cycle LFSR sounds like!   It feels like brain washing after a while.

QuoteI have proposed a TL072 just that way. Hiss is low and consistent, and will run on 7V where the back-breakdown tricks often crap out.
It should work.  I remember someone doing this years ago (70's) with a 741.  Only they claimed it was *pink* noise.  The author apologized to the manufacturer for using their IC in such a manner.

QuoteOne thing about all the breakdown hiss sources: 1/f noise.
There was a period where I spent a lot of time stuffing around with those. IIRC if you push too much current
under breakdown the noise quality can be pretty dismal.  Using low supply voltages also seemed detrimental.
I convinced myself it is possible to get a reasonable quality noise source - certainly to the ear.   I'll admit I didn't check too much below 20Hz in those days.

QuoteRising bass/sub-bass rumble. Tubes and many MOSFETs start to rise well up the audio band. Modern TL072 rise below 100Hz. I remember having trouble with a BJT phono preamp making enough sub-sonic rumble to trip-out an over-protective power amplifier. While 1/f rise is perfectly normal (and appears to be inevitable at all scales of the universe), it would have audible effect on the spread/rate of random through an S/H working at note-rate.
Wow, that's a tricky one.   I suppose you can filter out the low frequencies.  Should be OK for a simple device.  You just have to know the problem first!

Years ago I read a lot of papers on LFSR's and apparently the statistics (the level distribution) of the noise can change when you low-pass filter the output.  The simple reasoning was the bits in the register are not independent.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Mark Hammer

Quote from: amz-fx on January 28, 2018, 10:48:51 PM
Quote from: Mark Hammer on January 28, 2018, 02:32:00 PM
Just for the record, and so that people don't start searching for datasheets that don't exist, it's MM5837.

The MM5837 was a 17-bit shift register and was sold at Radio Shack back in the day. I think I have a couple in the old IC drawer.

Datasheet:  http://www.dutchsynth.nl/images/mm5837.pdf

regards, Jack
In fact, I think that's where I got mine.

Regards,
Mark