Author |
Message |
RingMad

Joined: Jan 15, 2011 Posts: 428 Location: Montreal, Canada
Audio files: 4
|
Posted: Wed Feb 08, 2012 7:48 pm Post subject:
Pseudo-Random Bit Generators |
 |
|
A friend of mine found some pseudo-random circuits in some books. I sat down and finally figured out Eagle CAD a bit and drew them up in a more Lunetta-friendly way (I hope... admittedly, these circuits are a bit complicated with their connections).
The first one uses a 4006 shift register and a 4077 XNOR . I've already posted about it [here: http://www.electro-music.com/forum/post-323156.html ], since it is a bit problematic and was hoping for a solution. Sometimes it can freeze if the clock speed is "too high" (sorry, I didn't measure the frequency). Usually, I have a switch that's normally "closed" and if the circuit freezes, I use the switch to cut the connection (between 4006 pin 1 and 4077 pin 10 works for me) for a second or two, then it unfreezes.
If anyone else has some circuits of this ilk, feel free to post them in this thread so we can have a collection.
If there are any questions about one, please refer to the chip pair or something so we know which you're talking about.
Description: |
4006-4077 pseudorandom 4-bit generator schematic (updated 2012.02.17) |
|
Filesize: |
20.91 KB |
Viewed: |
714 Time(s) |
This image has been reduced to fit the page. Click on it to enlarge. |

|
Last edited by RingMad on Fri Feb 17, 2012 3:51 pm; edited 1 time in total |
|
Back to top
|
|
 |
RingMad

Joined: Jan 15, 2011 Posts: 428 Location: Montreal, Canada
Audio files: 4
|
Posted: Wed Feb 08, 2012 7:53 pm Post subject:
|
 |
|
Here is another pseudo-random 4-bit generator circuit based on a 40174 hex D Flip Flop (only 4 are used, though), and a 4070 XOR.
This one is "more expensive" than the 4006-4077 circuit, since it requires 2 or 3 clocks instead of just one. I notice that if you use the bits in order, it seems to produce patterns that sortof count (up or down, I don't remember), but not quite. However, this can sound nice. Also, the outputs of the XOR could also be used as bits, thus making this an 8-bit generator.
Description: |
40174-4070 pseudorandom 4-bit generator schematic |
|
Filesize: |
105.67 KB |
Viewed: |
720 Time(s) |
This image has been reduced to fit the page. Click on it to enlarge. |

|
|
|
Back to top
|
|
 |
RingMad

Joined: Jan 15, 2011 Posts: 428 Location: Montreal, Canada
Audio files: 4
|
Posted: Fri Feb 17, 2012 3:55 pm Post subject:
|
 |
|
Attention to any who might have tried to build the 4006-4077 circuit before 2012.02.17... it turns out that one needs a pulldown resistor on at least one of the output bit lines, otherwise the circuit freezes. I've updated the schematic above to reflect that. Sorry. |
|
Back to top
|
|
 |
RingMad

Joined: Jan 15, 2011 Posts: 428 Location: Montreal, Canada
Audio files: 4
|
|
Back to top
|
|
 |
analog_backlash

Joined: Sep 04, 2012 Posts: 393 Location: Aldershot, UK
Audio files: 21
|
Posted: Sat Oct 13, 2012 8:08 am Post subject:
|
 |
|
Hi James,
Just noticed that you've updated these threads - thanks for the name check!
The only thing that I've noticed is that due to it being pseudo-random, if you clock it slowly it can seem a bit predictable at first (or am I just imagining this?). What I do is to turn up the clock speed at first and then slow it back down again after a few seconds. I don't know what the bit length of the pseudo-random cycle is, but if I do the above, it sure sounds random to me.
Gary |
|
Back to top
|
|
 |
RingMad

Joined: Jan 15, 2011 Posts: 428 Location: Montreal, Canada
Audio files: 4
|
Posted: Sun Oct 14, 2012 5:19 pm Post subject:
|
 |
|
Yeah, truth be told, I somehow have the impression that your amended version is a bit less random than the original. It almost seemed like it would always come up with the same pattern, somehow. It is rather hard to tell, though, not having some kind of data acquisition & statistical analysis. My method is to have the bits go into an R/2R DAC which feeds a VCO and listen and watch the LEDs.
I thought it might be handy to have some way of resetting or changing the pattern, short of turning the whole thing off. I still didn't come up with something entirely satisfactory.
James. |
|
Back to top
|
|
 |
analog_backlash

Joined: Sep 04, 2012 Posts: 393 Location: Aldershot, UK
Audio files: 21
|
Posted: Mon Oct 15, 2012 3:21 am Post subject:
|
 |
|
I suspect that the cycle sequence has a bit length shorter than that of the original circuit. As I said before, then reversal of the two connections between 4006 pins 5 & 6 and 4070 (originally 4077) pins 3 & 4 was the only change that I tried and it "worked". It may be that a different set up would give the same cycle length of the original, but like yourself, I managed to fry a 4006 during prototyping and I don't want to lose any more!
I have a Velleman USB I/O board which I have been thinking about writing a Visual Basic program for, to turn it into a simple (low frequency) data analyser, which would be very useful. If I ever get round to doing that, I might work out the answer (but don't hold your breath...).
Gary |
|
Back to top
|
|
 |
-minus-
Joined: Oct 26, 2008 Posts: 787
Audio files: 13
|
Posted: Thu Oct 18, 2012 9:49 pm Post subject:
|
 |
|
I've been experimenting with this too. The problem I'm having is patterns do repeat. I'm not sure it really matters for Lunetta purposes. Once the random signal is patched in through other gates, it may not be so obvious that its repeating. I've been basing my circuit off this one here:
http://www.doctronics.co.uk/4015.htm |
|
Back to top
|
|
 |
analog_backlash

Joined: Sep 04, 2012 Posts: 393 Location: Aldershot, UK
Audio files: 21
|
Posted: Fri Oct 19, 2012 3:32 am Post subject:
|
 |
|
Thanks for that link -minus-. I've obviously been there before, as I'd kept a copy of some of the circuits there. The advantage of this design is that the 4015 is still freely available, so you don't have to pay inflated prices from "hard-to-find" component suppliers. I will have a go at this circuit and see what happens.
The ultimate problem, is that if you use purely logic-based circuits to produce randomness, you are always producing a finite sequence of 1s and 0s, so they will eventually repeat. The trick is how long a sequence you can manage to produce. If you want a more truly random sequence, I believe that you need a circuit which utilises an analogue white noise source (e.g. from a reverse-biased NPN base-emitter junction, noisy zener diode etc.). An example of this is at the link below:
http://www.sdiy.org/ensign/
I have not tried this out yet - another circuit to add to the list.
Gary |
|
Back to top
|
|
 |
RingMad

Joined: Jan 15, 2011 Posts: 428 Location: Montreal, Canada
Audio files: 4
|
Posted: Fri Oct 19, 2012 6:54 am Post subject:
|
 |
|
analog_backlash, you are indeed right about the "ultimate problem".
I don't think I ever tried a 4015-based circuit, but I will soon... Inventor has one for the emSynth... http://electro-music.com/emsynth/PseudoRandom.html .
James. |
|
Back to top
|
|
 |
analog_backlash

Joined: Sep 04, 2012 Posts: 393 Location: Aldershot, UK
Audio files: 21
|
Posted: Fri Oct 19, 2012 8:04 am Post subject:
|
 |
|
Thanks for that James - I haven't seen that circuit before. I forgot to mention the "penultimate problem" earlier. That is the sequence will always start in the same way, all other things being equal. It may be possible to change where the sequence starts by adding a button (or buttons) which force an input (or inputs) to high or low logic (like your original reset button idea). I have not tried this yet - it's just an idea at the moment, but it seems to make sense.
Gary |
|
Back to top
|
|
 |
-minus-
Joined: Oct 26, 2008 Posts: 787
Audio files: 13
|
Posted: Fri Oct 19, 2012 11:33 am Post subject:
|
 |
|
Yes it does always start in the same way. The white noise idea is probably a better option... or using a geiger counter. I'm not convinced 'random' actually exists outside of a theoretical idea.
There are a couple of mistakes in that link I posted earlier. The power jumpers to the 4070 board are in the wrong holes. Also, they mention a 4040 in the text but I assume it's the 4070 they are referring to.
EDIT: I just looked at Les' PRNG. That is essentially what I have on breadboard, although Les is using a more ICs to make his 24 bit. I dropped the 10uF capacitor from the path back to the 4015 in that doctronics circuit too- it just wasn't working. I notice Les doesn't have it either... and if it's good enough for Inventor- it's good enough for me! |
|
Back to top
|
|
 |
analog_backlash

Joined: Sep 04, 2012 Posts: 393 Location: Aldershot, UK
Audio files: 21
|
Posted: Fri Oct 19, 2012 3:11 pm Post subject:
|
 |
|
I've seen those Geiger-Muller tube random number generators. It strikes me as a rather expensive option! I actually have a Geiger counter which I built several years back (I'm not sure why) but I think that I'll leave it intact.
It is very hard for the human brain to correctly "see" randomness, so it can cloud your judgement. I think that it's a bit like trying to envisage infinity - it makes you go a bit crazy...
Beware of apophenia!
http://en.wikipedia.org/wiki/Apophenia |
|
Back to top
|
|
 |
-minus-
Joined: Oct 26, 2008 Posts: 787
Audio files: 13
|
Posted: Fri Oct 19, 2012 5:23 pm Post subject:
|
 |
|
Apophenia? Nope, no Jesus on my burnt toast!
I was thinking about SEEING randomness as I was watching this stream of LEDs for several hours. I did not have this hooked to any sound generating device; I was merely observing LED patterns by sight. Had this been connected to observe the patterns aurally I would have noticed it quicker I think. I was pondering whether humans discern aural patterns of this nature easier than visual ones.
I'm not too concerned about being unable to attain the holy grail of randomness. It just seemed like a nice extra feature to tag onto a 4015 shift register module. After I patch a load of other shit into the signal or vice versa, I doubt it will sound 'regular'. I wonder why we find a lack of pattern so interesting? |
|
Back to top
|
|
 |
blue hell
Site Admin

Joined: Apr 03, 2004 Posts: 24389 Location: The Netherlands, Enschede
Audio files: 296
G2 patch files: 320
|
Posted: Fri Oct 19, 2012 5:40 pm Post subject:
|
 |
|
-minus- wrote: | [...] of this nature [...] |
I think so .. the eye is pretty good at seeing patterns in a plane or space even, the ear is pretty good at hearing things temporal ... for my ears / eyes at least _________________ Jan
also .. could someone please turn down the thermostat a bit.
 |
|
Back to top
|
|
 |
blue hell
Site Admin

Joined: Apr 03, 2004 Posts: 24389 Location: The Netherlands, Enschede
Audio files: 296
G2 patch files: 320
|
Posted: Fri Oct 19, 2012 5:46 pm Post subject:
|
 |
|
-minus- wrote: | I wonder why we find a lack of pattern so interesting? |
I don't think we do
to me it often is like the interesting stuff happens on the border somewhere between order and chaos, total lack of order being as boring as total order.
So with the random sequence thingies .. it depends a bit on usage .. when it is to be a noise source for emulating high hat sounds or something you'd not want too much tone (i.e no short patterns), but when it does have tone you'd have some interesting other sounds ... _________________ Jan
also .. could someone please turn down the thermostat a bit.
 |
|
Back to top
|
|
 |
RingMad

Joined: Jan 15, 2011 Posts: 428 Location: Montreal, Canada
Audio files: 4
|
Posted: Sat Oct 20, 2012 5:19 am Post subject:
|
 |
|
Ha, I was going to write some stuff last night but was too tired, and now you guys are talking about this aspect...
I think total perfect randomness would not be very "musical". I guess it depends on how it is used. I tend to use it in situations where there is a pretty obvious relation between the bits and the sounds. My clock rates are relatively slow, often producing a few bits per second.
What I like about these pseudo-random circuits is that they produce patterns that repeat, but which produce variations that to me, keep it interesting. I guess some people can listen to a 4/4 beat forever, but I find it interesting when there's a glitch or some sort of change every once in a while.
For me, the question is how much repetition and how much glitch.
James. |
|
Back to top
|
|
 |
analog_backlash

Joined: Sep 04, 2012 Posts: 393 Location: Aldershot, UK
Audio files: 21
|
Posted: Sat Oct 20, 2012 5:36 am Post subject:
|
 |
|
Sounds like an interesting idea James. I think that you and Jan are right that having a certain degree of randomness can be interesting, but total randomness less so. I also think that the -minus- observation that maybe we can more correctly spot aural pattern repetition than we can analyse visual repetition (of LEDs flashing) is probably true.
As for the apophenia, I have a textured ceiling in my living room (it was like that when I moved in) and I can see a profile view of the head of "popular British entertainer" Bruce Forsyth and the word "FIZZY" in it (but not Jesus). I'll leave it to your imagination what this says about the state of mind... |
|
Back to top
|
|
 |
-minus-
Joined: Oct 26, 2008 Posts: 787
Audio files: 13
|
Posted: Sat Oct 20, 2012 11:46 am Post subject:
|
 |
|
analog_backlash wrote: | I can see a profile view of the head of "popular British entertainer" Bruce Forsyth |
I had forgotten all about him! Brings back disturbing memories... Hope you said, "Nice to see you, to see you nice". Did you remember the cuddly toy?  |
|
Back to top
|
|
 |
transponderfish

Joined: Feb 09, 2012 Posts: 17 Location: 3rd from the sun
|
Posted: Sat Oct 20, 2012 2:25 pm Post subject:
|
 |
|
A very interesting article, I will definitely add Apophenia to the list of concepts that help me understand the world (which is quite chaotic, as you all may have noticed).
I did not really follow the in-depth details of the Higgs particle, so I do not know if sonification of data really contributed to finding it, I bookmarked the CERN-page about it some months ago:
http://lhcsound.hep.ucl.ac.uk/page_library/SoundsLibrary.html
Beautiful sounds, aren't they? The idea behind it is, that the amount of data generated by the LHC is so massive that a visualisation does not really make sense, as it has to be so coarse that the important details are not visible anymore. Thus, patterns and irregularities are difficult to find in traditional graphs. But the ear is much more efficient here, so sonification is another option. |
|
Back to top
|
|
 |
analog_backlash

Joined: Sep 04, 2012 Posts: 393 Location: Aldershot, UK
Audio files: 21
|
Posted: Mon Oct 22, 2012 4:47 pm Post subject:
|
 |
|
Sorry transponderfish, I've only just listened to the sounds of the Higgs Boson et. al. Sounds really amazing. All I have to now is build an LHC and hook it up to my synths!!
Gary |
|
Back to top
|
|
 |
jksuperstar

Joined: Aug 20, 2004 Posts: 2503 Location: Denver
Audio files: 1
G2 patch files: 18
|
Posted: Mon Oct 22, 2012 10:40 pm Post subject:
|
 |
|
Pseudo Random sequences usually have a maximum length determined by the number of shift elements..2^n-1, for 4 bits, is 16-1, or 15 steps. But where the XOR and feedback is placed could shorten that. To get more random, one could build two of these, running on different clocks, and XOR them together. The nice thing about pseudo random sequences, is that they are repetitive, so they can be useful for music. Adding a way to preset the shift registers, and reset back to that value after a set number of steps, or a certain value is hit on, means you get a step sequencer capable of many different sequences, but controllable and reload able from just a few controls. There's also typically 1 value that "locks" the shift registers into 1 value that doesn't change with clock pulses either. That's the -1 in 2^n-1.
Very nice for modulating with other signals, even through a pll or ring mod derivative. And sometimes better than an LFO for introducing slight oddity to something that's otherwise a bit too mundane (like a plain sine wave). |
|
Back to top
|
|
 |
gasboss775

Joined: Jan 02, 2016 Posts: 217 Location: Scotland
|
|
Back to top
|
|
 |
|