electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
Live streaming at radio.electro-music.com

  host / artist show at your time
  EdisonRex Edison's Electronic Review
Please visit the chat
 Forum index » DIY Hardware and Software » Lunettas - circuits inspired by Stanley Lunetta
Pseudo-Random Bit Generators
Post new topic   Reply to topic Moderators: mosc
Page 1 of 1 [22 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
RingMad



Joined: Jan 15, 2011
Posts: 219
Location: Montreal, Canada
Audio files: 2

PostPosted: Wed Feb 08, 2012 7:48 pm    Post subject: Pseudo-Random Bit Generators Reply with quote  Mark this post and the followings unread

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.


4006-4077-pseudo-random-4bit-generator-schematic-v2.png
 Description:
4006-4077 pseudorandom 4-bit generator schematic (updated 2012.02.17)
 Filesize:  20.91 KB
 Viewed:  170 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

4006-4077-pseudo-random-4bit-generator-schematic-v2.png



Last edited by RingMad on Fri Feb 17, 2012 3:51 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
RingMad



Joined: Jan 15, 2011
Posts: 219
Location: Montreal, Canada
Audio files: 2

PostPosted: Wed Feb 08, 2012 7:53 pm    Post subject: Reply with quote  Mark this post and the followings unread

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.


40174-4070-pseudo-random-4bit-generator-schematic.png
 Description:
40174-4070 pseudorandom 4-bit generator schematic
 Filesize:  105.67 KB
 Viewed:  168 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

40174-4070-pseudo-random-4bit-generator-schematic.png


Back to top
View user's profile Send private message Visit poster's website
RingMad



Joined: Jan 15, 2011
Posts: 219
Location: Montreal, Canada
Audio files: 2

PostPosted: Fri Feb 17, 2012 3:55 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
RingMad



Joined: Jan 15, 2011
Posts: 219
Location: Montreal, Canada
Audio files: 2

PostPosted: Sat Oct 13, 2012 4:56 am    Post subject: Reply with quote  Mark this post and the followings unread

It turns out the 100k pulldown I mentioned in my previous post didn't really help on the 4006-4077 circuit. But analog_backlash has finally solved the freezing problem (it seemed to reach a steady state when run with clock speeds exceeding approximately 385 Hz). His solution was to replace the 4077 XNOR with a 4070 XOR (same pinout, just swap the chip), and swap the wires going to pins 5 & 6 of the 4006. Thanks, Gary!

I have redrawn the schematic to reflect these changes... see attached.

Alas, it appears that the 4006 shift register has been discontinued, but you may be able to find places that still have some left in stock.

James.


4006-4070-pseudo-random-4bit-generator-schematic-v3.png
 Description:
4006-4070 pseudorandom 4-bit generator schematic
 Filesize:  10.29 KB
 Viewed:  114 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

4006-4070-pseudo-random-4bit-generator-schematic-v3.png


Back to top
View user's profile Send private message Visit poster's website
analog_backlash



Joined: Sep 04, 2012
Posts: 387
Location: Aldershot, UK
Audio files: 21

PostPosted: Sat Oct 13, 2012 8:08 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
RingMad



Joined: Jan 15, 2011
Posts: 219
Location: Montreal, Canada
Audio files: 2

PostPosted: Sun Oct 14, 2012 5:19 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
analog_backlash



Joined: Sep 04, 2012
Posts: 387
Location: Aldershot, UK
Audio files: 21

PostPosted: Mon Oct 15, 2012 3:21 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
-minus-



Joined: Oct 26, 2008
Posts: 760

Audio files: 13

PostPosted: Thu Oct 18, 2012 9:49 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
analog_backlash



Joined: Sep 04, 2012
Posts: 387
Location: Aldershot, UK
Audio files: 21

PostPosted: Fri Oct 19, 2012 3:32 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
RingMad



Joined: Jan 15, 2011
Posts: 219
Location: Montreal, Canada
Audio files: 2

PostPosted: Fri Oct 19, 2012 6:54 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
analog_backlash



Joined: Sep 04, 2012
Posts: 387
Location: Aldershot, UK
Audio files: 21

PostPosted: Fri Oct 19, 2012 8:04 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
-minus-



Joined: Oct 26, 2008
Posts: 760

Audio files: 13

PostPosted: Fri Oct 19, 2012 11:33 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
analog_backlash



Joined: Sep 04, 2012
Posts: 387
Location: Aldershot, UK
Audio files: 21

PostPosted: Fri Oct 19, 2012 3:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
-minus-



Joined: Oct 26, 2008
Posts: 760

Audio files: 13

PostPosted: Fri Oct 19, 2012 5:23 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20480
Location: The Netherlands, Enschede
Audio files: 147
G2 patch files: 318

PostPosted: Fri Oct 19, 2012 5:40 pm    Post subject: Reply with quote  Mark this post and the followings unread

-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
Back to top
View user's profile Send private message Visit poster's website
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20480
Location: The Netherlands, Enschede
Audio files: 147
G2 patch files: 318

PostPosted: Fri Oct 19, 2012 5:46 pm    Post subject: Reply with quote  Mark this post and the followings unread

-minus- wrote:
I wonder why we find a lack of pattern so interesting?


I don't think we do Wink

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
Back to top
View user's profile Send private message Visit poster's website
RingMad



Joined: Jan 15, 2011
Posts: 219
Location: Montreal, Canada
Audio files: 2

PostPosted: Sat Oct 20, 2012 5:19 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
analog_backlash



Joined: Sep 04, 2012
Posts: 387
Location: Aldershot, UK
Audio files: 21

PostPosted: Sat Oct 20, 2012 5:36 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
-minus-



Joined: Oct 26, 2008
Posts: 760

Audio files: 13

PostPosted: Sat Oct 20, 2012 11:46 am    Post subject: Reply with quote  Mark this post and the followings unread

analog_backlash wrote:
I can see a profile view of the head of "popular British entertainer" Bruce Forsyth


Laughing 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? Laughing
Back to top
View user's profile Send private message
transponderfish



Joined: Feb 09, 2012
Posts: 16
Location: 3rd from the sun

PostPosted: Sat Oct 20, 2012 2:25 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
analog_backlash



Joined: Sep 04, 2012
Posts: 387
Location: Aldershot, UK
Audio files: 21

PostPosted: Mon Oct 22, 2012 4:47 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
jksuperstar



Joined: Aug 20, 2004
Posts: 2483
Location: Denver
Audio files: 1
G2 patch files: 18

PostPosted: Mon Oct 22, 2012 10:40 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: mosc
Page 1 of 1 [22 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Lunettas - circuits inspired by Stanley Lunetta
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use